DomGarguilo commented on code in PR #5674:
URL: https://github.com/apache/accumulo/pull/5674#discussion_r2167325242


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java:
##########
@@ -2220,8 +2220,22 @@ public MetadataUpdateCount getUpdateCount() {
     return getDatafileManager().getUpdateCount();
   }
 
-  public void removeOrphanedScanRefs() {
-    getDatafileManager().removeOrphanedScanRefs();
+  public void removeBatchedScanRefs() {
+    synchronized (this) {
+      if (isClosed() || isClosing()) {
+        return;
+      }
+      // TODO if a check is done here to see if there are orphaned scans and 
none are found could
+      // return and not do the increment.
+      // this would cut down on the number of times the lock is acquired, but 
not sure how clean
+      // this would be.
+      incrementWritesInProgress();

Review Comment:
   Added in 3d00bd9



##########
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java:
##########
@@ -119,43 +119,28 @@ Pair<Long,Map<TabletFile,DataFileValue>> 
reserveFilesForScan() {
 
   void returnFilesForScan(Long reservationId) {
 
-    final Set<StoredTabletFile> filesToDelete = new HashSet<>();
-
-    try {
-      synchronized (tablet) {
-        Set<StoredTabletFile> absFilePaths = 
scanFileReservations.remove(reservationId);
+    synchronized (tablet) {
+      Set<StoredTabletFile> absFilePaths = 
scanFileReservations.remove(reservationId);
 
-        if (absFilePaths == null) {
-          throw new IllegalArgumentException("Unknown scan reservation id " + 
reservationId);
-        }
+      if (absFilePaths == null) {
+        throw new IllegalArgumentException("Unknown scan reservation id " + 
reservationId);
+      }
 
-        boolean notify = false;
-        try {
-          for (StoredTabletFile path : absFilePaths) {
-            long refCount = fileScanReferenceCounts.decrement(path, 1);
-            if (refCount == 0) {
-              if (filesToDeleteAfterScan.remove(path)) {
-                filesToDelete.add(path);
-              }
-              notify = true;
-            } else if (refCount < 0) {
-              throw new IllegalStateException("Scan ref count for " + path + " 
is " + refCount);
-            }
-          }
-        } finally {
-          if (notify) {
-            tablet.notifyAll();
+      boolean notify = false;
+      try {
+        for (StoredTabletFile path : absFilePaths) {
+          long refCount = fileScanReferenceCounts.decrement(path, 1);
+          if (refCount == 0) {
+            filesToDeleteAfterScan.add(path);

Review Comment:
   Fixed in 3d00bd9



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