You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2025/11/24 16:37:10 UTC

[PR] Added summary of queued and running compactions to coordinator [accumulo]

dlmarion opened a new pull request, #5989:
URL: https://github.com/apache/accumulo/pull/5989

   This commit adds periodic logging of queued and running external compaction information to the coordinator. The logging is emitted by a new class, CoordinatorSummaryLogger, so that users can easily redirect this log to a new file in the logging configuration.
   
   At each interval this new class will log the number of compactions running for each table, and will log the number of compactors, queued compactions and running compactions for each compaction queue.
   
   The number of queued compactions is an estimate as each tablet server only reports up to 100 different compaction priorities to conserve memory space in the Coordinator (see ExternalCompactionExecutor.summarize).
   
   The metrics are a more accurate source of the number of queued external compactions, but that requires aggregating all of the METRICS_MAJC_QUEUED Meters from all of the TabletServers.
   
   Related to #5965


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2557348274


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());
+      perQueueRunningCount.computeIfAbsent(rc.getQueueName(), q -> new AtomicLong(0))
+          .incrementAndGet();
+      perTableRunningCount.computeIfAbsent(tableName, t -> new AtomicLong(0)).incrementAndGet();
+    });
+
+    perQueueRunningCount.forEach((q, count) -> {
+      LOG.info("Queue {}: compactors: {}, queued majc: {}, running majc: {}", q,
+          compactorCounts.asMap().getOrDefault(q, 0),
+          CompactionCoordinator.QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).size(), count.get());

Review Comment:
   This is a count of the unique priorities seen for compactions, not a count of tablets queued for compaction.  If many queued tablets have the same priority then they would count as one.  Something like the following will give a bit better count, but is still not completely correct. 
   
   ```
   // This map only contains the highest priority for each tserver.  So when tservers have other priorities
   // that need to compact or have more than one compaction for a priority level this count will be lower
   // than the actual number of queued.
   QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).values().stream().mapToLong(TreeSet::size).sum()
   ```
   
   We could also change he log message to indicate `at least`  somehow, maybe like
   
   ```
   "Queue {}: compactors: {}, queued majc is at least: {}, running majc: {}"
   ```



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2557348274


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());
+      perQueueRunningCount.computeIfAbsent(rc.getQueueName(), q -> new AtomicLong(0))
+          .incrementAndGet();
+      perTableRunningCount.computeIfAbsent(tableName, t -> new AtomicLong(0)).incrementAndGet();
+    });
+
+    perQueueRunningCount.forEach((q, count) -> {
+      LOG.info("Queue {}: compactors: {}, queued majc: {}, running majc: {}", q,
+          compactorCounts.asMap().getOrDefault(q, 0),
+          CompactionCoordinator.QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).size(), count.get());

Review Comment:
   This is a count of the unique priorities seen for compactions, not a count of tablets queued for compaction.  If many queued tablets have the same priority then they would count as one.  Something like the following will give a bit better count, but is still not completely correct. 
   
   ```
   // This map only contains the highest priority for each tserver.  So when tservers have other priorities
   // that need to compact or have more than one compaction for a priority level this count will be lower
   // than the actual number of queued.
   QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).values().stream().mapToLong(TreeSet::size).sum()
   ```
   
   We could also change he log message to indicate `at least`  somehow to indicate the count is a lower bound, maybe like
   
   ```
   "Queue {}: compactors: {}, queued majc is at least: {}, running majc: {}"
   ```



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2558049215


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());
+      perQueueRunningCount.computeIfAbsent(rc.getQueueName(), q -> new AtomicLong(0))
+          .incrementAndGet();
+      perTableRunningCount.computeIfAbsent(tableName, t -> new AtomicLong(0)).incrementAndGet();
+    });
+
+    perQueueRunningCount.forEach((q, count) -> {
+      LOG.info(
+          "Queue {}: compactors: {}, queued majc (minimum, possibly higher): {}, running majc: {}",
+          q, compactorCounts.asMap().getOrDefault(q, 0),
+          // This map only contains the highest priority for each tserver. So when tservers have
+          // other priorities that need to compact or have more than one compaction for a
+          // priority level this count will be lower than the actual number of queued.
+          CompactionCoordinator.QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).values().stream()

Review Comment:
   If the QUEUES were of type SortedMap instead of TreeMap, you could use Collections.emptySortedMap() instead of creating your own EMPTY one.



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());
+      perQueueRunningCount.computeIfAbsent(rc.getQueueName(), q -> new AtomicLong(0))
+          .incrementAndGet();
+      perTableRunningCount.computeIfAbsent(tableName, t -> new AtomicLong(0)).incrementAndGet();
+    });
+
+    perQueueRunningCount.forEach((q, count) -> {
+      LOG.info(
+          "Queue {}: compactors: {}, queued majc (minimum, possibly higher): {}, running majc: {}",
+          q, compactorCounts.asMap().getOrDefault(q, 0),
+          // This map only contains the highest priority for each tserver. So when tservers have
+          // other priorities that need to compact or have more than one compaction for a
+          // priority level this count will be lower than the actual number of queued.
+          CompactionCoordinator.QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).values().stream()
+              .mapToLong(TreeSet::size).sum(),
+          count.get());
+
+    });
+    perTableRunningCount.forEach((t, count) -> {
+      LOG.info("Running compactions for table {}: {}", t, count);
+    });

