You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "rich7420 (via GitHub)" <gi...@apache.org> on 2026/08/30 13:31:27 UTC

[PR] HDDS-16349. Use HashSet instead of TreeSet for the per-datanode container index [ozone]

rich7420 opened a new pull request, #11168:
URL: https://github.com/apache/ozone/pull/11168

   ## What changes were proposed in this pull request?
   
   `DatanodeEntry` keeps the set of containers hosted on a datanode. Inside SCM's
   `NodeStateMap` there is one such entry per datanode, and every container report
   adds/removes/looks up `ContainerID`s in it. The set was a `TreeSet`, so every
   insert paid `O(log n)` to keep the containers in sorted order, but nothing reads
   that order:
   
   - `DatanodeEntry` only exposes the set through `Set<ContainerID>` (via
     `copyContainers()`), never `NavigableSet`/`SortedSet`, so callers cannot rely
     on ordering.
   - The consumers of `NodeManager.getContainers(dn)` iterate for membership,
     counting, or set math; none depends on sorted iteration.
   - The set is in-memory only and is not serialized to the wire.
   
   This swaps both the field and the `copyContainers()` copy to `HashSet`, giving
   `O(1)` add/remove/contains on the per-datanode container index and dropping the
   ordering work that no one uses. The ordered `NavigableSet` in `PipelineStateMap`
   is a different set and is untouched.
   
   ## What is the link to the Apache Jira
   
   https://issues.apache.org/jira/browse/HDDS-16349
   
   ## How was this patch tested?
   
   Existing SCM node-state and container-report suites, run locally and green:
   `TestContainerReportHandler`, `TestIncrementalContainerReportHandler`,
   `TestNodeStateMap`, `TestSCMNodeManager`, `TestNodeDecommissionManager`,
   `TestDatanodeAdminMonitor`, `TestDeadNodeHandler` (181 tests, 0 failures).
   `checkstyle` and `pmd` clean. No behavior change, so no new test is added.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16349. Use HashSet instead of TreeSet for the per-datanode container index [ozone]

Posted by "aryangupta1998 (via GitHub)" <gi...@apache.org>.
aryangupta1998 commented on PR #11168:
URL: https://github.com/apache/ozone/pull/11168#issuecomment-5521582308

   Thanks, @rich7420, for the patch and @yandrey321 and @Russole for the review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16349. Use HashSet instead of TreeSet for the per-datanode container index [ozone]

Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #11168:
URL: https://github.com/apache/ozone/pull/11168#issuecomment-5524897782

   Thanks every reviewers for the review 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-16349. Use HashSet instead of TreeSet for the per-datanode container index [ozone]

Posted by "aryangupta1998 (via GitHub)" <gi...@apache.org>.
aryangupta1998 merged PR #11168:
URL: https://github.com/apache/ozone/pull/11168


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org