kevinrr888 commented on code in PR #4524:
URL: https://github.com/apache/accumulo/pull/4524#discussion_r1688547821


##########
core/src/main/java/org/apache/accumulo/core/fate/Fate.java:
##########
@@ -360,7 +380,27 @@ public Fate(T environment, FateStore<T> store, 
Function<Repo<T>,String> toLogStr
         }
       }
     }, 3, SECONDS));
-    this.executor = pool;
+    this.transactionExecutor = pool;
+
+    // Create a dead reservation cleaner for this store that will periodically 
(every 30 seconds)
+    // clean up reservations held by dead processes, if they exist. Only 
created if a dead
+    // reservation cleaner is not already running for the given store type.
+    // TODO 4131 periodic cleanup runs every 30 seconds
+    // Should this be longer? Shorter? A configurable Property? A function of 
something?
+    ScheduledExecutorService deadResCleanerExecutor = 
ThreadPools.getServerThreadPools()
+        .createScheduledExecutorService(1, store.type() + 
"-dead-reservation-cleaner-pool");
+    if ((store.type() == FateInstanceType.USER && 
!userDeadReservationCleanerRunning)
+        || (store.type() == FateInstanceType.META && 
!metaDeadReservationCleanerRunning)) {
+      ScheduledFuture<?> deadReservationCleaner = deadResCleanerExecutor
+          .scheduleWithFixedDelay(new DeadReservationCleaner(), 3, 30, 
SECONDS);
+      ThreadPools.watchCriticalScheduledTask(deadReservationCleaner);
+      if (store.type() == FateInstanceType.USER) {
+        userDeadReservationCleanerRunning = true;
+      } else if (store.type() == FateInstanceType.META) {
+        metaDeadReservationCleanerRunning = true;
+      }
+    }
+    this.deadResCleanerExecutor = deadResCleanerExecutor;

Review Comment:
   yes, it won't ever be used. I did it this way for a simpler shutdown method 
(no need to check for null), but you are right it would be better if this 
wasn't created in the first place. Changed.



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