HBASE-16771 VerifyReplication should increase GOODROWS counter if re-comparison passes
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ccde4393 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ccde4393 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ccde4393 Branch: refs/heads/hbase-12439 Commit: ccde4393925a6fd5f97a11068cdc96fa4e4d4ac0 Parents: 8a8c608 Author: tedyu <yuzhih...@gmail.com> Authored: Sun Oct 9 20:48:28 2016 -0700 Committer: tedyu <yuzhih...@gmail.com> Committed: Sun Oct 9 20:48:28 2016 -0700 ---------------------------------------------------------------------- .../hbase/mapreduce/replication/VerifyReplication.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/ccde4393/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java index 0273b91..88bf815 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java @@ -107,6 +107,7 @@ public class VerifyReplication extends Configured implements Tool { private ResultScanner replicatedScanner; private Result currentCompareRowInPeerTable; private int sleepMsBeforeReCompare; + private String delimiter = ""; private boolean verbose = false; /** @@ -124,6 +125,7 @@ public class VerifyReplication extends Configured implements Tool { if (replicatedScanner == null) { Configuration conf = context.getConfiguration(); sleepMsBeforeReCompare = conf.getInt(NAME +".sleepMsBeforeReCompare", 0); + delimiter = conf.get(NAME + ".delimiter", ""); verbose = conf.getBoolean(NAME +".verbose", false); final Scan scan = new Scan(); scan.setBatch(batch); @@ -180,7 +182,6 @@ public class VerifyReplication extends Configured implements Tool { } } catch (Exception e) { logFailRowAndIncreaseCounter(context, Counters.CONTENT_DIFFERENT_ROWS, value); - LOG.error("Exception while comparing row : " + e); } currentCompareRowInPeerTable = replicatedScanner.next(); break; @@ -204,9 +205,11 @@ public class VerifyReplication extends Configured implements Tool { Result sourceResult = sourceTable.get(new Get(row.getRow())); Result replicatedResult = replicatedTable.get(new Get(row.getRow())); Result.compareResults(sourceResult, replicatedResult); - context.getCounter(Counters.GOODROWS).increment(1); - if (verbose) { - LOG.info("Good row key: " + delimiter + Bytes.toString(row.getRow()) + delimiter); + if (!sourceResult.isEmpty()) { + context.getCounter(Counters.GOODROWS).increment(1); + if (verbose) { + LOG.info("Good row key: " + delimiter + Bytes.toString(row.getRow()) + delimiter); + } } return; } catch (Exception e) { @@ -320,6 +323,7 @@ public class VerifyReplication extends Configured implements Tool { conf.setLong(NAME+".startTime", startTime); conf.setLong(NAME+".endTime", endTime); conf.setInt(NAME +".sleepMsBeforeReCompare", sleepMsBeforeReCompare); + conf.set(NAME + ".delimiter", delimiter); conf.setBoolean(NAME +".verbose", verbose); if (families != null) { conf.set(NAME+".families", families);