This is an automated email from the ASF dual-hosted git repository.
kturner 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 ce23b9575c removes mutable list constant from DefaultKeySizeConstraint
(#6163)
ce23b9575c is described below
commit ce23b9575c5142278fdf31713ffd06c5eea13d57
Author: Keith Turner <[email protected]>
AuthorDate: Tue Mar 3 16:16:49 2026 -0800
removes mutable list constant from DefaultKeySizeConstraint (#6163)
---
.../accumulo/core/data/constraints/DefaultKeySizeConstraint.java | 4 +---
.../accumulo/core/constraints/DefaultKeySizeConstraintTest.java | 3 ++-
.../accumulo/core/constraints/DeprecatedConstraintExtendTest.java | 4 +++-
.../accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java | 3 ++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraint.java
b/core/src/main/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraint.java
index 8f912dd48d..8e79dab523 100644
---
a/core/src/main/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraint.java
+++
b/core/src/main/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraint.java
@@ -52,14 +52,12 @@ public class DefaultKeySizeConstraint implements Constraint
{
return null;
}
- static final List<Short> NO_VIOLATIONS = new ArrayList<>();
-
@Override
public List<Short> check(Environment env, Mutation mutation) {
// fast size check
if (mutation.numBytes() < maxSize) {
- return NO_VIOLATIONS;
+ return null;
}
List<Short> violations = new ArrayList<>();
diff --git
a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
index 1e094c465f..c729d605ec 100644
---
a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
+++
b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
@@ -19,6 +19,7 @@
package org.apache.accumulo.core.constraints;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.Collections;
@@ -41,7 +42,7 @@ public class DefaultKeySizeConstraintTest {
// pass constraints
Mutation m = new Mutation("rowId");
m.put("colf", "colq", new Value());
- assertEquals(Collections.emptyList(), constraint.check(null, m));
+ assertNull(constraint.check(null, m));
// test with row id > 1mb
m = new Mutation(oversized);
diff --git
a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
b/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
index e75bd160aa..66b04a32f3 100644
---
a/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
+++
b/core/src/test/java/org/apache/accumulo/core/constraints/DeprecatedConstraintExtendTest.java
@@ -20,6 +20,7 @@ package org.apache.accumulo.core.constraints;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -92,10 +93,11 @@ public class DeprecatedConstraintExtendTest {
@Override
public List<Short> check(Constraint.Environment env, Mutation mutation) {
List<Short> violations = super.check(env, mutation);
- if (!violations.isEmpty()) {
+ if (violations != null && !violations.isEmpty()) {
return violations;
}
+ violations = new ArrayList<>();
for (ColumnUpdate cu : mutation.getUpdates()) {
int size = mutation.getRow().length;
size += cu.getColumnFamily().length;
diff --git
a/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
b/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
index 80624370c0..471d2add60 100644
---
a/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
+++
b/core/src/test/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraintTest.java
@@ -19,6 +19,7 @@
package org.apache.accumulo.core.data.constraints;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.util.Collections;
@@ -39,7 +40,7 @@ public class DefaultKeySizeConstraintTest {
// pass constraints
Mutation m = new Mutation("rowId");
m.put("colf", "colq", new Value());
- assertEquals(Collections.emptyList(), constraint.check(null, m));
+ assertNull(constraint.check(null, m));
// test with row id > 1mb
m = new Mutation(oversized);