LuciferYang opened a new pull request, #12379:
URL: https://github.com/apache/gluten/pull/12379

   ## What changes are proposed in this pull request?
   
   `ConsistentHash` is `@ThreadSafe` and its accessors return defensive copies 
— except `getPartition()`, which returned the internal set directly:
   
   ```java
   return nodes.get(node);
   ```
   
   That set is the same instance held in the internal `nodes` map, so a caller 
could mutate the ring through it (e.g. `getPartition(node).clear()`), and the 
reference escaped after the read lock was released. This PR returns a defensive 
copy, matching `getNodes()`.
   
   This is latent today — `getPartition()` has no production caller and the 
internal set isn't mutated after a node is added — so there's no user-facing 
change; it's an encapsulation/consistency fix.
   
   Fixes #12378.
   
   ## How was this patch tested?
   
   Added a unit test that adds a node, clears the set returned by 
`getPartition()`, and verifies the ring still reports all partitions. The 
existing `ConsistentHashTest` cases still pass.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 4.8)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to