HDDS-16365. Pipeline.getReplicaIndexes() unnecessarily create a new map. - #11194
HDDS-16365. Pipeline.getReplicaIndexes() unnecessarily create a new map.#11194szetszwo wants to merge 1 commit into
Conversation
| .setContainerID(containerBlockID.getContainerID()) | ||
| .setLocalID(containerBlockID.getLocalID()) | ||
| .setBlockCommitSequenceId(blockCommitSequenceId); | ||
| if (replicaIdx != null && replicaIdx > 0) { |
There was a problem hiding this comment.
This drops explicit replica index 0 on re-serialization. A base/head probe (setReplicaIndex(0) -> getFromProtobuf -> serialize) keeps presence on base but loses it here. Please preserve explicit zero and add a round-trip test.
| return true; | ||
| } | ||
|
|
||
| public Map<DatanodeDetails, Integer> getReplicaIndexesForTesting() { |
There was a problem hiding this comment.
This renames the ozone admin pipeline list --json field from replicaIndexes to replicaIndexesForTesting, since Pipeline is serialized directly here. A base/head JsonUtils probe reproduces it. Please preserve the existing property name.
| return Collections.unmodifiableList(validators); | ||
| } | ||
|
|
||
| public static HashMap<DatanodeDetails, GetBlockResponseProto> |
There was a problem hiding this comment.
Please avoid removing this public method in HDDS-16365. It is unrelated, was added by HDDS-3867, and exists in released Ozone versions; please restore it or move the cleanup to a follow-up Jira.
What changes were proposed in this pull request?
In Pipeline, the getReplicaIndexes() method, which copies the replicaIndexes map, is not really needed:
For #1 above, getReplicaIndexes() is mainly used for building DatanodeBlockID protos. We will also refactor the code:
What is the link to the Apache JIRA
HDDS-16365
How was this patch tested?
By updating existing tests.