This is an automated email from the ASF dual-hosted git repository.
domgarguilo pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 9da766e479 Properly account for iterator opt keys with multiple dots
(#6195)
9da766e479 is described below
commit 9da766e4797cc0ee626068017a88f5fc4cfc2c5b
Author: Dom G. <[email protected]>
AuthorDate: Tue Mar 10 12:24:41 2026 -0400
Properly account for iterator opt keys with multiple dots (#6195)
---
.../core/iteratorsImpl/IteratorProperty.java | 3 ++-
.../core/iteratorsImpl/IteratorConfigUtilTest.java | 21 +++++++++++++++++++++
.../java/org/apache/accumulo/test/NamespacesIT.java | 5 ++---
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/iteratorsImpl/IteratorProperty.java
b/core/src/main/java/org/apache/accumulo/core/iteratorsImpl/IteratorProperty.java
index 88ffdcd817..aedc7db2e5 100644
---
a/core/src/main/java/org/apache/accumulo/core/iteratorsImpl/IteratorProperty.java
+++
b/core/src/main/java/org/apache/accumulo/core/iteratorsImpl/IteratorProperty.java
@@ -138,7 +138,8 @@ public class IteratorProperty {
return null;
}
- String[] iterPropParts = property.split("\\.", -1);
+ // Iterator option keys may contain dots, so preserve everything after
".opt." as one token.
+ String[] iterPropParts = property.split("\\.", 6);
check(iterPropParts.length == 4 || iterPropParts.length == 6, property,
value);
IteratorUtil.IteratorScope scope =
IteratorUtil.IteratorScope.valueOf(iterPropParts[2]);
String iterName = iterPropParts[3];
diff --git
a/core/src/test/java/org/apache/accumulo/core/iteratorsImpl/IteratorConfigUtilTest.java
b/core/src/test/java/org/apache/accumulo/core/iteratorsImpl/IteratorConfigUtilTest.java
index 3042a9a0a5..0eb5ffcec7 100644
---
a/core/src/test/java/org/apache/accumulo/core/iteratorsImpl/IteratorConfigUtilTest.java
+++
b/core/src/test/java/org/apache/accumulo/core/iteratorsImpl/IteratorConfigUtilTest.java
@@ -284,6 +284,27 @@ public class IteratorConfigUtilTest {
}
+ /**
+ * Test that options with keys that contain dots are properly parsed
+ */
+ @Test
+ public void testOptionKeyContainingDots() {
+ Map<String,Map<String,String>> options = new HashMap<>();
+ ConfigurationCopy conf = new ConfigurationCopy();
+ conf.set(Property.TABLE_ITERATOR_SCAN_PREFIX + "error",
+ "50," + SummingCombiner.class.getName());
+
+ // add an option with a key that contains dots
+ conf.set(Property.TABLE_ITERATOR_SCAN_PREFIX +
"error.opt.error.throwing.iterator.times", "3");
+
+ List<IterInfo> iterators =
+ IteratorConfigUtil.parseIterConf(IteratorScope.scan, EMPTY_ITERS,
options, conf);
+
+ assertEquals(1, iterators.size());
+ assertEquals(new IterInfo(50, SummingCombiner.class.getName(), "error"),
iterators.get(0));
+ assertEquals(Map.of("error.throwing.iterator.times", "3"),
options.get("error"));
+ }
+
@Test
public void test5() throws IOException, ReflectiveOperationException {
ConfigurationCopy conf = new ConfigurationCopy();
diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
index f8ff450738..2b9ac5c346 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -411,9 +411,8 @@ public class NamespacesIT extends SharedMiniClusterBase {
EnumSet.allOf(IteratorScope.class));
c.namespaceOperations().attachIterator(namespace, setting);
sleepUninterruptibly(2, TimeUnit.SECONDS);
- var e = assertThrows(AccumuloException.class, () ->
c.namespaceOperations()
- .checkIteratorConflicts(namespace, setting,
EnumSet.allOf(IteratorScope.class)));
- assertEquals(IllegalArgumentException.class, e.getCause().getClass());
+ c.namespaceOperations().checkIteratorConflicts(namespace, setting,
+ EnumSet.allOf(IteratorScope.class));
IteratorSetting setting2 =
c.namespaceOperations().getIteratorSetting(namespace,
setting.getName(), IteratorScope.scan);
assertEquals(setting, setting2);