Skip to content

Commit 7f3e400

Browse files
committed
Revert "HBASE-28204 Canary can take lot more time If region starts with delete markers (#5522)"
This reverts commit ce9eabe.
1 parent 44eb408 commit 7f3e400

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -510,38 +510,38 @@ public Void call() {
510510

511511
private Void readColumnFamily(Table table, ColumnFamilyDescriptor column) {
512512
byte[] startKey = null;
513-
Scan scan = new Scan();
513+
Get get = null;
514+
Scan scan = null;
514515
ResultScanner rs = null;
515516
StopWatch stopWatch = new StopWatch();
516517
startKey = region.getStartKey();
517518
// Can't do a get on empty start row so do a Scan of first element if any instead.
518519
if (startKey.length > 0) {
519-
// There are 4 types of region for any table.
520-
// 1. Start and End key are empty. (Table with Single region)
521-
// 2. Start key is empty. (First region of the table)
522-
// 3. End key is empty. (Last region of the table)
523-
// 4. Region with Start & End key. (All the regions between first & last region of the
524-
// table.)
525-
//
526-
// Since Scan only takes Start and/or End Row and doesn't accept the region ID,
527-
// we set the start row when Regions are of type 3 OR 4 as mentioned above.
528-
// For type 1 and 2, We don't need to set this option.
529-
scan.withStartRow(startKey);
520+
get = new Get(startKey);
521+
get.setCacheBlocks(false);
522+
get.setFilter(new FirstKeyOnlyFilter());
523+
get.addFamily(column.getName());
524+
} else {
525+
scan = new Scan();
526+
LOG.debug("rawScan {} for {}", rawScanEnabled, region.getTable());
527+
scan.setRaw(rawScanEnabled);
528+
scan.setCaching(1);
529+
scan.setCacheBlocks(false);
530+
scan.setFilter(new FirstKeyOnlyFilter());
531+
scan.addFamily(column.getName());
532+
scan.setMaxResultSize(1L);
533+
scan.setOneRowLimit();
530534
}
531-
LOG.debug("rawScan {} for {}", rawScanEnabled, region.getTable());
532-
scan.setRaw(rawScanEnabled);
533-
scan.setCaching(1);
534-
scan.setCacheBlocks(false);
535-
scan.setFilter(new FirstKeyOnlyFilter());
536-
scan.addFamily(column.getName());
537-
scan.setMaxResultSize(1L);
538-
scan.setOneRowLimit();
539535
LOG.debug("Reading from {} {} {} {}", region.getTable(), region.getRegionNameAsString(),
540536
column.getNameAsString(), Bytes.toStringBinary(startKey));
541537
try {
542538
stopWatch.start();
543-
rs = table.getScanner(scan);
544-
rs.next();
539+
if (startKey.length > 0) {
540+
table.get(get);
541+
} else {
542+
rs = table.getScanner(scan);
543+
rs.next();
544+
}
545545
stopWatch.stop();
546546
this.readWriteLatency.add(stopWatch.getTime());
547547
sink.publishReadTiming(serverName, region, column, stopWatch.getTime());

0 commit comments

Comments
 (0)