ctubbsii commented on code in PR #5924:
URL: https://github.com/apache/accumulo/pull/5924#discussion_r2380077584
##########
core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java:
##########
@@ -38,43 +36,13 @@
public class DefaultKeySizeConstraint extends
org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint
implements Constraint {
- protected static final short MAX__KEY_SIZE_EXCEEDED_VIOLATION = 1;
- protected static final long maxSize = 1048576; // 1MB default size
-
- @Override
- public String getViolationDescription(short violationCode) {
-
- switch (violationCode) {
- case MAX__KEY_SIZE_EXCEEDED_VIOLATION:
- return "Key was larger than 1MB";
- }
-
- return null;
- }
-
- static final List<Short> NO_VIOLATIONS = new ArrayList<>();
+ protected static final short MAX__KEY_SIZE_EXCEEDED_VIOLATION =
+
org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION;
+ protected static final long maxSize =
+
org.apache.accumulo.core.data.constraints.DefaultKeySizeConstraint.maxSize;
@Override
public List<Short> check(Constraint.Environment env, Mutation mutation) {
-
- // fast size check
- if (mutation.numBytes() < maxSize) {
- return NO_VIOLATIONS;
- }
-
- List<Short> violations = new ArrayList<>();
-
- for (ColumnUpdate cu : mutation.getUpdates()) {
- int size = mutation.getRow().length;
- size += cu.getColumnFamily().length;
- size += cu.getColumnQualifier().length;
- size += cu.getColumnVisibility().length;
-
- if (size > maxSize) {
- violations.add(MAX__KEY_SIZE_EXCEEDED_VIOLATION);
- }
- }
-
- return violations;
+ return super.check(env, mutation);
Review Comment:
This method can also be deleted from this subclass
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]