Repository: accumulo
Updated Branches:
  refs/heads/master fb7534b4d -> f8f39ba90


ACCUMULO-2749 make the DefaultKeySizeConstraint a bit more efficient


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/62af17d5
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/62af17d5
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/62af17d5

Branch: refs/heads/master
Commit: 62af17d52e1a45b2dded8f7996318140c569eed2
Parents: f5bcee7
Author: Eric C. Newton <eric.new...@gmail.com>
Authored: Tue Apr 29 12:21:45 2014 -0400
Committer: Eric C. Newton <eric.new...@gmail.com>
Committed: Tue Apr 29 12:21:45 2014 -0400

----------------------------------------------------------------------
 .../accumulo/core/constraints/DefaultKeySizeConstraint.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/62af17d5/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
 
b/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
index b395067..88b7eea 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraint.java
@@ -41,9 +41,15 @@ public class DefaultKeySizeConstraint implements Constraint {
     return null;
   }
   
+  final static List<Short> NO_VIOLATIONS = new ArrayList<Short>();
+  
   @Override
   public List<Short> check(Environment env, Mutation mutation) {
 
+    // fast size check
+    if (mutation.numBytes() < maxSize)
+      return NO_VIOLATIONS;
+    
     List<Short> violations = new ArrayList<Short>();
 
     for (ColumnUpdate cu : mutation.getUpdates()) {

Reply via email to