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

   ## What changes were proposed in this pull request?
   ```java
   //OMFailoverProxyProviderBase
     private Map<String, OMProxyInfo<T>> omProxies;
     private List<String> omNodesInOrder;
   ```
   OMFailoverProxyProviderBase currently has
   - omProxies: nodeId -> OMProxyInfo (Note that OMProxyInfo has a getNodeId() 
method.)
   - omNodesInOrder: int -> nodeId (Note that the ints specify the ordering of 
the proxies)
   
   When getting an OMProxyInfo from an int, it needs to get the nodeId and then 
lookup the omProxies map for OMProxyInfo.  The map lookup is unnecessary.
   
   In this JIRA,
   - we improve the data structures by replacing them with the following:
   ```java
       /** A list of proxies in a particular order. */
       private final List<OMProxyInfo<P>> proxies;
       /**
        * The ordering of the nodes.
        * <p>
        * Invariant 1: Given a nodeId, let Integer i = ordering.get(nodeId);
        *              If i != null, then nodeId.equals(info.getNodeId()) == 
true, where info = proxies.get(i).
        *              Otherwise, i == null, then 
nodeId.equals(info.getNodeId()) == false for any info in proxies.
        * <p>
        * Invariant 2: Given 0 <= i < proxies.size(), let nodeId = 
proxies.get(i).getNodeId().
        *              Then, ordering.get(nodeId) == i.
        */
       private final SortedMap<String, Integer> ordering;
   ```
   - We also move them to a new class with unmodifiable collections.  As a 
result, no synchronization is needed in the new class.
   
   ## What is the link to the Apache JIRA
   
   HDDS-14470
   
   ## How was this patch tested?
   
   By updating existing tests.


-- 
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