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

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


The following commit(s) were added to refs/heads/main by this push:
     new 32f397af21 Removed RunningCompactionsSummary object from Monitor 
(#6235)
32f397af21 is described below

commit 32f397af21d404a3a30ad79f46c2b07462def498
Author: Dave Marion <[email protected]>
AuthorDate: Wed Mar 25 15:14:52 2026 -0400

    Removed RunningCompactionsSummary object from Monitor (#6235)
    
    This change removes the RunningCompactionsSummary in favor
    of just returning a list of RunningCompactionInfo. The
    long running compaction map was also modified to use
    the RunningCompactionInfo instead of the TExternalCompaction
    object to reduce the computation needed at request time
    to return the results.
    
    Closes #6234
---
 .../util/compaction/RunningCompactionInfo.java     | 10 ++-
 .../apache/accumulo/monitor/next/Endpoints.java    | 17 ++---
 .../accumulo/monitor/next/SystemInformation.java   | 22 +++---
 .../responses/RunningCompactionsSummary.java       | 34 ---------
 .../org/apache/accumulo/monitor/resources/js/ec.js | 84 ++++------------------
 5 files changed, 43 insertions(+), 124 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
index 2d9575c96e..25637c3960 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompactionInfo.java
@@ -24,6 +24,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.accumulo.core.compaction.thrift.TCompactionStatusUpdate;
@@ -43,6 +44,7 @@ public class RunningCompactionInfo {
   private static final Logger log = 
LoggerFactory.getLogger(RunningCompactionInfo.class);
 
   // DO NOT CHANGE Variable names - they map to JSON keys in the Monitor
+  public final long startTime;
   public final String server;
   public final String queueName;
   public final String ecid;
@@ -62,9 +64,11 @@ public class RunningCompactionInfo {
    */
   public RunningCompactionInfo(TExternalCompaction ec) {
     requireNonNull(ec, "Thrift external compaction is null.");
-    var updates = requireNonNull(ec.getUpdates(), "Missing Thrift external 
compaction updates");
+    Map<Long,TCompactionStatusUpdate> updates =
+        ec.getUpdates() == null ? Map.of() : ec.getUpdates();
     var job = requireNonNull(ec.getJob(), "Thrift external compaction job is 
null");
 
+    startTime = ec.getStartTime();
     server = ec.getCompactor();
     queueName = ec.getGroupName();
     ecid = job.getExternalCompactionId();
@@ -125,6 +129,10 @@ public class RunningCompactionInfo {
 
   }
 
+  public long getStartTime() {
+    return this.startTime;
+  }
+
   /**
    * @return a list of {@link CompactionInputFileDetails} sorted largest to 
smallest
    */
diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
index f52c69e0ce..d2fdaa26ef 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/Endpoints.java
@@ -55,7 +55,6 @@ import 
org.apache.accumulo.monitor.next.SystemInformation.TableSummary;
 import 
org.apache.accumulo.monitor.next.SystemInformation.TimeOrderedRunningCompactionSet;
 import org.apache.accumulo.monitor.next.ec.CompactorsSummary;
 import org.apache.accumulo.monitor.next.ec.CoordinatorSummary;
-import 
org.apache.accumulo.monitor.next.endpoint.responses.RunningCompactionsSummary;
 import org.apache.accumulo.monitor.next.sservers.ScanServerView;
 
 import io.micrometer.core.instrument.Meter.Id;
@@ -330,29 +329,27 @@ public class Endpoints {
   @Path("compactions/running")
   @Produces(MediaType.APPLICATION_JSON)
   @Description("Returns all long running major compactions")
-  public RunningCompactionsSummary getCompactions() {
+  public List<RunningCompactionInfo> getCompactions() {
     Map<String,TimeOrderedRunningCompactionSet> longRunning =
         
monitor.getInformationFetcher().getSummaryForEndpoint().getTopRunningCompactions();
-    return new RunningCompactionsSummary(
-        
longRunning.values().stream().flatMap(TimeOrderedRunningCompactionSet::stream).distinct()
-            .sorted(TimeOrderedRunningCompactionSet.OLDEST_FIRST_COMPARATOR)
-            .map(RunningCompactionInfo::new).collect(Collectors.toList()));
+    return 
longRunning.values().stream().flatMap(TimeOrderedRunningCompactionSet::stream).distinct()
+        .sorted(TimeOrderedRunningCompactionSet.OLDEST_FIRST_COMPARATOR)
+        .collect(Collectors.toList());
   }
 
   @GET
   @Path("compactions/running/{" + GROUP_PARAM_KEY + "}")
   @Produces(MediaType.APPLICATION_JSON)
   @Description("Returns all long running major compactions for the resource 
group")
-  public RunningCompactionsSummary
+  public List<RunningCompactionInfo>
       getCompactions(@PathParam(GROUP_PARAM_KEY) String resourceGroup) {
     validateResourceGroup(resourceGroup);
     TimeOrderedRunningCompactionSet longRunning = 
monitor.getInformationFetcher()
         .getSummaryForEndpoint().getTopRunningCompactions().get(resourceGroup);
     if (longRunning == null) {
-      return new RunningCompactionsSummary(List.of());
+      return List.of();
     }
-    return new RunningCompactionsSummary(
-        
longRunning.stream().map(RunningCompactionInfo::new).collect(Collectors.toList()));
+    return longRunning.stream().collect(Collectors.toList());
   }
 
   @GET
diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
index e7291a877e..2a5148010f 100644
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
+++ 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/SystemInformation.java
@@ -57,6 +57,7 @@ import org.apache.accumulo.core.metrics.flatbuffers.FMetric;
 import org.apache.accumulo.core.metrics.flatbuffers.FTag;
 import org.apache.accumulo.core.process.thrift.MetricResponse;
 import org.apache.accumulo.core.spi.balancer.TableLoadBalancer;
+import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
 import org.apache.accumulo.monitor.next.sservers.ScanServerView;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.conf.TableConfiguration;
@@ -308,10 +309,10 @@ public class SystemInformation {
   // oldest RunningCompaction.
   public static class TimeOrderedRunningCompactionSet {
 
-    public static final Comparator<TExternalCompaction> 
OLDEST_FIRST_COMPARATOR =
-        Comparator.comparingLong(TExternalCompaction::getStartTime)
-            .thenComparing(rc -> rc.getJob().getExternalCompactionId());
-    private final ConcurrentSkipListSet<TExternalCompaction> compactions =
+    public static final Comparator<RunningCompactionInfo> 
OLDEST_FIRST_COMPARATOR =
+        
Comparator.comparingLong(RunningCompactionInfo::getStartTime).thenComparing(rc 
-> rc.ecid);
+
+    private final ConcurrentSkipListSet<RunningCompactionInfo> compactions =
         new ConcurrentSkipListSet<>(OLDEST_FIRST_COMPARATOR);
 
     // Tracking size here as ConcurrentSkipListSet.size() is not constant time
@@ -327,7 +328,7 @@ public class SystemInformation {
       return size.get();
     }
 
-    public boolean add(TExternalCompaction e) {
+    public boolean add(RunningCompactionInfo e) {
       boolean added = compactions.add(e);
       if (added) {
         if (size.incrementAndGet() > this.limit) {
@@ -345,11 +346,11 @@ public class SystemInformation {
       return removed;
     }
 
-    public Iterator<TExternalCompaction> iterator() {
+    public Iterator<RunningCompactionInfo> iterator() {
       return compactions.iterator();
     }
 
-    public Stream<TExternalCompaction> stream() {
+    public Stream<RunningCompactionInfo> stream() {
       return compactions.stream();
     }
 
@@ -544,14 +545,15 @@ public class SystemInformation {
   }
 
   public void processExternalCompaction(TExternalCompaction tec) {
-
     var tableId = KeyExtent.fromThrift(tec.getJob().extent).tableId();
     runningCompactionsPerTable.computeIfAbsent(tableId, t -> new 
LongAdder()).increment();
     runningCompactionsPerGroup.computeIfAbsent(tec.getGroupName(), t -> new 
LongAdder())
         .increment();
 
-    this.longRunningCompactionsByRg.computeIfAbsent(tec.getGroupName(),
-        k -> new 
TimeOrderedRunningCompactionSet(rgLongRunningCompactionSize)).add(tec);
+    this.longRunningCompactionsByRg
+        .computeIfAbsent(tec.getGroupName(),
+            k -> new 
TimeOrderedRunningCompactionSet(rgLongRunningCompactionSize))
+        .add(new RunningCompactionInfo(tec));
   }
 
   public void processExternalCompactionInventory(Set<ServerId> compactors, 
HostAndPort host) {
diff --git 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
 
b/server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
deleted file mode 100644
index de42d0c5b2..0000000000
--- 
a/server/monitor/src/main/java/org/apache/accumulo/monitor/next/endpoint/responses/RunningCompactionsSummary.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.monitor.next.endpoint.responses;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
-import org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
-
-// Variable names become JSON keys
-public record RunningCompactionsSummary(List<RunningCompactionInfo> running) {
-
-  public RunningCompactionsSummary(Map<String,TExternalCompaction> runningMap) 
{
-    this(runningMap == null ? List.of()
-        : 
runningMap.values().stream().map(RunningCompactionInfo::new).toList());
-  }
-}
diff --git 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
index f41c0c6831..9541cbc30e 100644
--- 
a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
+++ 
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/ec.js
@@ -37,12 +37,12 @@ $(function () {
   const ecidColumnName = 'ecid';
   const durationColumnName = 'duration';
 
-  // Create a table for running compactors
+  // Create a table for long running compactions
   runningTable = $('#runningTable').DataTable({
     "autoWidth": false,
     "ajax": {
       "url": contextPath + 'rest-v2/compactions/running',
-      "dataSrc": "running"
+      "dataSrc": ""
     },
     "stateSave": true,
     "dom": 't<"align-left"l>p',
@@ -267,17 +267,21 @@ $(function () {
       htmlRow += "<thead><tr><th>#</th><th>Input 
Files</th><th>Size</th><th>Entries</th></tr></thead>";
       htmlRow += "<tbody></tbody></table>";
       htmlRow += "Output File: <span id='outputFile" + idSuffix + 
"'></span><br>";
-      htmlRow += ecid;
       row.child(htmlRow).show();
 
-      // show the row then populate the table
-      var ecDetails = getDetailsFromStorage(idSuffix);
-      if (ecDetails.length === 0) {
-        getRunningDetails(ecid, idSuffix);
-      } else {
-        console.log("Got cached details for " + idSuffix);
-        populateDetails(ecDetails, idSuffix);
-      }
+      var tableId = 'table' + idSuffix;
+      clearTableBody(tableId);
+      $.each(rci.inputFiles, function (key, value) {
+        var items = [];
+        items.push(createCenterCell(key, key));
+        items.push(createCenterCell(value.metadataFileEntry, 
value.metadataFileEntry));
+        items.push(createCenterCell(value.size, bigNumberForSize(value.size)));
+        items.push(createCenterCell(value.entries, 
bigNumberForQuantity(value.entries)));
+        $('<tr/>', {
+          html: items.join('')
+        }).appendTo('#' + tableId + ' tbody');
+      });
+      $('#outputFile' + idSuffix).text(rci.outputFile);
 
       // Add to the 'open' array
       if (idx === -1) {
@@ -331,64 +335,6 @@ async function refreshManagerStatus() {
   });
 }
 
-function getRunningDetails(ecid, idSuffix) {
-  var ajaxUrl = contextPath + 'rest-v2/ec/details?ecid=' + ecid;
-  console.log("Ajax call to " + ajaxUrl);
-  $.getJSON(ajaxUrl, function (data) {
-    populateDetails(data, idSuffix);
-    var detailsJSON = JSON.parse(sessionStorage.ecDetailsJSON);
-    if (detailsJSON === undefined) {
-      detailsJSON = [];
-    } else if (detailsJSON.length >= 50) {
-      // drop the oldest 25 from the sessionStorage to limit size of the cache
-      var newDetailsJSON = [];
-      $.each(detailsJSON, function (num, val) {
-        if (num > 24) {
-          newDetailsJSON.push(val);
-        }
-      });
-      detailsJSON = newDetailsJSON;
-    }
-    detailsJSON.push({
-      key: idSuffix,
-      value: data
-    });
-    sessionStorage.ecDetailsJSON = JSON.stringify(detailsJSON);
-  });
-}
-
-function getDetailsFromStorage(idSuffix) {
-  var details = [];
-  var detailsJSON = JSON.parse(sessionStorage.ecDetailsJSON);
-  if (detailsJSON.length === 0) {
-    return details;
-  } else {
-    // details are stored as key value pairs in the JSON val
-    $.each(detailsJSON, function (num, val) {
-      if (val.key === idSuffix) {
-        details = val.value;
-      }
-    });
-    return details;
-  }
-}
-
-function populateDetails(data, idSuffix) {
-  var tableId = 'table' + idSuffix;
-  clearTableBody(tableId);
-  $.each(data.inputFiles, function (key, value) {
-    var items = [];
-    items.push(createCenterCell(key, key));
-    items.push(createCenterCell(value.metadataFileEntry, 
value.metadataFileEntry));
-    items.push(createCenterCell(value.size, bigNumberForSize(value.size)));
-    items.push(createCenterCell(value.entries, 
bigNumberForQuantity(value.entries)));
-    $('<tr/>', {
-      html: items.join('')
-    }).appendTo('#' + tableId + ' tbody');
-  });
-  $('#outputFile' + idSuffix).text(data.outputFile);
-}
-
 // Helper function to validate regex
 function isValidRegex(input) {
   try {

Reply via email to