accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [accumulo] lbschanno commented on a change in pull request #1276: Refactor how constraint violations are handled
Date Mon, 29 Jul 2019 23:10:26 GMT
lbschanno commented on a change in pull request #1276: Refactor how constraint violations are
handled
URL: https://github.com/apache/accumulo/pull/1276#discussion_r308474190
 
 

 ##########
 File path: server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
 ##########
 @@ -1115,53 +1114,29 @@ private synchronized CommitSession finishPreparingMutations(long
time) {
     return commitSession;
   }
 
-  public CommitSession prepareMutationsForCommit(TservConstraintEnv cenv, List<Mutation>
mutations)
-      throws TConstraintViolationException {
-
-    ConstraintChecker cc = constraintChecker.derive();
-
-    List<Mutation> violators = null;
-    Violations violations = new Violations();
+  public TabletMutationPrepAttempt prepareMutationsForCommit(final TservConstraintEnv cenv,
+      final List<Mutation> mutations) {
     cenv.setExtent(extent);
-    for (Mutation mutation : mutations) {
-      Violations more = cc.check(cenv, mutation);
-      if (more != null) {
-        violations.add(more);
-        if (violators == null) {
-          violators = new ArrayList<>();
-        }
-        violators.add(mutation);
-      }
-    }
-
-    long time = tabletTime.setUpdateTimes(mutations);
-
-    if (!violations.isEmpty()) {
-
-      HashSet<Mutation> violatorsSet = new HashSet<>(violators);
-      ArrayList<Mutation> nonViolators = new ArrayList<>();
-
-      for (Mutation mutation : mutations) {
-        if (!violatorsSet.contains(mutation)) {
-          nonViolators.add(mutation);
-        }
-      }
-
-      CommitSession commitSession = null;
-
-      if (nonViolators.size() > 0) {
-        // if everything is a violation, then it is expected that
-        // code calling this will not log or commit
-        commitSession = finishPreparingMutations(time);
-        if (commitSession == null) {
-          return null;
-        }
+    final ConstraintChecker constraints = constraintChecker.derive();
+    final TabletMutationPrepAttempt attempt = new TabletMutationPrepAttempt();
 
 Review comment:
   My only caution about this approach is that it makes it possible for the original mutation
list to be modified if there are no violations and the list of non-violators is retrieved
and modified. I don't think it's currently an issue, and if you're not concerned about it
becoming an issue in the future, I'll make the change.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message