HBASE-16409 Row key for bad row should be properly delimited in VerifyReplication

This commit is contained in:
tedyu 2016-08-20 17:18:27 -07:00
parent b3ca9a9b2f
commit d260108e39
1 changed files with 11 additions and 2 deletions

View File

@ -79,6 +79,7 @@ public class VerifyReplication extends Configured implements Tool {
static int versions = -1;
static String tableName = null;
static String families = null;
static String delimiter = null;
static String peerId = null;
static String rowPrefixes = null;
@ -183,7 +184,8 @@ public class VerifyReplication extends Configured implements Tool {
private void logFailRowAndIncreaseCounter(Context context, Counters counter, Result row) {
context.getCounter(counter).increment(1);
context.getCounter(Counters.BADROWS).increment(1);
LOG.error(counter.toString() + ", rowkey=" + Bytes.toString(row.getRow()));
LOG.error(counter.toString() + ", rowkey=" + delimiter + Bytes.toString(row.getRow()) +
delimiter);
}
@Override
@ -396,6 +398,12 @@ public class VerifyReplication extends Configured implements Tool {
printUsage("Invalid argument '" + cmd + "'");
}
final String delimiterArgKey = "--delimiter=";
if (cmd.startsWith(delimiterArgKey)) {
delimiter = cmd.substring(delimiterArgKey.length());
continue;
}
if (i == args.length-2) {
peerId = cmd;
}
@ -431,7 +439,7 @@ 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] <peerid> <tablename>");
" [--endtime=Y] [--families=A] [--row-prefixes=B] [--delimiter=] <peerid> <tablename>");
System.err.println();
System.err.println("Options:");
System.err.println(" starttime beginning of the time range");
@ -440,6 +448,7 @@ public class VerifyReplication extends Configured implements Tool {
System.err.println(" versions number of cell versions to verify");
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();
System.err.println("Args:");
System.err.println(" peerid Id of the peer used for verification, must match the one given for replication");