Skip to content

Commit cd149bd

Browse files
wangxin97-02wangxin
authored andcommitted
HBASE-28807 Remove some useless code and add some logs for CanaryTool (apache#6187)
Co-authored-by: wangxin <[email protected]> Signed-off-by: Nihal Jain <[email protected]> (cherry picked from commit b161ad5)
1 parent 8ffd93d commit cd149bd

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,26 +1734,22 @@ private static List<Future<Void>> sniff(final Admin admin, final Sink sink,
17341734
TableDescriptor tableDesc, ExecutorService executor, TaskType taskType, boolean rawScanEnabled,
17351735
LongAdder rwLatency, boolean readAllCF) throws Exception {
17361736
LOG.debug("Reading list of regions for table {}", tableDesc.getTableName());
1737-
try (Table table = admin.getConnection().getTable(tableDesc.getTableName())) {
1738-
List<RegionTask> tasks = new ArrayList<>();
1739-
try (RegionLocator regionLocator =
1740-
admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
1741-
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
1742-
if (location == null) {
1743-
LOG.warn("Null location");
1744-
continue;
1745-
}
1746-
ServerName rs = location.getServerName();
1747-
RegionInfo region = location.getRegion();
1748-
tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink) sink,
1749-
taskType, rawScanEnabled, rwLatency, readAllCF));
1750-
Map<String, List<RegionTaskResult>> regionMap = ((RegionStdOutSink) sink).getRegionMap();
1751-
regionMap.put(region.getRegionNameAsString(), new ArrayList<RegionTaskResult>());
1737+
List<RegionTask> tasks = new ArrayList<>();
1738+
try (RegionLocator regionLocator =
1739+
admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
1740+
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
1741+
if (location == null) {
1742+
LOG.warn("Null location for table {}", tableDesc.getTableName());
1743+
continue;
17521744
}
1753-
return executor.invokeAll(tasks);
1745+
ServerName rs = location.getServerName();
1746+
RegionInfo region = location.getRegion();
1747+
tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink) sink,
1748+
taskType, rawScanEnabled, rwLatency, readAllCF));
1749+
Map<String, List<RegionTaskResult>> regionMap = ((RegionStdOutSink) sink).getRegionMap();
1750+
regionMap.put(region.getRegionNameAsString(), new ArrayList<RegionTaskResult>());
17541751
}
1755-
} catch (TableNotFoundException e) {
1756-
return Collections.EMPTY_LIST;
1752+
return executor.invokeAll(tasks);
17571753
}
17581754
}
17591755

@@ -1959,7 +1955,7 @@ private Map<String, List<RegionInfo>> getAllRegionServerByName() {
19591955
this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
19601956
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
19611957
if (location == null) {
1962-
LOG.warn("Null location");
1958+
LOG.warn("Null location for table {}", tableDesc.getTableName());
19631959
continue;
19641960
}
19651961
ServerName rs = location.getServerName();

0 commit comments

Comments
 (0)