HBASE-16772 Add verbose option to VerifyReplication for logging good rows
Conflicts:
hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java
Amending-Author: Andrew Purtell <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e2df4b80
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e2df4b80
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e2df4b80
Branch: refs/heads/0.98
Commit: e2df4b80589aa42bd8ef77debad29ded1702a956
Parents: dd488c0
Author: Andrew Purtell <[email protected]>
Authored: Fri Dec 2 16:03:57 2016 -0800
Committer: Andrew Purtell <[email protected]>
Committed: Fri Dec 2 16:03:57 2016 -0800
----------------------------------------------------------------------
.../mapreduce/replication/VerifyReplication.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/e2df4b80/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 5fc3dd5..1ec31a1 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
@@ -83,6 +83,7 @@ public class VerifyReplication extends Configured implements
Tool {
static String delimiter = "";
static String peerId = null;
static String rowPrefixes = null;
+ static boolean verbose = false;
/**
* Map-only comparator for 2 tables
@@ -95,6 +96,7 @@ public class VerifyReplication extends Configured implements
Tool {
private ResultScanner replicatedScanner;
private Result currentCompareRowInPeerTable;
+ private boolean verbose = false;
/**
* Map method that compares every scanned row with the equivalent from
@@ -110,6 +112,7 @@ public class VerifyReplication extends Configured
implements Tool {
throws IOException {
if (replicatedScanner == null) {
Configuration conf = context.getConfiguration();
+ verbose = conf.getBoolean(NAME +".verbose", false);
final Scan scan = new Scan();
scan.setBatch(batch);
scan.setCacheBlocks(false);
@@ -161,6 +164,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: " + delimiter +
Bytes.toString(value.getRow()) + delimiter);
+ }
} catch (Exception e) {
logFailRowAndIncreaseCounter(context,
Counters.CONTENT_DIFFERENT_ROWS, value);
LOG.error("Exception while comparing row : " + e);
@@ -260,6 +266,7 @@ public class VerifyReplication extends Configured
implements Tool {
conf.set(NAME+".tableName", tableName);
conf.setLong(NAME+".startTime", startTime);
conf.setLong(NAME+".endTime", endTime);
+ conf.setBoolean(NAME +".verbose", verbose);
if (families != null) {
conf.set(NAME+".families", families);
}
@@ -395,6 +402,12 @@ public class VerifyReplication extends Configured
implements Tool {
continue;
}
+ final String verboseKey = "--verbose";
+ if (cmd.startsWith(verboseKey)) {
+ verbose = true;
+ continue;
+ }
+
if (i == args.length-2) {
peerId = cmd;
}
@@ -430,7 +443,8 @@ public class VerifyReplication extends Configured
implements Tool {
System.err.println("ERROR: " + errorMsg);
}
System.err.println("Usage: verifyrep [--starttime=X]" +
- " [--endtime=Y] [--families=A] [--row-prefixes=B] [--delimiter=]
<peerid> <tablename>");
+ " [--endtime=Y] [--families=A] [--row-prefixes=B] [--delimiter=]
[--recomparesleep=] " +
+ "[--verbose] <peerid> <tablename>");
System.err.println();
System.err.println("Options:");
System.err.println(" starttime beginning of the time range");
@@ -440,6 +454,7 @@ public class VerifyReplication extends Configured
implements Tool {
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 ");
System.err.println(" delimiter the delimiter used in display around
rowkey");
+ System.err.println(" verbose logs row keys of good rows");
System.err.println();
System.err.println("Args:");
System.err.println(" peerid Id of the peer used for verification,
must match the one given for replication");