[
https://issues.apache.org/jira/browse/HDFS-11370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15847826#comment-15847826
]
Manoj Govindassamy commented on HDFS-11370:
-------------------------------------------
Thanks [~tasanuma0829].
bq. I think it is the same risk as that of
BlockUnderConstructionFeature#getExpectedStorageLocations() at least.
{{BlockUnderConstructionFeature#getExpectedStorageLocations()}} and few other
public methods in the same class work on the {{replicas}} array without proper
synchronization but they never expose the cursor on the array to the caller.
With {{getExpectedStorageLocationsIterator()}} we will be exposing a public
iterator with the cursor exposed, but not thread safe. As a general practice,
its advisable not to introduce any new non thread safe public iterators. One
workaround here i can think of is, since the replicas is a very small array, we
can have a copy of the replicas in the iterator at the time of construction and
iterate over the same. Your thoughts please ?
> Optimize NamenodeFsck#getReplicaInfo
> ------------------------------------
>
> Key: HDFS-11370
> URL: https://issues.apache.org/jira/browse/HDFS-11370
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: namenode
> Reporter: Takanobu Asanuma
> Assignee: Takanobu Asanuma
> Priority: Minor
> Attachments: HDFS-11370.1.patch, HDFS-11370.2.patch,
> HDFS-11370.3.patch, HDFS-11370.4.patch, HDFS-11370.5.patch
>
>
> We can optimize the logic of calculating the number of storages in
> {{NamenodeFsck#getReplicaInfo}}. This is a follow-on task of HDFS-11124.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]