This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 53ef32c5f9 Prevent copy of iter and constraint properties to system
namespace (#5908)
53ef32c5f9 is described below
commit 53ef32c5f9d73fe8f8b0d6886f1aff713cc864d5
Author: Dave Marion <[email protected]>
AuthorDate: Mon Sep 22 16:55:35 2025 -0400
Prevent copy of iter and constraint properties to system namespace (#5908)
Don't copy iterator or constraint table properties from the
system configuration to the system namespace configuration
during the upgrade. Removed code from NamespaceConfiguration
that filtered out iterator and constraint properties from
the system configuration as table properties are no longer
allowed in the system configuration.
Closes #5901
Co-authored-by: Christopher Tubbs <[email protected]>
---
.../server/conf/NamespaceConfiguration.java | 50 ----------------------
.../accumulo/manager/upgrade/Upgrader11to12.java | 13 ++++++
.../manager/upgrade/Upgrader11to12Test.java | 18 +++++++-
3 files changed, 30 insertions(+), 51 deletions(-)
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
index 7f0992726f..99a4bc9f8d 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
@@ -18,12 +18,7 @@
*/
package org.apache.accumulo.server.conf;
-import java.util.Map;
-import java.util.function.Predicate;
-
-import org.apache.accumulo.core.clientImpl.Namespace;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.NamespaceId;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.conf.store.NamespacePropKey;
@@ -40,47 +35,6 @@ public class NamespaceConfiguration extends
ZooBasedConfiguration {
super(log, context, NamespacePropKey.of(namespaceId), parent);
}
- @Override
- public String get(Property property) {
-
- String key = property.getKey();
-
- var namespaceId = ((NamespacePropKey) getPropStoreKey()).getId();
- if (namespaceId != null && namespaceId.equals(Namespace.ACCUMULO.id())
- && isIteratorOrConstraint(key)) {
- // ignore iterators from parent if system namespace
- return null;
- }
-
- Map<String,String> theseProps = getSnapshot();
- String value = theseProps.get(key);
-
- if (value != null) {
- return value;
- }
-
- return getParent().get(property);
- }
-
- /**
- * exclude system iterators/constraints from the system namespace so that
they don't affect the
- * metadata or root tables.
- */
- @Override
- public void getProperties(Map<String,String> props, Predicate<String>
filter) {
- Predicate<String> parentFilter = filter;
- // exclude system iterators/constraints from the system namespace
- // so they don't affect the metadata or root tables.
- if (getNamespaceId().equals(Namespace.ACCUMULO.id())) {
- parentFilter = key -> !isIteratorOrConstraint(key) && filter.test(key);
- }
-
- getParent().getProperties(props, parentFilter);
-
- getSnapshot().entrySet().stream().filter(e -> filter.test(e.getKey()) &&
e.getValue() != null)
- .forEach(e -> props.put(e.getKey(), e.getValue()));
- }
-
protected NamespaceId getNamespaceId() {
var id = ((NamespacePropKey) getPropStoreKey()).getId();
if (id == null) {
@@ -90,8 +44,4 @@ public class NamespaceConfiguration extends
ZooBasedConfiguration {
return id;
}
- static boolean isIteratorOrConstraint(String key) {
- return key.startsWith(Property.TABLE_ITERATOR_PREFIX.getKey())
- || key.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey());
- }
}
diff --git
a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java
b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java
index 439493595d..7d8dc61ef6 100644
---
a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java
+++
b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/Upgrader11to12.java
@@ -936,6 +936,19 @@ public class Upgrader11to12 implements Upgrader {
final Map<String,String> nsPropAdditions = new HashMap<>();
for (Entry<String,String> e : sysTableProps.entrySet()) {
+
+ // Don't move iterators or constraints from the system configuration
+ // to the system namespace. This will affect the root and metadata
+ // tables.
+ if (ns.equals(Namespace.ACCUMULO.name())
+ &&
(e.getKey().startsWith(Property.TABLE_ITERATOR_PREFIX.getKey())
+ ||
e.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey()))) {
+ LOG.debug(
+ "Not moving property {} to 'accumulo' namespace, iterator and
constraint properties are ignored on purpose.",
+ e.getKey());
+ continue;
+ }
+
final String nsVal = nsProps.get(e.getKey());
// If it's not set, then add the system table property
// to the namespace. If it is set, then it doesnt matter
diff --git
a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java
b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java
index c919d664ce..425aa1da5d 100644
---
a/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java
+++
b/server/manager/src/test/java/org/apache/accumulo/manager/upgrade/Upgrader11to12Test.java
@@ -63,6 +63,7 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.NamespaceId;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint;
import org.apache.accumulo.core.fate.zookeeper.ZooReader;
import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
@@ -600,10 +601,19 @@ public class Upgrader11to12Test {
sysProps.put(Property.TABLE_BLOOM_ENABLED.getKey(), "true");
sysProps.put(Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "true");
sysProps.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "sysContext");
+ sysProps.put(Property.TABLE_ITERATOR_PREFIX.getKey() + "test",
"iteratorProperty");
+ sysProps.put(Property.TABLE_CONSTRAINT_PREFIX.getKey() + "1",
+ DefaultKeySizeConstraint.class.getName());
// Accumulo ns props
final Map<String,String> accProps = new HashMap<>();
+ // iterator property will not get moved
+ final Map<String,String> accChanges = new HashMap<>();
+ accChanges.put(Property.TABLE_BLOOM_ENABLED.getKey(), "true");
+ accChanges.put(Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "true");
+ accChanges.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "sysContext");
+
// Default ns has one same and one different prop
final Map<String,String> defProps = new HashMap<>();
defProps.put(Property.TABLE_BLOOM_ENABLED.getKey(), "true");
@@ -611,6 +621,9 @@ public class Upgrader11to12Test {
final Map<String,String> defChanges = new HashMap<>();
defChanges.put(Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "true");
+ defChanges.put(Property.TABLE_ITERATOR_PREFIX.getKey() + "test",
"iteratorProperty");
+ defChanges.put(Property.TABLE_CONSTRAINT_PREFIX.getKey() + "1",
+ DefaultKeySizeConstraint.class.getName());
// Test ns has one different prop
final Map<String,String> testProps = new HashMap<>();
@@ -619,6 +632,9 @@ public class Upgrader11to12Test {
final Map<String,String> testChanges = new HashMap<>();
testChanges.put(Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "true");
testChanges.put(Property.TABLE_CLASSLOADER_CONTEXT.getKey(), "sysContext");
+ testChanges.put(Property.TABLE_ITERATOR_PREFIX.getKey() + "test",
"iteratorProperty");
+ testChanges.put(Property.TABLE_CONSTRAINT_PREFIX.getKey() + "1",
+ DefaultKeySizeConstraint.class.getName());
expect(context.getPropStore()).andReturn(propStore).anyTimes();
expect(propStore.get(SystemPropKey.of())).andReturn(sysVerProps).once();
@@ -639,7 +655,7 @@ public class Upgrader11to12Test {
expect(propStore.get(apk)).andReturn(systemNsProps).once();
expect(systemNsProps.asMap()).andReturn(accProps).once();
- propStore.putAll(apk, sysProps);
+ propStore.putAll(apk, accChanges);
expectLastCall().once();
expect(propStore.get(dpk)).andReturn(defaultNsProps).once();