You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2023/08/28 21:40:26 UTC
[accumulo] branch main updated (59897142d4 -> 5bec1c33af)
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
from 59897142d4 Merge branch '2.1'
add 4c10226c76 Allow configurable name allocations (#3729)
new 5bec1c33af Merge branch '2.1'
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/accumulo/core/conf/Property.java | 11 +++++++-
.../server/tablets/UniqueNameAllocator.java | 33 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 2 deletions(-)
[accumulo] 01/01: Merge branch '2.1'
Posted by kt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 5bec1c33af6c464ce75f25ade7b4bd4dba0709ea
Merge: 59897142d4 4c10226c76
Author: Keith Turner <kt...@apache.org>
AuthorDate: Mon Aug 28 17:38:53 2023 -0400
Merge branch '2.1'
.../org/apache/accumulo/core/conf/Property.java | 11 +++++++-
.../server/tablets/UniqueNameAllocator.java | 33 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 2 deletions(-)
diff --cc core/src/main/java/org/apache/accumulo/core/conf/Property.java
index e64147f02e,77df51c5d8..1261d83b35
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@@ -1438,8 -1834,13 +1445,10 @@@ public enum Property
return key.startsWith(Property.TABLE_PREFIX.getKey())
|| key.startsWith(Property.TSERV_PREFIX.getKey())
|| key.startsWith(Property.MANAGER_PREFIX.getKey())
- || key.startsWith(Property.MASTER_PREFIX.getKey())
|| key.startsWith(Property.GC_PREFIX.getKey())
- || key.startsWith(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey());
+ || key.startsWith(Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey())
+ || key.equals(Property.GENERAL_FILENAME_BASE_ALLOCATION.getKey())
- || key.equals(Property.GENERAL_FILENAME_JITTER_ALLOCATION.getKey())
- || key.startsWith(VFS_CONTEXT_CLASSPATH_PROPERTY.getKey())
- || key.startsWith(REPLICATION_PREFIX.getKey());
++ || key.equals(Property.GENERAL_FILENAME_JITTER_ALLOCATION.getKey());
}
/**
diff --cc server/base/src/main/java/org/apache/accumulo/server/tablets/UniqueNameAllocator.java
index 042cc5b3f0,7c0f29c5ea..5e4cc77a7d
--- a/server/base/src/main/java/org/apache/accumulo/server/tablets/UniqueNameAllocator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/tablets/UniqueNameAllocator.java
@@@ -19,11 -19,15 +19,14 @@@
package org.apache.accumulo.server.tablets;
import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.security.SecureRandom;
+import static org.apache.accumulo.core.util.LazySingletons.RANDOM;
import org.apache.accumulo.core.Constants;
+ import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.FastFormat;
import org.apache.accumulo.server.ServerContext;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
/**
* Allocates unique names for an accumulo instance. The names are unique for the lifetime of the
@@@ -65,4 -75,27 +73,27 @@@ public class UniqueNameAllocator
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 totalAllocation = baseAllocation;
+ if (jitterAllocation > 0) {
- totalAllocation += random.nextInt(jitterAllocation);
++ totalAllocation += RANDOM.get().nextInt(jitterAllocation);
+ }
+
+ log.debug("Allocating {} filenames", totalAllocation);
+
+ return totalAllocation;
+ }
}