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

ctubbsii 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 5fca90d  Fix #1760 `listcompactions` command error is not helpful 
(#1833)
5fca90d is described below

commit 5fca90dc8f359dcaa0e8d345ff55e306365f5699
Author: Dom G <47725857+domgargu...@users.noreply.github.com>
AuthorDate: Thu Dec 10 08:26:28 2020 -0500

    Fix #1760 `listcompactions` command error is not helpful (#1833)
    
    * added a more helpful error message when no port is passed with the 
listcompactions command
    * error message edit and exception log in debug
---
 core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java    | 2 +-
 .../org/apache/accumulo/shell/commands/ActiveCompactionHelper.java   | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java 
b/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java
index a41b2c7..d6ba8da 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/HostAndPort.java
@@ -105,7 +105,7 @@ public final class HostAndPort implements Serializable {
    *           occurring.
    */
   public int getPort() {
-    checkState(hasPort());
+    checkState(hasPort(), "the address does not include a port");
     return port;
   }
 
diff --git 
a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
 
b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
index 592e2c3..c9a52f0 100644
--- 
a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
+++ 
b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java
@@ -33,9 +33,13 @@ import 
org.apache.accumulo.core.client.admin.ActiveCompaction;
 import org.apache.accumulo.core.client.admin.InstanceOperations;
 import org.apache.accumulo.core.util.Duration;
 import org.apache.accumulo.core.util.NamingThreadFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class ActiveCompactionHelper {
 
+  private static final Logger log = 
LoggerFactory.getLogger(ActiveCompactionHelper.class);
+
   private static String maxDecimal(double count) {
     if (count < 9.995)
       return String.format("%.2f", count);
@@ -86,6 +90,7 @@ class ActiveCompactionHelper {
         compactions.add(formatActiveCompactionLine(tserver, ac));
       }
     } catch (Exception e) {
+      log.debug("Failed to list active compactions for server {}", tserver, e);
       compactions.add(tserver + " ERROR " + e.getMessage());
     }
     return compactions;

Reply via email to