greenwich commented on code in PR #10410:
URL: https://github.com/apache/ozone/pull/10410#discussion_r3360365495


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/StorageTier.java:
##########
@@ -40,21 +37,23 @@ public enum StorageTier {
 
   private final String tierName;
   private final List<StorageType> storageTypes;
-  private final boolean uniformStorageType;
-  private static final Map<StorageTier, Map<ReplicationConfig, 
List<StorageType>>>
+  private final boolean isUniform;
+  private static final Map<StorageTier, Map<Integer, List<StorageType>>>
       CACHE = new EnumMap<>(StorageTier.class);
+  public static final int MAX_NODE_COUNT = 20;

Review Comment:
     `MAX_NODE_COUNT` = 20 is undocumented and, because getStorageTypes(int) 
throws on a cache miss, it effectively silently caps replication width.
   
     For uniform tiers, `computeStorageTypes` is just 
`Collections.nCopies(...)` (O(1)), so the cache isn't buying anything — suggest 
dropping it:
   ```
     public List<StorageType> getStorageTypes(int nodeCount) {
       return computeStorageTypes(nodeCount);
     }
   ```
     I checked that later `fromID/computeId/findSupportedStorageTiers` work — 
none of it needs this cache (only the `StorageType`→prime table + computeId), 
so dropping it entirely is safe.
   
     (Or, if you'd rather keep the precompute: fall through to 
`computeStorageTypes(nodeCount)` on a miss, document `MAX_NODE_COUNT`, and make 
it private.)



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