HBASE-11706 Set versions for VerifyReplication (cuijianwei)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/59a49f31 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/59a49f31 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/59a49f31 Branch: refs/heads/branch-1 Commit: 59a49f3149413c5655f6a69f4c2d896abe7c160d Parents: 1669bc4 Author: Andrew Purtell <[email protected]> Authored: Fri Aug 8 18:30:47 2014 -0700 Committer: Andrew Purtell <[email protected]> Committed: Fri Aug 8 18:31:12 2014 -0700 ---------------------------------------------------------------------- .../mapreduce/replication/VerifyReplication.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/59a49f31/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 d4ac8f7..7748675 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 @@ -69,6 +69,7 @@ public class VerifyReplication extends Configured implements Tool { public final static String NAME = "verifyrep"; static long startTime = 0; static long endTime = Long.MAX_VALUE; + static int versions = -1; static String tableName = null; static String families = null; static String peerId = null; @@ -109,6 +110,9 @@ public class VerifyReplication extends Configured implements Tool { } } scan.setTimeRange(startTime, endTime); + if (versions >= 0) { + scan.setMaxVersions(versions); + } HConnectionManager.execute(new HConnectable<Void>(conf) { @Override public Void connect(HConnection conn) throws IOException { @@ -208,6 +212,9 @@ public class VerifyReplication extends Configured implements Tool { Scan scan = new Scan(); scan.setTimeRange(startTime, endTime); + if (versions >= 0) { + scan.setMaxVersions(versions); + } if(families != null) { String[] fams = families.split(","); for(String fam : fams) { @@ -250,6 +257,12 @@ public class VerifyReplication extends Configured implements Tool { continue; } + final String versionsArgKey = "--versions="; + if (cmd.startsWith(versionsArgKey)) { + versions = Integer.parseInt(cmd.substring(versionsArgKey.length())); + continue; + } + final String familiesArgKey = "--families="; if (cmd.startsWith(familiesArgKey)) { families = cmd.substring(familiesArgKey.length()); @@ -286,6 +299,7 @@ public class VerifyReplication extends Configured implements Tool { System.err.println(" starttime beginning of the time range"); System.err.println(" without endtime means from starttime to forever"); System.err.println(" endtime end of the time range"); + System.err.println(" versions number of cell versions to verify"); System.err.println(" families comma-separated list of families to copy"); System.err.println(); System.err.println("Args:");
