Tsz-wo Sze created HDDS-16365:
---------------------------------

             Summary: Pipeline.getReplicaIndexes() unnecessarily create a new 
map
                 Key: HDDS-16365
                 URL: https://issues.apache.org/jira/browse/HDDS-16365
             Project: Apache Ozone
          Issue Type: Improvement
          Components: common, OM, Ozone Client
            Reporter: Tsz-wo Sze
            Assignee: Tsz-wo Sze


In Pipeline, the getReplicaIndexes() method, which copies the replicaIndexes 
map, is not really needed:
# In many cases, the copied map is used for calling get(dn) -- just directly 
call the getReplicaIndex(dn) method.
# One special case is used in the ScmClient in OM to check if a pipeline 
containing all replica indexes -- create a new containsAllReplicaIndexes method.
# The remaining cases are used in tests for iterating the nodes -- rename 
getReplicaIndexesForTesting() and use unmodifiableMap instead of copying.

getReplicaIndexes() is mainly used for building DatanodeBlockID protos.  We 
will also refactor the code:
- Add a new replicaIdx parameter to BlockID.getDatanodeBlockIDProtobufBuilder().
- Change other code to use getDatanodeBlockIDProtobufBuilder(..) instead of 
using DatanodeBlockID.Builder.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to