HBASE-16771 VerifyReplication should increase GOODROWS counter if re-comparison passes

This commit is contained in:
tedyu 2016-10-09 20:48:28 -07:00
parent 8a8c60889c
commit ccde439392
1 changed files with 8 additions and 4 deletions

View File

@ -107,6 +107,7 @@ public class VerifyReplication extends Configured implements Tool {
private ResultScanner replicatedScanner; private ResultScanner replicatedScanner;
private Result currentCompareRowInPeerTable; private Result currentCompareRowInPeerTable;
private int sleepMsBeforeReCompare; private int sleepMsBeforeReCompare;
private String delimiter = "";
private boolean verbose = false; private boolean verbose = false;
/** /**
@ -124,6 +125,7 @@ public class VerifyReplication extends Configured implements Tool {
if (replicatedScanner == null) { if (replicatedScanner == null) {
Configuration conf = context.getConfiguration(); Configuration conf = context.getConfiguration();
sleepMsBeforeReCompare = conf.getInt(NAME +".sleepMsBeforeReCompare", 0); sleepMsBeforeReCompare = conf.getInt(NAME +".sleepMsBeforeReCompare", 0);
delimiter = conf.get(NAME + ".delimiter", "");
verbose = conf.getBoolean(NAME +".verbose", false); verbose = conf.getBoolean(NAME +".verbose", false);
final Scan scan = new Scan(); final Scan scan = new Scan();
scan.setBatch(batch); scan.setBatch(batch);
@ -180,7 +182,6 @@ public class VerifyReplication extends Configured implements Tool {
} }
} catch (Exception e) { } catch (Exception e) {
logFailRowAndIncreaseCounter(context, Counters.CONTENT_DIFFERENT_ROWS, value); logFailRowAndIncreaseCounter(context, Counters.CONTENT_DIFFERENT_ROWS, value);
LOG.error("Exception while comparing row : " + e);
} }
currentCompareRowInPeerTable = replicatedScanner.next(); currentCompareRowInPeerTable = replicatedScanner.next();
break; break;
@ -204,9 +205,11 @@ public class VerifyReplication extends Configured implements Tool {
Result sourceResult = sourceTable.get(new Get(row.getRow())); Result sourceResult = sourceTable.get(new Get(row.getRow()));
Result replicatedResult = replicatedTable.get(new Get(row.getRow())); Result replicatedResult = replicatedTable.get(new Get(row.getRow()));
Result.compareResults(sourceResult, replicatedResult); Result.compareResults(sourceResult, replicatedResult);
context.getCounter(Counters.GOODROWS).increment(1); if (!sourceResult.isEmpty()) {
if (verbose) { context.getCounter(Counters.GOODROWS).increment(1);
LOG.info("Good row key: " + delimiter + Bytes.toString(row.getRow()) + delimiter); if (verbose) {
LOG.info("Good row key: " + delimiter + Bytes.toString(row.getRow()) + delimiter);
}
} }
return; return;
} catch (Exception e) { } catch (Exception e) {
@ -320,6 +323,7 @@ public class VerifyReplication extends Configured implements Tool {
conf.setLong(NAME+".startTime", startTime); conf.setLong(NAME+".startTime", startTime);
conf.setLong(NAME+".endTime", endTime); conf.setLong(NAME+".endTime", endTime);
conf.setInt(NAME +".sleepMsBeforeReCompare", sleepMsBeforeReCompare); conf.setInt(NAME +".sleepMsBeforeReCompare", sleepMsBeforeReCompare);
conf.set(NAME + ".delimiter", delimiter);
conf.setBoolean(NAME +".verbose", verbose); conf.setBoolean(NAME +".verbose", verbose);
if (families != null) { if (families != null) {
conf.set(NAME+".families", families); conf.set(NAME+".families", families);