Skip to content

Commit

Permalink
HBASE-28807 Remove some useless code and add some logs for CanaryTool (
Browse files Browse the repository at this point in the history
…apache#6187) (apache#6216)

Co-authored-by: WangXin <1458451310@qq.com>
Co-authored-by: wangxin <wangxin9702@gmail.com>

Signed-off-by: Nihal Jain <nihaljain@apache.org>
(cherry picked from commit b161ad5)
  • Loading branch information
NihalJain authored Sep 7, 2024
1 parent 7bce8e6 commit c033996
Showing 1 changed file with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1734,26 +1734,22 @@ private static List<Future<Void>> sniff(final Admin admin, final Sink sink,
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);
}
}

Expand Down Expand Up @@ -1959,7 +1955,7 @@ private Map<String, List<RegionInfo>> getAllRegionServerByName() {
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();
Expand Down

0 comments on commit c033996

Please sign in to comment.