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

domgarguilo 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 33b9becf11 Use existing table name collection in list tablets command 
(#5619)
33b9becf11 is described below

commit 33b9becf11788f5fd032cad179bd07e4509f32a2
Author: Dom G. <[email protected]>
AuthorDate: Thu Jun 5 11:59:28 2025 -0400

    Use existing table name collection in list tablets command (#5619)
    
    * Use existing table name collection in list tablets command. This avoids 
making multiple TableOps calls.
---
 .../org/apache/accumulo/shell/commands/ListTabletsCommand.java     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java
 
b/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java
index 93adcfe10a..beeee57797 100644
--- 
a/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java
+++ 
b/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.TreeSet;
@@ -52,7 +53,7 @@ import com.google.common.annotations.VisibleForTesting;
 
 /**
  * Utility that generates single line tablet info. The output of this could be 
fed to sort, awk,
- * grep, etc inorder to answer questions like which tablets have the most 
files.
+ * grep, etc. to answer questions like which tablets have the most files.
  */
 public class ListTabletsCommand extends Command {
 
@@ -120,13 +121,13 @@ public class ListTabletsCommand extends Command {
       throws NamespaceNotFoundException {
 
     final TableOperations tableOps = 
shellState.getAccumuloClient().tableOperations();
-    var tableIdMap = tableOps.tableIdMap();
+    final Map<String,String> tableIdMap = tableOps.tableIdMap();
 
     Set<TableInfo> tableSet = new TreeSet<>();
 
     if (cl.hasOption(optTablePattern.getOpt())) {
       Pattern tablePattern = 
Pattern.compile(cl.getOptionValue(optTablePattern.getOpt()));
-      for (String table : tableOps.list()) {
+      for (String table : tableIdMap.keySet()) {
         if (tablePattern.matcher(table).matches()) {
           TableId id = TableId.of(tableIdMap.get(table));
           tableSet.add(new TableInfo(table, id));

Reply via email to