Skip to content

HDDS-16614. Remove pair usage from SCM replication core and tests. - #11805

Open
navinko wants to merge 5 commits into
apache:masterfrom
navinko:HDDS-16614
Open

navinko wants to merge 5 commits into
apache:masterfrom
navinko:HDDS-16614

Conversation

@navinko

@navinko navinko commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Replaced Pair usage from SCM replication core and tests with semantically named Java records.

Please describe your PR in detail:

Replaced Pair usage in ECUnderReplicationHandler.java and ReplicationManager.java, along with their respective test classes, with semantically named Java records to improve code readability and maintainability.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16614

How was this patch tested?

Updated the existing test cases and tested locally.
Successful CI Build: https://github.com/navinko/ozone/actions/runs/40680692227

@navinko
navinko marked this pull request as draft October 27, 2026 20:56
@github-actions github-actions Bot added the scm label Oct 27, 2026

@adoroszlai adoroszlai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @navinko for working on this.

Comment on lines +634 to +676
public static final class DatanodeCommand {
private final DatanodeDetails datanode;
private final SCMCommand<?> command;

private DatanodeCommand(DatanodeDetails datanode, SCMCommand<?> command) {
this.datanode = datanode;
this.command = command;
}

public static DatanodeCommand of(DatanodeDetails datanode, SCMCommand<?> command) {
return new DatanodeCommand(datanode, command);
}

public DatanodeDetails getDatanode() {
return datanode;
}

public SCMCommand<?> getCommand() {
return command;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DatanodeCommand)) {
return false;
}
DatanodeCommand that = (DatanodeCommand) o;
return Objects.equals(datanode, that.datanode) && Objects.equals(command, that.command);
}

@Override
public int hashCode() {
return Objects.hash(datanode, command);
}

@Override
public String toString() {
return "(" + datanode + ", " + command + ")";
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please replace these new value classes using records to avoid the boilerplate?

  public record DatanodeCommand(DatanodeDetails datanode, SCMCommand<?> command) { }

https://openjdk.org/jeps/395

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please replace these new value classes using records to avoid the boilerplate?

  public record DatanodeCommand(DatanodeDetails datanode, SCMCommand<?> command) { }

https://openjdk.org/jeps/395

Thanks @adoroszlai for the review suggestions, updated the value classes to use Java records to eliminate boilerplate, as suggested.

@navinko
navinko marked this pull request as ready for review October 28, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants