You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dd...@apache.org on 2025/07/24 23:11:35 UTC

(accumulo) branch main updated (53d0297655 -> 4e0153bd1d)

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

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


    from 53d0297655 fixes race condition in ClientTabletCacheImpl (#5756)
     add ed464ca4a0 new options display option for ServiceStatusCmd (#5630)
     add 188fc549a6 Fixes accumulo-cluster script behavior: (#5730)
     new 4e0153bd1d Merge branch '2.1'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/accumulo/server/util/Admin.java     | 11 +++--
 .../accumulo/server/util/ServiceStatusCmd.java     |  4 +-
 .../util/serviceStatus/ServiceStatusReport.java    | 54 ++++++++++++----------
 .../server/util/serviceStatus/StatusSummary.java   | 22 +++++++++
 .../accumulo/server/util/ServiceStatusCmdTest.java |  2 +-
 5 files changed, 60 insertions(+), 33 deletions(-)


(accumulo) 01/01: Merge branch '2.1'

Posted by dd...@apache.org.
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 4e0153bd1d027f3d1084c5ea4a9da8f329d273ef
Merge: 53d0297655 188fc549a6
Author: Daniel Roberts ddanielr <dd...@gmail.com>
AuthorDate: Thu Jul 24 23:09:53 2025 +0000

    Merge branch '2.1'
    
    Removed CSV output option from merge commit

 .../org/apache/accumulo/server/util/Admin.java     | 11 +++--
 .../accumulo/server/util/ServiceStatusCmd.java     |  4 +-
 .../util/serviceStatus/ServiceStatusReport.java    | 54 ++++++++++++----------
 .../server/util/serviceStatus/StatusSummary.java   | 22 +++++++++
 .../accumulo/server/util/ServiceStatusCmdTest.java |  2 +-
 5 files changed, 60 insertions(+), 33 deletions(-)

diff --cc server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 89755b94b8,69c4ca4a7f..9f476d6603
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@@ -396,11 -263,16 +396,12 @@@ public class Admin implements KeywordEx
  
    @Parameters(commandDescription = "show service status")
    public static class ServiceStatusCmdOpts extends SubCommandOpts {
-     @Parameter(names = "--json", description = "provide output in json format (--noHosts ignored)")
+     @Parameter(names = "--json",
+         description = "provide output in json format (--showHosts ignored)")
      boolean json = false;
-     @Parameter(names = "--noHosts",
-         description = "provide a summary of service counts without host details")
-     boolean noHosts = false;
+     @Parameter(names = "--showHosts",
+         description = "provide a summary of service counts with host details")
+     boolean showHosts = false;
 -
 -    @Parameter(names = "--csv",
 -        description = "provide output in csv format (--json and --noHost ignored)")
 -    boolean csv = false;
    }
  
    public static void main(String[] args) {
@@@ -532,9 -432,8 +533,9 @@@
          executeFateOpsCommand(context, fateOpsCommand);
        } else if (cl.getParsedCommand().equals("serviceStatus")) {
          ServiceStatusCmd ssc = new ServiceStatusCmd();
-         ssc.execute(context, serviceStatusCommandOpts.json, serviceStatusCommandOpts.noHosts);
 -        ssc.execute(context, serviceStatusCommandOpts.json, serviceStatusCommandOpts.showHosts,
 -            serviceStatusCommandOpts.csv);
++        ssc.execute(context, serviceStatusCommandOpts.json, serviceStatusCommandOpts.showHosts);
 +      } else if (cl.getParsedCommand().equals("check")) {
 +        executeCheckCommand(context, checkCommand, opts);
        } else if (cl.getParsedCommand().equals("stopManager")
            || cl.getParsedCommand().equals("stopAll")) {
          boolean everything = cl.getParsedCommand().equals("stopAll");
diff --cc server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java
index 85b644d0d6,dc8a47715b..6700d0d6c9
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ServiceStatusCmd.java
@@@ -54,24 -54,30 +54,24 @@@ public class ServiceStatusCmd 
     * Read the service statuses from ZooKeeper, build the status report and then output the report to
     * stdout.
     */
-   public void execute(final ServerContext context, final boolean json, final boolean noHosts) {
 -  public void execute(final ServerContext context, final boolean json, final boolean showHosts,
 -      final boolean csv) {
++  public void execute(final ServerContext context, final boolean json, final boolean showHosts) {
  
 -    ZooReader zooReader = context.getZooReader();
 -
 -    final String zooRoot = context.getZooKeeperRoot();
 -    LOG.trace("zooRoot: {}", zooRoot);
 +    if (LOG.isTraceEnabled()) {
 +      LOG.trace("zooRoot: {}", ZooUtil.getRoot(context.getInstanceID()));
 +    }
  
      final Map<ServiceStatusReport.ReportKey,StatusSummary> services = new TreeMap<>();
  
 -    services.put(ServiceStatusReport.ReportKey.MANAGER, getManagerStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.MONITOR, getMonitorStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.T_SERVER, getTServerStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.S_SERVER, getScanServerStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.COORDINATOR,
 -        getCoordinatorStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.COMPACTOR, getCompactorStatus(zooReader, zooRoot));
 -    services.put(ServiceStatusReport.ReportKey.GC, getGcStatus(zooReader, zooRoot));
 +    services.put(ServiceStatusReport.ReportKey.MANAGER, getManagerStatus(context));
 +    services.put(ServiceStatusReport.ReportKey.MONITOR, getMonitorStatus(context));
 +    services.put(ServiceStatusReport.ReportKey.T_SERVER, getTServerStatus(context));
 +    services.put(ServiceStatusReport.ReportKey.S_SERVER, getScanServerStatus(context));
 +    services.put(ServiceStatusReport.ReportKey.COMPACTOR, getCompactorStatus(context));
 +    services.put(ServiceStatusReport.ReportKey.GC, getGcStatus(context));
  
-     ServiceStatusReport report = new ServiceStatusReport(services, noHosts);
+     ServiceStatusReport report = new ServiceStatusReport(services, showHosts);
  
 -    if (csv) {
 -      System.out.println(report.toCsv());
 -    } else if (json) {
 +    if (json) {
        System.out.println(report.toJson());
      } else {
        StringBuilder sb = new StringBuilder(8192);
diff --cc server/base/src/main/java/org/apache/accumulo/server/util/serviceStatus/ServiceStatusReport.java
index d05bb22d6f,7ae71a0cbb..2deb9be4fb
--- a/server/base/src/main/java/org/apache/accumulo/server/util/serviceStatus/ServiceStatusReport.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/serviceStatus/ServiceStatusReport.java
@@@ -91,26 -119,21 +95,26 @@@ public class ServiceStatusReport 
          .reduce(Integer::sum).orElse(0);
      sb.append("ZooKeeper read errors: ").append(zkErrors).append("\n");
  
-     fmtResourceGroups(sb, ReportKey.MANAGER, summaries.get(ReportKey.MANAGER), noHosts);
-     fmtResourceGroups(sb, ReportKey.MONITOR, summaries.get(ReportKey.MONITOR), noHosts);
-     fmtResourceGroups(sb, ReportKey.GC, summaries.get(ReportKey.GC), noHosts);
-     fmtResourceGroups(sb, ReportKey.T_SERVER, summaries.get(ReportKey.T_SERVER), noHosts);
-     fmtResourceGroups(sb, ReportKey.S_SERVER, summaries.get(ReportKey.S_SERVER), noHosts);
-     fmtResourceGroups(sb, ReportKey.COMPACTOR, summaries.get(ReportKey.COMPACTOR), noHosts);
 -    fmtServiceStatus(sb, ReportKey.MANAGER, summaries.get(ReportKey.MANAGER), showHosts);
 -    fmtServiceStatus(sb, ReportKey.MONITOR, summaries.get(ReportKey.MONITOR), showHosts);
 -    fmtServiceStatus(sb, ReportKey.GC, summaries.get(ReportKey.GC), showHosts);
 -    fmtServiceStatus(sb, ReportKey.T_SERVER, summaries.get(ReportKey.T_SERVER), showHosts);
++    fmtResourceGroups(sb, ReportKey.MANAGER, summaries.get(ReportKey.MANAGER), showHosts);
++    fmtResourceGroups(sb, ReportKey.MONITOR, summaries.get(ReportKey.MONITOR), showHosts);
++    fmtResourceGroups(sb, ReportKey.GC, summaries.get(ReportKey.GC), showHosts);
++    fmtResourceGroups(sb, ReportKey.T_SERVER, summaries.get(ReportKey.T_SERVER), showHosts);
+     fmtResourceGroups(sb, ReportKey.S_SERVER, summaries.get(ReportKey.S_SERVER), showHosts);
 -    fmtServiceStatus(sb, ReportKey.COORDINATOR, summaries.get(ReportKey.COORDINATOR), showHosts);
+     fmtResourceGroups(sb, ReportKey.COMPACTOR, summaries.get(ReportKey.COMPACTOR), showHosts);
  
      sb.append("\n");
      LOG.trace("fmtStatus - with hosts: {}", summaries);
      return sb.toString();
    }
  
 +  /**
 +   * This method can be used instead of
 +   * {@link #fmtResourceGroups(StringBuilder, ReportKey, StatusSummary, boolean)} if there are
 +   * services that do not make sense to group by a resource group. With the data in ServiceLock, all
 +   * services has at least the default group.
 +   */
    private void fmtServiceStatus(final StringBuilder sb, final ReportKey displayNames,
-       final StatusSummary summary, boolean noHosts) {
+       final StatusSummary summary, boolean showHosts) {
      if (summary == null) {
        sb.append(displayNames).append(": unavailable").append("\n");
        return;
@@@ -118,14 -141,14 +122,14 @@@
  
      fmtCounts(sb, summary);
  
-     // skip host info if requested
-     if (noHosts) {
+     // skip host info if NOT showing hosts
+     if (!showHosts) {
        return;
      }
 -
 +    sb.append(I2).append("resource group: (default)").append("\n");
      if (summary.getServiceCount() > 0) {
        var hosts = summary.getServiceByGroups();
 -      hosts.values().forEach(s -> s.forEach(h -> sb.append(I2).append(h).append("\n")));
 +      hosts.values().forEach(s -> s.forEach(h -> sb.append(I4).append(h).append("\n")));
      }
    }
  
@@@ -144,12 -167,6 +148,12 @@@
        sb.append(reportKey).append(": unavailable").append("\n");
        return;
      }
 +    // only default group is present, omit grouping from report
 +    if (!summary.getResourceGroups().isEmpty()
 +        && summary.getResourceGroups().equals(Set.of(DEFAULT_RESOURCE_GROUP_NAME))) {
-       fmtServiceStatus(sb, reportKey, summary, noHosts);
++      fmtServiceStatus(sb, reportKey, summary, showHosts);
 +      return;
 +    }
  
      fmtCounts(sb, summary);
  
diff --cc server/base/src/test/java/org/apache/accumulo/server/util/ServiceStatusCmdTest.java
index 2d81f8b6c7,2b9027725a..c25b4a91d6
--- a/server/base/src/test/java/org/apache/accumulo/server/util/ServiceStatusCmdTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/util/ServiceStatusCmdTest.java
@@@ -496,10 -397,11 +496,10 @@@ public class ServiceStatusCmdTest 
  
    @Test
    public void testServiceStatusCommandOpts() {
 -    replay(zooReader); // needed for @AfterAll verify
 +    replay(zooReader, zooCache);
      Admin.ServiceStatusCmdOpts opts = new Admin.ServiceStatusCmdOpts();
      assertFalse(opts.json);
-     assertFalse(opts.noHosts);
+     assertFalse(opts.showHosts);
 -    assertFalse(opts.csv);
    }
  
  }