Andy Huang created HDDS-17446:
---------------------------------

             Summary: Avoid copying the datanode container set twice in 
NodeStateMap.updateNode
                 Key: HDDS-17446
                 URL: https://issues.apache.org/jira/browse/HDDS-17446
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Andy Huang


NodeStateMap.updateNode preserves a datanode's containers by passing 
oldEntry.copyContainers() to the DatanodeEntry constructor. copyContainers() 
creates a new HashSet, and the constructor then copies that set again with 
addAll. This allocates an unnecessary intermediate set and traverses the 
containers twice while holding the NodeStateMap write lock.

Pass the old DatanodeEntry to the constructor and copy old.containers directly 
into the new entry's container set. This preserves an independent set with a 
single copy.

Follow-up to HDDS-16632, identified in review:
https://github.com/apache/ozone/pull/11687#discussion_r4357379505

Validation: TestSCMNodeManager#testRegisterKeepsContainersOnNodeUpdate passes 
with this change (1 test, no failures or errors).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to