You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2014/10/26 04:58:35 UTC

git commit: HBASE-2609 Harmonize the Get and Delete operations

Repository: hbase
Updated Branches:
  refs/heads/master 34f996261 -> 1d6c4678b


HBASE-2609 Harmonize the Get and Delete operations


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1d6c4678
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1d6c4678
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1d6c4678

Branch: refs/heads/master
Commit: 1d6c4678bb7964af34fb42a6c8bbf0553880bba3
Parents: 34f9962
Author: stack <st...@apache.org>
Authored: Sat Oct 25 20:58:24 2014 -0700
Committer: stack <st...@apache.org>
Committed: Sat Oct 25 20:58:24 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Delete.java  | 109 +++++++++++++++++--
 1 file changed, 101 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1d6c4678/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
index ad7d89e..ea76d0d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java
@@ -43,15 +43,15 @@ import org.apache.hadoop.hbase.util.Bytes;
  * to delete.  To further define the scope of what to delete, perform
  * additional methods as outlined below.
  * <p>
- * To delete specific families, execute {@link #deleteFamily(byte[]) deleteFamily}
+ * To delete specific families, execute {@link #addFamily(byte[]) deleteFamily}
  * for each family to delete.
  * <p>
  * To delete multiple versions of specific columns, execute
- * {@link #deleteColumns(byte[], byte[]) deleteColumns}
+ * {@link #addColumns(byte[], byte[]) deleteColumns}
  * for each column to delete.
  * <p>
  * To delete specific versions of specific columns, execute
- * {@link #deleteColumn(byte[], byte[], long) deleteColumn}
+ * {@link #addColumn(byte[], byte[], long) deleteColumn}
  * for each column version to delete.
  * <p>
  * Specifying timestamps, deleteFamily and deleteColumns will delete all
@@ -185,8 +185,22 @@ public class Delete extends Mutation implements Comparable<Row> {
    * specified family.
    * @param family family name
    * @return this for invocation chaining
+   * @deprecated Since 1.0.0. Use {@link #addFamily(byte[])}
    */
+  @Deprecated
   public Delete deleteFamily(byte [] family) {
+    return addFamily(family);
+  }
+
+  /**
+   * Delete all versions of all columns of the specified family.
+   * <p>
+   * Overrides previous calls to deleteColumn and deleteColumns for the
+   * specified family.
+   * @param family family name
+   * @return this for invocation chaining
+   */
+  public Delete addFamily(final byte [] family) {
     this.deleteFamily(family, this.ts);
     return this;
   }
@@ -200,9 +214,24 @@ public class Delete extends Mutation implements Comparable<Row> {
    * @param family family name
    * @param timestamp maximum version timestamp
    * @return this for invocation chaining
+   * @deprecated Since 1.0.0. Use {@link #addFamily(byte[], long)}
    */
-  @SuppressWarnings("unchecked")
+  @Deprecated
   public Delete deleteFamily(byte [] family, long timestamp) {
+    return addFamily(family, timestamp);
+  }
+
+  /**
+   * Delete all columns of the specified family with a timestamp less than
+   * or equal to the specified timestamp.
+   * <p>
+   * Overrides previous calls to deleteColumn and deleteColumns for the
+   * specified family.
+   * @param family family name
+   * @param timestamp maximum version timestamp
+   * @return this for invocation chaining
+   */
+  public Delete addFamily(final byte [] family, final long timestamp) {
     if (timestamp < 0) {
       throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
     }
@@ -226,6 +255,19 @@ public class Delete extends Mutation implements Comparable<Row> {
    * @return this for invocation chaining
    */
   public Delete deleteFamilyVersion(byte [] family, long timestamp) {
+    return addFamilyVersion(family, timestamp);
+  }
+
+  /**
+   * Delete all columns of the specified family with a timestamp equal to
+   * the specified timestamp.
+   * @param family family name
+   * @param timestamp version timestamp
+   * @return this for invocation chaining
+   * @deprecated Since hbase-1.0.0. Use {@link #addFamilyVersion(byte[], long)}
+   */
+  @Deprecated
+  public Delete addFamilyVersion(final byte [] family, final long timestamp) {
     List<Cell> list = familyMap.get(family);
     if(list == null) {
       list = new ArrayList<Cell>();
@@ -236,15 +278,26 @@ public class Delete extends Mutation implements Comparable<Row> {
     return this;
   }
 
-
   /**
    * Delete all versions of the specified column.
    * @param family family name
    * @param qualifier column qualifier
    * @return this for invocation chaining
+   * @deprecated Since hbase-1.0.0. Use {@link #addColumns(byte[], byte[])}
    */
+  @Deprecated
   public Delete deleteColumns(byte [] family, byte [] qualifier) {
-    this.deleteColumns(family, qualifier, this.ts);
+    return addColumns(family, qualifier);
+  }
+
+  /**
+   * Delete all versions of the specified column.
+   * @param family family name
+   * @param qualifier column qualifier
+   * @return this for invocation chaining
+   */
+  public Delete addColumns(final byte [] family, final byte [] qualifier) {
+    addColumns(family, qualifier, this.ts);
     return this;
   }
 
@@ -255,9 +308,22 @@ public class Delete extends Mutation implements Comparable<Row> {
    * @param qualifier column qualifier
    * @param timestamp maximum version timestamp
    * @return this for invocation chaining
+   * @deprecated Since hbase-1.0.0. Use {@link #addColumns(byte[], byte[], long)}
    */
-  @SuppressWarnings("unchecked")
+  @Deprecated
   public Delete deleteColumns(byte [] family, byte [] qualifier, long timestamp) {
+    return addColumns(family, qualifier, timestamp);
+  }
+
+  /**
+   * Delete all versions of the specified column with a timestamp less than
+   * or equal to the specified timestamp.
+   * @param family family name
+   * @param qualifier column qualifier
+   * @param timestamp maximum version timestamp
+   * @return this for invocation chaining
+   */
+  public Delete addColumns(final byte [] family, final byte [] qualifier, final long timestamp) {
     if (timestamp < 0) {
       throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
     }
@@ -279,8 +345,23 @@ public class Delete extends Mutation implements Comparable<Row> {
    * @param family family name
    * @param qualifier column qualifier
    * @return this for invocation chaining
+   * @deprecated Since hbase-1.0.0. Use {@link #addColumn(byte[], byte[])}
    */
+  @Deprecated
   public Delete deleteColumn(byte [] family, byte [] qualifier) {
+    return addColumn(family, qualifier);
+  }
+
+  /**
+   * Delete the latest version of the specified column.
+   * This is an expensive call in that on the server-side, it first does a
+   * get to find the latest versions timestamp.  Then it adds a delete using
+   * the fetched cells timestamp.
+   * @param family family name
+   * @param qualifier column qualifier
+   * @return this for invocation chaining
+   */
+  public Delete addColumn(final byte [] family, final byte [] qualifier) {
     this.deleteColumn(family, qualifier, this.ts);
     return this;
   }
@@ -291,9 +372,21 @@ public class Delete extends Mutation implements Comparable<Row> {
    * @param qualifier column qualifier
    * @param timestamp version timestamp
    * @return this for invocation chaining
+   * @deprecated Since hbase-1.0.0. Use {@link #addColumn(byte[], byte[], long)}
    */
-  @SuppressWarnings("unchecked")
+  @Deprecated
   public Delete deleteColumn(byte [] family, byte [] qualifier, long timestamp) {
+    return addColumn(family, qualifier, timestamp);
+  }
+
+  /**
+   * Delete the specified version of the specified column.
+   * @param family family name
+   * @param qualifier column qualifier
+   * @param timestamp version timestamp
+   * @return this for invocation chaining
+   */
+  public Delete addColumn(byte [] family, byte [] qualifier, long timestamp) {
     if (timestamp < 0) {
       throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + timestamp);
     }