This is an automated email from the ASF dual-hosted git repository. ddanielr pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 530beaeaa9 Convert compaction duration to mills earlier (#5209) 530beaeaa9 is described below commit 530beaeaa9546e2250b90c9e42c990fe0b2ef581 Author: Daniel Roberts <ddani...@gmail.com> AuthorDate: Mon Dec 23 14:55:01 2024 -0500 Convert compaction duration to mills earlier (#5209) Converts the compaction duration from nanos to mills in RunningCompactionInfo. This removes the need to handle the data conversion in the monitor and ec-admin utility. --- .../apache/accumulo/core/util/compaction/RunningCompactionInfo.java | 4 ++-- .../main/resources/org/apache/accumulo/monitor/resources/js/ec.js | 1 - .../accumulo/test/compaction/ExternalCompactionProgressIT.java | 6 +++--- 3 files changed, 5 insertions(+), 6 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 baf8d1ddae..1df1469c48 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 @@ -75,7 +75,7 @@ public class RunningCompactionInfo { if (lastEntry != null) { last = lastEntry.getValue(); updateMillis = lastEntry.getKey(); - duration = last.getCompactionAgeNanos(); + duration = NANOSECONDS.toMillis(last.getCompactionAgeNanos()); } else { log.debug("No updates found for {}", ecid); lastUpdate = 1; @@ -84,7 +84,7 @@ public class RunningCompactionInfo { duration = 0; return; } - long durationMinutes = NANOSECONDS.toMinutes(duration); + long durationMinutes = MILLISECONDS.toMinutes(duration); if (durationMinutes > 15) { log.warn("Compaction {} has been running for {} minutes", ecid, durationMinutes); } 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 21f63e2a46..545c2559df 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 @@ -80,7 +80,6 @@ $(document).ready(function () { "columnDefs": [{ "targets": "duration", "render": function (data, type, row) { - data = data / 1_000_000; // convert from nanos to millis if (type === 'display') data = timeDuration(data); return data; } diff --git a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java index 535d50b34b..38105d5b4b 100644 --- a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java +++ b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionProgressIT.java @@ -18,7 +18,7 @@ */ package org.apache.accumulo.test.compaction; -import static java.util.concurrent.TimeUnit.NANOSECONDS; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.accumulo.core.util.UtilWaitThread.sleepUninterruptibly; import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.QUEUE1; import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.compact; @@ -183,7 +183,7 @@ public class ExternalCompactionProgressIT extends AccumuloClusterHarness { .getCompactions().values().iterator().next(); RunningCompactionInfo updatedCompactionInfo = new RunningCompactionInfo(updatedCompaction); - final Duration reportedCompactionDuration = Duration.ofNanos(updatedCompactionInfo.duration); + final Duration reportedCompactionDuration = Duration.ofMillis(updatedCompactionInfo.duration); final Duration measuredCompactionDuration = Duration.ofNanos(System.nanoTime() - compactionStartTime); final Duration coordinatorAge = Duration.ofNanos(System.nanoTime() - coordinatorRestartTime); @@ -432,7 +432,7 @@ public class ExternalCompactionProgressIT extends AccumuloClusterHarness { RunningCompactionInfo rci = new RunningCompactionInfo(ec); RunningCompactionInfo previousRci = runningMap.put(ecid, rci); log.debug("ECID {} has been running for {} seconds", ecid, - NANOSECONDS.toSeconds(rci.duration)); + MILLISECONDS.toSeconds(rci.duration)); if (previousRci == null) { log.debug("New ECID {} with inputFiles: {}", ecid, rci.numFiles); } else {