This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new 99cee92af5 Resolved TODOs in TabletGroupWatcher (#4373)
99cee92af5 is described below

commit 99cee92af5325870a01881ea442fd1a8f342ba97
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Mon Mar 18 07:36:23 2024 -0400

    Resolved TODOs in TabletGroupWatcher (#4373)
---
 .../apache/accumulo/manager/TabletGroupWatcher.java | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
index bd177c2deb..8779568916 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
@@ -22,6 +22,7 @@ import static 
com.google.common.util.concurrent.Uninterruptibles.sleepUninterrup
 import static java.lang.Math.min;
 import static java.util.Objects.requireNonNull;
 import static 
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.FILES;
+import static 
org.apache.accumulo.core.metadata.schema.TabletMetadata.ColumnType.LOGS;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -285,6 +286,10 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
       needsFullScan = false;
     }
 
+    public synchronized boolean isNeedsFullScan() {
+      return needsFullScan;
+    }
+
     @Override
     public void process(EventCoordinator.Event event) {
 
@@ -640,10 +645,12 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
     boolean lookForTabletsNeedingVolReplacement = true;
 
     while (manager.stillManager()) {
-      // slow things down a little, otherwise we spam the logs when there are 
many wake-up events
-      sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
-      // ELASTICITY_TODO above sleep in the case when not doing a full scan to 
make manager more
-      // responsive
+      if (!eventHandler.isNeedsFullScan()) {
+        // If an event handled by the EventHandler.RangeProcessor indicated
+        // that we need to do a full scan, then do it. Otherwise wait a bit
+        // before re-checking the tablets.
+        sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+      }
 
       final long waitTimeBetweenScans = manager.getConfiguration()
           .getTimeInMillis(Property.MANAGER_TABLET_GROUP_WATCHER_INTERVAL);
@@ -978,9 +985,9 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
   private void replaceVolumes(List<VolumeUtil.VolumeReplacements> 
volumeReplacementsList) {
     try (var tabletsMutator = 
manager.getContext().getAmple().conditionallyMutateTablets()) {
       for (VolumeUtil.VolumeReplacements vr : volumeReplacementsList) {
-        // ELASTICITY_TODO can require same on WALS once that is implemented, 
see #3948
-        var tabletMutator = 
tabletsMutator.mutateTablet(vr.tabletMeta.getExtent())
-            
.requireAbsentOperation().requireAbsentLocation().requireSame(vr.tabletMeta, 
FILES);
+        var tabletMutator =
+            
tabletsMutator.mutateTablet(vr.tabletMeta.getExtent()).requireAbsentOperation()
+                .requireAbsentLocation().requireSame(vr.tabletMeta, FILES, 
LOGS);
         vr.logsToRemove.forEach(tabletMutator::deleteWal);
         vr.logsToAdd.forEach(tabletMutator::putWal);
 

Reply via email to