You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ctubbsii (via GitHub)" <gi...@apache.org> on 2023/08/29 11:37:45 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3736: Improve the UniqueNameAllocator configurability

ctubbsii commented on code in PR #3736:
URL: https://github.com/apache/accumulo/pull/3736#discussion_r1308683399


##########
server/base/src/main/java/org/apache/accumulo/server/tablets/UniqueNameAllocator.java:
##########
@@ -71,31 +70,29 @@ public synchronized String getNextName() {
         throw new RuntimeException(e);
       }
     }
-
     return new String(FastFormat.toZeroPaddedString(next++, 7, Character.MAX_RADIX, new byte[0]),
         UTF_8);
   }
 
   private int getAllocation() {
-    int baseAllocation =
-        context.getConfiguration().getCount(Property.GENERAL_FILENAME_BASE_ALLOCATION);
-    int jitterAllocation =
-        context.getConfiguration().getCount(Property.GENERAL_FILENAME_JITTER_ALLOCATION);
-
-    if (baseAllocation <= 0) {
-      log.warn("{} was set to {}, must be greater than 0. Using the default {}.",
-          Property.GENERAL_FILENAME_BASE_ALLOCATION.getKey(), baseAllocation,
-          DEFAULT_BASE_ALLOCATION);
-      baseAllocation = DEFAULT_BASE_ALLOCATION;
+    int minAllocation = context.getConfiguration().getCount(MIN_PROP);
+    int maxAllocation = context.getConfiguration().getCount(MAX_PROP);
+
+    if (minAllocation <= 0) {
+      int defaultMin = DefaultConfiguration.getInstance().getCount(MIN_PROP);

Review Comment:
   It's not recalculating it, but it is re-parsing the string. I suppose we could save that in a local variable, or memoize it in a memoizing supplier to avoid the string-to-int parse costs, but I don't think it makes much difference.
   
   The main change here is that it's using getCount() instead of a manual parse, which it was doing before.



-- 
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: notifications-unsubscribe@accumulo.apache.org

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