You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2011/12/09 23:39:03 UTC

svn commit: r1212671 - in /hbase/trunk/src: docbkx/ops_mgt.xml main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java

Author: larsh
Date: Fri Dec  9 22:39:02 2011
New Revision: 1212671

URL: http://svn.apache.org/viewvc?rev=1212671&view=rev
Log:
HBASE-4998 Support deleted rows in CopyTable

Modified:
    hbase/trunk/src/docbkx/ops_mgt.xml
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java

Modified: hbase/trunk/src/docbkx/ops_mgt.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/src/docbkx/ops_mgt.xml?rev=1212671&r1=1212670&r2=1212671&view=diff
==============================================================================
--- hbase/trunk/src/docbkx/ops_mgt.xml (original)
+++ hbase/trunk/src/docbkx/ops_mgt.xml Fri Dec  9 22:39:02 2011
@@ -91,9 +91,11 @@
           <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>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>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>all.cells</varname>  Also copy delete markers and uncollected deleted cells (advanced option).</listitem>
         </itemizedlist>
          Args:
         <itemizedlist>

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java?rev=1212671&r1=1212670&r2=1212671&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java Fri Dec  9 22:39:02 2011
@@ -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<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("              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;
         }