keith-turner commented on code in PR #5652:
URL: https://github.com/apache/accumulo/pull/5652#discussion_r2155382782


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java:
##########
@@ -2220,6 +2220,10 @@ public MetadataUpdateCount getUpdateCount() {
     return getDatafileManager().getUpdateCount();
   }
 
+  public void removeOrphanedScanRefs() {
+    getDatafileManager().removeOrphanedScanRefs();
+  }

Review Comment:
   We want to avoid writing to the metadata table after a tablet is closed 
because the rest of the system assumes that once a tablet is unloaded it will 
not write.   The following change does two things it checks if the tablet is 
closed and if its not closed it increments writesInProgress to make 
Tablet.close() wait until this completes  (the bulk import code also may modify 
the metadata table and does the same thing).
   
   ```suggestion
     public void removeOrphanedScanRefs() {
     synchronized (this){
         if(isClosed() || isClosing()) {
           return;
         }
         incrementWritesInProgress();
       }
       try {
         getDatafileManager().removeOrphanedScanRefs();
       }finally {
         decrementWritesInProgress();
       }
     }
   ```
   
   Overall this code and the code in DataFileManager is unlocking and lock the 
tablet object a lot, but not sure if that could be improved w/o large changes 
to the code (which could introduce bugs).



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