diff --git a/src/docbkx/ops_mgt.xml b/src/docbkx/ops_mgt.xml index b1fcac44b34..f93c9f20cfb 100644 --- a/src/docbkx/ops_mgt.xml +++ b/src/docbkx/ops_mgt.xml @@ -91,9 +91,11 @@ rs.impl hbase.regionserver.impl of the peer cluster. starttime Beginning of the time range. Without endtime means starttime to forever. endtime End of the time range. Without endtime means starttime to forever. + versions Number of cell versions to copy. new.name New table's name. peer.adr Address of the peer cluster given in the format hbase.zookeeper.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent families Comma-separated list of ColumnFamilies to copy. + all.cells Also copy delete markers and uncollected deleted cells (advanced option). Args: diff --git a/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java b/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java index 86066f77652..9e346787b4d 100644 --- a/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java +++ b/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java @@ -42,10 +42,12 @@ public class CopyTable { static String rsImpl = null; static long startTime = 0; static long endTime = 0; + static int versions = -1; static String tableName = null; static String newTableName = null; static String peerAddress = null; static String families = null; + static boolean allCells = false; /** * Sets up the actual job. @@ -67,6 +69,12 @@ public class CopyTable { scan.setTimeRange(startTime, endTime == 0 ? HConstants.LATEST_TIMESTAMP : endTime); } + if (allCells) { + scan.setRaw(true); + } + if (versions >= 0) { + scan.setMaxVersions(versions); + } if(families != null) { String[] fams = families.split(","); Map cfRenameMap = new HashMap(); @@ -113,12 +121,14 @@ public class CopyTable { 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 copy"); System.err.println(" new.name new table's name"); System.err.println(" peer.adr Address of the peer cluster given in the format"); System.err.println(" hbase.zookeeer.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent"); System.err.println(" families comma-separated list of families to copy"); System.err.println(" To copy from cf1 to cf2, give sourceCfName:destCfName. "); System.err.println(" To keep the same name, just give \"cfName\""); + System.err.println(" all.cells also copy delete markers and deleted cells"); System.err.println(); System.err.println("Args:"); System.err.println(" tablename Name of the table to copy"); @@ -170,6 +180,12 @@ public class CopyTable { continue; } + final String versionsArgKey = "--versions="; + if (cmd.startsWith(versionsArgKey)) { + versions = Integer.parseInt(cmd.substring(versionsArgKey.length())); + continue; + } + final String newNameArgKey = "--new.name="; if (cmd.startsWith(newNameArgKey)) { newTableName = cmd.substring(newNameArgKey.length()); @@ -188,6 +204,11 @@ public class CopyTable { continue; } + if (cmd.startsWith("--all.cells")) { + allCells = true; + continue; + } + if (i == args.length-1) { tableName = cmd; }