Review Comment:
   ```suggestion
       perTableRunningCount.forEach((t, count) -> LOG.info("Running compactions for table {}: {}", t, count));
   ```



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -187,8 +188,9 @@ protected CompactionCoordinator(ServerOpts opts, String[] args, AccumuloConfigur
     printStartupMsg();
     startCompactionCleaner();
     startRunningCleaner();
-    compactorCounts = Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.SECONDS)
+    compactorCounts = Caffeine.newBuilder().expireAfterWrite(120, TimeUnit.SECONDS)

Review Comment:
   Easy math, but this seems easier to read.
   
   ```suggestion
       compactorCounts = Caffeine.newBuilder().expireAfterWrite(2, TimeUnit.MINUTES)
   ```



##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java:
##########
@@ -685,6 +688,12 @@ private void captureFailure(ExternalCompactionId ecid, KeyExtent extent) {
     failingTables.compute(extent.tableId(), FailureCounts::incrementFailure);
   }
 
+  protected void startQueueRunningSummaryLogging() {
+    ScheduledFuture<?> future = getContext().getScheduledExecutor()
+        .scheduleWithFixedDelay(summaryLogger::logSummary, 0, 60, TimeUnit.SECONDS);

Review Comment:
   You can also statically import these TimeUnits, to make the line more readable.
   
   ```suggestion
           .scheduleWithFixedDelay(summaryLogger::logSummary, 0, 1, TimeUnit.MINUTES);
   ```



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2557518739


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());
+      perQueueRunningCount.computeIfAbsent(rc.getQueueName(), q -> new AtomicLong(0))
+          .incrementAndGet();
+      perTableRunningCount.computeIfAbsent(tableName, t -> new AtomicLong(0)).incrementAndGet();
+    });
+
+    perQueueRunningCount.forEach((q, count) -> {
+      LOG.info("Queue {}: compactors: {}, queued majc: {}, running majc: {}", q,
+          compactorCounts.asMap().getOrDefault(q, 0),
+          CompactionCoordinator.QUEUE_SUMMARIES.QUEUES.getOrDefault(q, EMPTY).size(), count.get());

Review Comment:
   Updated in 25eb194



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #5989:
URL: https://github.com/apache/accumulo/pull/5989


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2557866150


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());

Review Comment:
   Certainly a deleted table. I'm not sure if it might also happen when a new table is created in some scenario, I have not looked at the underlying code.
   



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added summary of queued and running compactions to coordinator [accumulo]

Posted by "ddanielr (via GitHub)" <gi...@apache.org>.
ddanielr commented on code in PR #5989:
URL: https://github.com/apache/accumulo/pull/5989#discussion_r2557800617


##########
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CoordinatorSummaryLogger.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.coordinator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.server.ServerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.benmanes.caffeine.cache.Cache;
+
+public class CoordinatorSummaryLogger {
+  private static final Logger LOG = LoggerFactory.getLogger(CoordinatorSummaryLogger.class);
+
+  private static final TreeMap<Short,TreeSet<TServerInstance>> EMPTY = new TreeMap<>();
+  private final ServerContext ctx;
+  private final Cache<String,Integer> compactorCounts;
+
+  public CoordinatorSummaryLogger(ServerContext ctx, Cache<String,Integer> compactorCounts) {
+    this.ctx = ctx;
+    this.compactorCounts = compactorCounts;
+  }
+
+  public void logSummary() {
+
+    final Map<TableId,String> tableMap = ctx.getTableIdToNameMap();
+    final Map<String,AtomicLong> perQueueRunningCount = new HashMap<>();
+    final Map<String,AtomicLong> perTableRunningCount = new HashMap<>();
+
+    CompactionCoordinator.RUNNING_CACHE.values().forEach(rc -> {
+      TableId tid = KeyExtent.fromThrift(rc.getJob().getExtent()).tableId();
+      String tableName = tableMap.getOrDefault(tid, "Unmapped table id: " + tid.canonical());

Review Comment:
   Is an `Unmapped table id` ever going to be something other than a deleted table? 
   
   Ran a test with this and was able to show that a long running compaction can persist past a table deletion action. 
   ```
   2025-11-24T21:18:35,555 104 [manager.EventCoordinator] INFO : Created table ExternalCompaction_1_IT_testGetActiveCompactions0
   2025-11-24T21:19:35,222 37 [coordinator.CoordinatorSummaryLogger] INFO : Queue DCQ8: compactors: 1, queued majc (minimum, possibly higher): 1, running majc: 1
   2025-11-24T21:19:35,222 37 [coordinator.CoordinatorSummaryLogger] INFO : Running compactions for table ExternalCompaction_1_IT_testGetActiveCompactions0: 1
   2025-11-24T21:19:35,329 180 [fate.Fate] INFO : Seeding FATE[1f4521d130f4a032] TABLE_DELETE Delete table ExternalCompaction_1_IT_testGetActiveCompactions0(8)
   2025-11-24T21:19:36,224 39 [coordinator.CoordinatorSummaryLogger] INFO : Queue DCQ8: compactors: 1, queued majc (minimum, possibly higher): 0, running majc: 1
   2025-11-24T21:19:36,224 39 [coordinator.CoordinatorSummaryLogger] INFO : Running compactions for table Unmapped table id: 8: 1
   2025-11-24T21:20:10,235 38 [coordinator.CoordinatorSummaryLogger] INFO : Queue DCQ8: compactors: 1, queued majc (minimum, possibly higher): 0, running majc: 1
   2025-11-24T21:20:10,235 38 [coordinator.CoordinatorSummaryLogger] INFO : Running compactions for table Unmapped table id: 8: 1
   ``` 



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org