HBASE-4998 Support deleted rows in CopyTable
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1212671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1bed70fd99
commit
3e608b3979
|
@ -91,9 +91,11 @@
|
||||||
<listitem><varname>rs.impl</varname> hbase.regionserver.impl of the peer cluster. </listitem>
|
<listitem><varname>rs.impl</varname> hbase.regionserver.impl of the peer cluster. </listitem>
|
||||||
<listitem><varname>starttime</varname> Beginning of the time range. Without endtime means starttime to forever.</listitem>
|
<listitem><varname>starttime</varname> Beginning of the time range. Without endtime means starttime to forever.</listitem>
|
||||||
<listitem><varname>endtime</varname> End of the time range. Without endtime means starttime to forever.</listitem>
|
<listitem><varname>endtime</varname> End of the time range. Without endtime means starttime to forever.</listitem>
|
||||||
|
<listitem><varname>versions</varname> Number of cell versions to copy.</listitem>
|
||||||
<listitem><varname>new.name</varname> New table's name.</listitem>
|
<listitem><varname>new.name</varname> New table's name.</listitem>
|
||||||
<listitem><varname>peer.adr</varname> Address of the peer cluster given in the format hbase.zookeeper.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent</listitem>
|
<listitem><varname>peer.adr</varname> Address of the peer cluster given in the format hbase.zookeeper.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent</listitem>
|
||||||
<listitem><varname>families</varname> Comma-separated list of ColumnFamilies to copy.</listitem>
|
<listitem><varname>families</varname> Comma-separated list of ColumnFamilies to copy.</listitem>
|
||||||
|
<listitem><varname>all.cells</varname> Also copy delete markers and uncollected deleted cells (advanced option).</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
Args:
|
Args:
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
|
|
@ -42,10 +42,12 @@ public class CopyTable {
|
||||||
static String rsImpl = null;
|
static String rsImpl = null;
|
||||||
static long startTime = 0;
|
static long startTime = 0;
|
||||||
static long endTime = 0;
|
static long endTime = 0;
|
||||||
|
static int versions = -1;
|
||||||
static String tableName = null;
|
static String tableName = null;
|
||||||
static String newTableName = null;
|
static String newTableName = null;
|
||||||
static String peerAddress = null;
|
static String peerAddress = null;
|
||||||
static String families = null;
|
static String families = null;
|
||||||
|
static boolean allCells = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the actual job.
|
* Sets up the actual job.
|
||||||
|
@ -67,6 +69,12 @@ public class CopyTable {
|
||||||
scan.setTimeRange(startTime,
|
scan.setTimeRange(startTime,
|
||||||
endTime == 0 ? HConstants.LATEST_TIMESTAMP : endTime);
|
endTime == 0 ? HConstants.LATEST_TIMESTAMP : endTime);
|
||||||
}
|
}
|
||||||
|
if (allCells) {
|
||||||
|
scan.setRaw(true);
|
||||||
|
}
|
||||||
|
if (versions >= 0) {
|
||||||
|
scan.setMaxVersions(versions);
|
||||||
|
}
|
||||||
if(families != null) {
|
if(families != null) {
|
||||||
String[] fams = families.split(",");
|
String[] fams = families.split(",");
|
||||||
Map<String,String> cfRenameMap = new HashMap<String,String>();
|
Map<String,String> cfRenameMap = new HashMap<String,String>();
|
||||||
|
@ -113,12 +121,14 @@ public class CopyTable {
|
||||||
System.err.println(" starttime beginning of the time range");
|
System.err.println(" starttime beginning of the time range");
|
||||||
System.err.println(" without endtime means from starttime to forever");
|
System.err.println(" without endtime means from starttime to forever");
|
||||||
System.err.println(" endtime end of the time range");
|
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(" new.name new table's name");
|
||||||
System.err.println(" peer.adr Address of the peer cluster given in the format");
|
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(" hbase.zookeeer.quorum:hbase.zookeeper.client.port:zookeeper.znode.parent");
|
||||||
System.err.println(" families comma-separated list of families to copy");
|
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 copy from cf1 to cf2, give sourceCfName:destCfName. ");
|
||||||
System.err.println(" To keep the same name, just give \"cfName\"");
|
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();
|
||||||
System.err.println("Args:");
|
System.err.println("Args:");
|
||||||
System.err.println(" tablename Name of the table to copy");
|
System.err.println(" tablename Name of the table to copy");
|
||||||
|
@ -170,6 +180,12 @@ public class CopyTable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String versionsArgKey = "--versions=";
|
||||||
|
if (cmd.startsWith(versionsArgKey)) {
|
||||||
|
versions = Integer.parseInt(cmd.substring(versionsArgKey.length()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final String newNameArgKey = "--new.name=";
|
final String newNameArgKey = "--new.name=";
|
||||||
if (cmd.startsWith(newNameArgKey)) {
|
if (cmd.startsWith(newNameArgKey)) {
|
||||||
newTableName = cmd.substring(newNameArgKey.length());
|
newTableName = cmd.substring(newNameArgKey.length());
|
||||||
|
@ -188,6 +204,11 @@ public class CopyTable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd.startsWith("--all.cells")) {
|
||||||
|
allCells = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (i == args.length-1) {
|
if (i == args.length-1) {
|
||||||
tableName = cmd;
|
tableName = cmd;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue