keith-turner commented on a change in pull request #2235:
URL: https://github.com/apache/accumulo/pull/2235#discussion_r722312323



##########
File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
##########
@@ -347,6 +347,15 @@ boolean finishChop(Set<StoredTabletFile> allFiles) {
       return completed;
     }
 
+    boolean finishMarkingChop() {
+      if (chopStatus == ChopSelectionStatus.MARKING) {
+        chopStatus = ChopSelectionStatus.NOT_ACTIVE;
+        return true;
+      } else {
+        return false;
+      }
+    }

Review comment:
       ```suggestion
       void finishMarkingChop() {
           Preconditions.checkState(chopStatus == ChopSelectionStatus.MARKING);
           chopStatus = ChopSelectionStatus.NOT_ACTIVE;
       }
   ```

##########
File path: 
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
##########
@@ -739,11 +749,25 @@ private void checkifChopComplete(Set<StoredTabletFile> 
allFiles) {
     boolean completed;
 
     synchronized (this) {
+      if (closed) {
+        // if closed, do not attempt to transition to the MARKING state
+        return;
+      }
+      // when this returns true it means we transitioned to the MARKING state
       completed = fileMgr.finishChop(allFiles);
     }
 
     if (completed) {
-      markChopped();
+      try {
+        markChopped();
+      } finally {
+        synchronized (this) {
+          // transition the state from MARKING to NOT_ACTIVE
+          fileMgr.finishMarkingChop();

Review comment:
       Could remove the boolean and change the method to have a precondition 
that expects the current chop state to be MARKING.  I made a suggested change 
for the method.  The way the code is currently written, it would be unexpected 
for the chop state to be anything else when this method is called.




-- 
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]


Reply via email to