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 04ae18f..5fcbce0 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 @@ -86,6 +86,7 @@ public class VerifyReplication extends Configured implements Tool { static String peerId = null; static String rowPrefixes = null; static int sleepMsBeforeReCompare = 0; + static boolean verbose = false; private final static String JOB_NAME_CONF_KEY = "mapreduce.job.name"; @@ -107,6 +108,7 @@ public class VerifyReplication extends Configured implements Tool { private ResultScanner replicatedScanner; private Result currentCompareRowInPeerTable; private int sleepMsBeforeReCompare; + private boolean verbose = false; /** * Map method that compares every scanned row with the equivalent from @@ -123,6 +125,7 @@ public class VerifyReplication extends Configured implements Tool { if (replicatedScanner == null) { Configuration conf = context.getConfiguration(); sleepMsBeforeReCompare = conf.getInt(NAME +".sleepMsBeforeReCompare", 0); + verbose = conf.getBoolean(NAME +".verbose", false); final Scan scan = new Scan(); scan.setBatch(batch); scan.setCacheBlocks(false); @@ -173,6 +176,9 @@ public class VerifyReplication extends Configured implements Tool { try { Result.compareResults(value, currentCompareRowInPeerTable); context.getCounter(Counters.GOODROWS).increment(1); + if (verbose) { + LOG.info("Good row key: " + Bytes.toString(value.getRow())); + } } catch (Exception e) { logFailRowAndIncreaseCounter(context, Counters.CONTENT_DIFFERENT_ROWS, value); LOG.error("Exception while comparing row : " + e); @@ -199,6 +205,10 @@ 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: " + Bytes.toString(row.getRow())); + } return; } catch (Exception e) { LOG.error("recompare fail after sleep, rowkey=" + delimiter + @@ -311,6 +321,7 @@ public class VerifyReplication extends Configured implements Tool { conf.setLong(NAME+".startTime", startTime); conf.setLong(NAME+".endTime", endTime); conf.setInt(NAME +".sleepMsBeforeReCompare", sleepMsBeforeReCompare); + conf.setBoolean(NAME +".verbose", verbose); if (families != null) { conf.set(NAME+".families", families); } @@ -451,7 +462,11 @@ public class VerifyReplication extends Configured implements Tool { sleepMsBeforeReCompare = Integer.parseInt(cmd.substring(sleepToReCompareKey.length())); continue; } - + final String verboseKey = "--verbose="; + if (cmd.startsWith(verboseKey)) { + verbose = true; + continue; + } if (i == args.length-2) { peerId = cmd; }