You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ni...@apache.org on 2024/09/07 11:40:18 UTC

(hbase) branch branch-2 updated: HBASE-28807 Remove some useless code and add some logs for CanaryTool (#6187) (#6214)

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

nihaljain pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 5ca5fafb38d HBASE-28807 Remove some useless code and add some logs for CanaryTool (#6187) (#6214)
5ca5fafb38d is described below

commit 5ca5fafb38de79035689ac5c257afde3c6305f08
Author: Nihal Jain <ni...@apache.org>
AuthorDate: Sat Sep 7 17:10:13 2024 +0530

    HBASE-28807 Remove some useless code and add some logs for CanaryTool (#6187) (#6214)
    
    Co-authored-by: WangXin <14...@qq.com>
    Co-authored-by: wangxin <wa...@gmail.com>
    
    Signed-off-by: Nihal Jain <ni...@apache.org>
    (cherry picked from commit b161ad573e6ede257528a2b0802e07e6a6c8eccb)
---
 .../org/apache/hadoop/hbase/tool/CanaryTool.java   | 34 ++++++++++------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
index 979fdeb0bb8..c999403564a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
@@ -1735,26 +1735,22 @@ public class CanaryTool implements Tool, Canary {
     TableDescriptor tableDesc, ExecutorService executor, TaskType taskType, boolean rawScanEnabled,
     LongAdder rwLatency, boolean readAllCF) throws Exception {
     LOG.debug("Reading list of regions for table {}", tableDesc.getTableName());
-    try (Table table = admin.getConnection().getTable(tableDesc.getTableName())) {
-      List<RegionTask> tasks = new ArrayList<>();
-      try (RegionLocator regionLocator =
-        admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
-        for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
-          if (location == null) {
-            LOG.warn("Null location");
-            continue;
-          }
-          ServerName rs = location.getServerName();
-          RegionInfo region = location.getRegion();
-          tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink) sink,
-            taskType, rawScanEnabled, rwLatency, readAllCF));
-          Map<String, List<RegionTaskResult>> regionMap = ((RegionStdOutSink) sink).getRegionMap();
-          regionMap.put(region.getRegionNameAsString(), new ArrayList<RegionTaskResult>());
+    List<RegionTask> tasks = new ArrayList<>();
+    try (RegionLocator regionLocator =
+      admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
+      for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
+        if (location == null) {
+          LOG.warn("Null location for table {}", tableDesc.getTableName());
+          continue;
         }
-        return executor.invokeAll(tasks);
+        ServerName rs = location.getServerName();
+        RegionInfo region = location.getRegion();
+        tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink) sink,
+          taskType, rawScanEnabled, rwLatency, readAllCF));
+        Map<String, List<RegionTaskResult>> regionMap = ((RegionStdOutSink) sink).getRegionMap();
+        regionMap.put(region.getRegionNameAsString(), new ArrayList<RegionTaskResult>());
       }
-    } catch (TableNotFoundException e) {
-      return Collections.EMPTY_LIST;
+      return executor.invokeAll(tasks);
     }
   }
 
@@ -1960,7 +1956,7 @@ public class CanaryTool implements Tool, Canary {
             this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
             for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
               if (location == null) {
-                LOG.warn("Null location");
+                LOG.warn("Null location for table {}", tableDesc.getTableName());
                 continue;
               }
               ServerName rs = location.getServerName();