HBASE-17871 scan#setBatch(int) call leads wrong result of VerifyReplication
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
d7e3116a17
commit
ec5188df30
|
@ -77,7 +77,7 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
private final static String PEER_CONFIG_PREFIX = NAME + ".peer.";
|
||||
static long startTime = 0;
|
||||
static long endTime = Long.MAX_VALUE;
|
||||
static int batch = Integer.MAX_VALUE;
|
||||
static int batch = -1;
|
||||
static int versions = -1;
|
||||
static String tableName = null;
|
||||
static String families = null;
|
||||
|
@ -110,6 +110,7 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
private int sleepMsBeforeReCompare;
|
||||
private String delimiter = "";
|
||||
private boolean verbose = false;
|
||||
private int batch = -1;
|
||||
|
||||
/**
|
||||
* Map method that compares every scanned row with the equivalent from
|
||||
|
@ -128,8 +129,11 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
sleepMsBeforeReCompare = conf.getInt(NAME +".sleepMsBeforeReCompare", 0);
|
||||
delimiter = conf.get(NAME + ".delimiter", "");
|
||||
verbose = conf.getBoolean(NAME +".verbose", false);
|
||||
batch = conf.getInt(NAME + ".batch", -1);
|
||||
final Scan scan = new Scan();
|
||||
scan.setBatch(batch);
|
||||
if (batch > 0) {
|
||||
scan.setBatch(batch);
|
||||
}
|
||||
scan.setCacheBlocks(false);
|
||||
scan.setCaching(conf.getInt(TableInputFormat.SCAN_CACHEDROWS, 1));
|
||||
long startTime = conf.getLong(NAME + ".startTime", 0);
|
||||
|
@ -329,6 +333,7 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
conf.setLong(NAME+".endTime", endTime);
|
||||
conf.setInt(NAME +".sleepMsBeforeReCompare", sleepMsBeforeReCompare);
|
||||
conf.set(NAME + ".delimiter", delimiter);
|
||||
conf.setInt(NAME + ".batch", batch);
|
||||
conf.setBoolean(NAME +".verbose", verbose);
|
||||
conf.setBoolean(NAME +".includeDeletedCells", includeDeletedCells);
|
||||
if (families != null) {
|
||||
|
@ -356,6 +361,10 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
Scan scan = new Scan();
|
||||
scan.setTimeRange(startTime, endTime);
|
||||
scan.setRaw(includeDeletedCells);
|
||||
scan.setCacheBlocks(false);
|
||||
if (batch > 0) {
|
||||
scan.setBatch(batch);
|
||||
}
|
||||
if (versions >= 0) {
|
||||
scan.setMaxVersions(versions);
|
||||
LOG.info("Number of versions set to " + versions);
|
||||
|
@ -503,7 +512,7 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
private static void restoreDefaults() {
|
||||
startTime = 0;
|
||||
endTime = Long.MAX_VALUE;
|
||||
batch = Integer.MAX_VALUE;
|
||||
batch = -1;
|
||||
versions = -1;
|
||||
tableName = null;
|
||||
families = null;
|
||||
|
@ -521,13 +530,15 @@ public class VerifyReplication extends Configured implements Tool {
|
|||
}
|
||||
System.err.println("Usage: verifyrep [--starttime=X]" +
|
||||
" [--endtime=Y] [--families=A] [--row-prefixes=B] [--delimiter=] [--recomparesleep=] " +
|
||||
"[--verbose] <peerid> <tablename>");
|
||||
"[--batch=] [--verbose] <peerid> <tablename>");
|
||||
System.err.println();
|
||||
System.err.println("Options:");
|
||||
System.err.println(" starttime beginning of the time range");
|
||||
System.err.println(" without endtime means from starttime to forever");
|
||||
System.err.println(" endtime end of the time range");
|
||||
System.err.println(" versions number of cell versions to verify");
|
||||
System.err.println(" batch batch count for scan, " +
|
||||
"note that result row counts will no longer be actual number of rows when you use this option");
|
||||
System.err.println(" raw includes raw scan if given in options");
|
||||
System.err.println(" families comma-separated list of families to copy");
|
||||
System.err.println(" row-prefixes comma-separated list of row key prefixes to filter on ");
|
||||
|
|
Loading…
Reference in New Issue