[
https://issues.apache.org/jira/browse/HDDS-16365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz-wo Sze updated HDDS-16365:
------------------------------
Description:
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 existing getReplicaIndex(dn) method.
# One special case is in the ScmClient in OM for checking if a pipeline
containing all replica indexes -- create a new containsAllReplicaIndexes method.
# The remaining cases are used in tests for iterating the nodes -- rename it to
getReplicaIndexesForTesting() and use unmodifiableMap instead of copying.
For #1 above, getReplicaIndexes() is mainly used for building DatanodeBlockID
protos. We will also refactor the code:
- Add a new replicaIdx parameter to BlockID.getDatanodeBlockIDProtobufBuilder().
- For the code using DatanodeBlockID.Builder, change them to use
getDatanodeBlockIDProtobufBuilder(..) instead.
was:
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.
> 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
> Priority: Major
>
> 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 existing getReplicaIndex(dn) method.
> # One special case is in the ScmClient in OM for checking if a pipeline
> containing all replica indexes -- create a new containsAllReplicaIndexes
> method.
> # The remaining cases are used in tests for iterating the nodes -- rename it
> to getReplicaIndexesForTesting() and use unmodifiableMap instead of copying.
> For #1 above, getReplicaIndexes() is mainly used for building DatanodeBlockID
> protos. We will also refactor the code:
> - Add a new replicaIdx parameter to
> BlockID.getDatanodeBlockIDProtobufBuilder().
> - For the code using DatanodeBlockID.Builder, change them to use
> getDatanodeBlockIDProtobufBuilder(..) instead.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]