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

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

commit 4911a3761942ab2fde28485b4f81e73604950253
Merge: 863068cf93 c1c6ddc3eb
Author: Daniel Roberts ddanielr <[email protected]>
AuthorDate: Fri Oct 9 19:41:44 2026 +0000

    Merge branch '2.1'

 .../miniclusterImpl/MiniAccumuloClusterImpl.java        | 16 ++++------------
 .../org/apache/accumulo/manager/state/SetGoalState.java | 17 ++++++++++++++---
 .../tserver/memory/LargestFirstMemoryManager.java       | 17 +++++------------
 3 files changed, 23 insertions(+), 27 deletions(-)

diff --cc 
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
index 20deaac848,fc9d86ec63..9a4c4fd9bc
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@@ -621,20 -613,11 +621,12 @@@ public class MiniAccumuloClusterImpl im
          config.getZooKeepers());
  
      control.start(ServerType.TABLET_SERVER);
 +    control.start(ServerType.SCAN_SERVER);
  
-     int ret = 0;
-     for (int i = 0; i < 5; i++) {
-       ret = exec(Main.class, SetGoalState.class.getName(), 
ManagerGoalState.NORMAL.toString())
-           .getProcess().waitFor();
-       if (ret == 0) {
-         break;
-       }
-       sleepUninterruptibly(1, TimeUnit.SECONDS);
-     }
-     if (ret != 0) {
-       throw new IllegalStateException("Could not set manager goal state, 
process returned " + ret
-           + ". Check the logs in " + config.getLogDir() + " for errors.");
+     try {
+       SetGoalState.setGoalState(getServerContext(), ManagerGoalState.NORMAL);
+     } catch (KeeperException e) {
+       throw new IllegalStateException("Could not set manager goal state", e);
      }
  
      control.start(ServerType.MANAGER);
diff --cc 
server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
index fc20e2e538,a044f3f950..ffa54de6f4
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/state/SetGoalState.java
@@@ -24,8 -24,12 +24,9 @@@ import org.apache.accumulo.core.Constan
  import org.apache.accumulo.core.conf.SiteConfiguration;
  import org.apache.accumulo.core.fate.zookeeper.ZooUtil.NodeExistsPolicy;
  import org.apache.accumulo.core.manager.thrift.ManagerGoalState;
 -import org.apache.accumulo.core.singletons.SingletonManager;
 -import org.apache.accumulo.core.singletons.SingletonManager.Mode;
 -import org.apache.accumulo.manager.upgrade.RenameMasterDirInZK;
  import org.apache.accumulo.server.ServerContext;
  import org.apache.accumulo.server.security.SecurityUtil;
+ import org.apache.zookeeper.KeeperException;
  
  import com.google.common.base.Preconditions;
  
@@@ -42,15 -47,29 +44,24 @@@ public class SetGoalState 
        System.err.println(
            "Usage: accumulo " + SetGoalState.class.getName() + " 
[NORMAL|SAFE_MODE|CLEAN_STOP]");
        System.exit(-1);
+       return;
      }
  
 -    try {
 -      var siteConfig = SiteConfiguration.auto();
 -      SecurityUtil.serverLogin(siteConfig);
 -      var context = new ServerContext(siteConfig);
 -      RenameMasterDirInZK.renameMasterDirInZK(context);
 +    var siteConfig = SiteConfiguration.auto();
 +    SecurityUtil.serverLogin(siteConfig);
 +    try (var context = new ServerContext(siteConfig)) {
        context.waitForZookeeperAndHdfs();
-       
context.getZooSession().asReaderWriter().putPersistentData(Constants.ZMANAGER_GOAL_STATE,
-           args[0].getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
+       setGoalState(context, targetGoalState);
 -    } finally {
 -      SingletonManager.setMode(Mode.CLOSED);
      }
    }
  
+   /**
+    * Writes the manager goal state to ZooKeeper, overwriting the current 
value.
+    */
+   public static void setGoalState(ServerContext context, ManagerGoalState 
targetGoalState)
+       throws KeeperException, InterruptedException {
 -    context.getZooReaderWriter().putPersistentData(
 -        context.getZooKeeperRoot() + Constants.ZMANAGER_GOAL_STATE,
++    
context.getZooSession().asReaderWriter().putPersistentData(Constants.ZMANAGER_GOAL_STATE,
+         targetGoalState.name().getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
+   }
+ 
  }
diff --cc 
server/tserver/src/main/java/org/apache/accumulo/tserver/memory/LargestFirstMemoryManager.java
index be5f2a4ed4,44ce6942e7..9882ec752f
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/memory/LargestFirstMemoryManager.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/memory/LargestFirstMemoryManager.java
@@@ -22,9 -22,8 +22,8 @@@ import java.util.ArrayList
  import java.util.List;
  import java.util.Map.Entry;
  import java.util.TreeMap;
 +import java.util.concurrent.TimeUnit;
  
- import org.apache.accumulo.core.client.TableNotFoundException;
  import org.apache.accumulo.core.conf.Property;
  import org.apache.accumulo.core.data.TableId;
  import org.apache.accumulo.core.dataImpl.KeyExtent;
@@@ -171,30 -182,25 +170,24 @@@ public class LargestFirstMemoryManager 
        }
  
        final long memTabletSize = ts.getMemTableSize();
 +
        final long minorCompactingSize = ts.getMinorCompactingMemTableSize();
 -      final long idleTime = now - Math.max(ts.getLastCommitTime(), ZERO_TIME);
 -      final long timeMemoryLoad = timeMemoryLoad(memTabletSize, idleTime);
        ingestMemory += memTabletSize;
        if (minorCompactingSize == 0 && memTabletSize > 0) {
 -        TabletInfo tabletInfo = new TabletInfo(tablet, memTabletSize, 
idleTime, timeMemoryLoad);
 +        TabletInfo tabletInfo = new TabletInfo(tablet, memTabletSize);
          try {
            // If the table was deleted, getMinCIdleThreshold will throw an 
exception
 -          if (idleTime > getMinCIdleThreshold(tablet)) {
 -            largestIdleMemTablets.put(timeMemoryLoad, tabletInfo);
 +          if (ts.getElapsedSinceFirstWrite(TimeUnit.MILLISECONDS) > 
getMaxAge(tablet)) {
 +            oldMemTablets.put(memTabletSize, tabletInfo);
            }
-         } catch (IllegalArgumentException e) {
-           Throwable cause = e.getCause();
-           if (cause != null && cause instanceof TableNotFoundException) {
-             log.trace("Ignoring extent for deleted table: {}", tablet);
- 
-             // The table might have been deleted during the iteration of the 
tablets
-             // We just want to eat this exception, do nothing with this 
tablet, and continue
-             continue;
-           }
- 
-           throw e;
+         } catch (NullPointerException e) {
+           log.trace("Table config is null. Ignoring extent for deleted table: 
{}", tablet);
+           // The table might have been deleted during the iteration of the 
tablets
+           // We just want to eat this exception, do nothing with this tablet, 
and continue
+           continue;
          }
          // Only place the tablet into largestMemTablets map when the table 
still exists
 -        largestMemTablets.put(timeMemoryLoad, tabletInfo);
 +        largestMemTablets.put(memTabletSize, tabletInfo);
        }
  
        compactionMemory += minorCompactingSize;

Reply via email to