HBASE-13377 Canary may generate false alarm on the first region when there are many delete markers (He Liangliang)

Amending-Author: Andrew Purtell <apurtell@apache.org>

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
This commit is contained in:
stack 2015-04-07 17:07:39 -07:00 committed by Andrew Purtell
parent d4f6928b05
commit ac190e8077
1 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,7 @@ import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
@ -551,10 +552,15 @@ public final class Canary implements Tool {
// Can't do a get on empty start row so do a Scan of first element if any instead. // Can't do a get on empty start row so do a Scan of first element if any instead.
if (startKey.length > 0) { if (startKey.length > 0) {
get = new Get(startKey); get = new Get(startKey);
get.setCacheBlocks(false);
get.setFilter(new FirstKeyOnlyFilter());
get.addFamily(column.getName()); get.addFamily(column.getName());
} else { } else {
scan = new Scan(); scan = new Scan();
scan.setRaw(true);
scan.setCaching(1); scan.setCaching(1);
scan.setCacheBlocks(false);
scan.setFilter(new FirstKeyOnlyFilter());
scan.addFamily(column.getName()); scan.addFamily(column.getName());
scan.setMaxResultSize(1L); scan.setMaxResultSize(1L);
} }