HBASE-18515 Introduce Delete.add as a replacement for Delete#addDeleteMarker

Signed-off-by: Chia-Ping Tsai <chia7...@gmail.com>


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

Branch: refs/heads/HBASE-18467
Commit: a7014ce46c15ad5293cc5b124df3463b3c5fa62d
Parents: 5915d73
Author: no_apologies <xyfa...@163.com>
Authored: Mon Aug 7 11:04:31 2017 +0800
Committer: Chia-Ping Tsai <chia7...@gmail.com>
Committed: Mon Aug 7 11:05:23 2017 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Delete.java    | 18 ++++++++++++++----
 .../hadoop/hbase/protobuf/ProtobufUtil.java       |  2 +-
 .../hbase/shaded/protobuf/ProtobufUtil.java       |  2 +-
 .../coprocessor/TestRowProcessorEndpoint.java     |  2 +-
 .../org/apache/hadoop/hbase/mapreduce/Import.java |  4 ++--
 .../apache/hadoop/hbase/mapreduce/WALPlayer.java  |  2 +-
 .../replication/regionserver/ReplicationSink.java |  2 +-
 .../security/visibility/VisibilityController.java |  2 +-
 .../org/apache/hadoop/hbase/wal/WALSplitter.java  |  2 +-
 9 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/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 351d8a6..395c277 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
@@ -151,15 +151,26 @@ public class Delete extends Mutation implements 
Comparable<Row> {
   }
 
   /**
-   * Advanced use only.
-   * Add an existing delete marker to this Delete object.
+   * Advanced use only. Add an existing delete marker to this Delete object.
    * @param kv An existing KeyValue of type "delete".
    * @return this for invocation chaining
    * @throws IOException
+   * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use 
{@link #add(Cell)}
+   *             instead
    */
   @SuppressWarnings("unchecked")
+  @Deprecated
   public Delete addDeleteMarker(Cell kv) throws IOException {
-    // TODO: Deprecate and rename 'add' so it matches how we add KVs to Puts.
+    return this.add(kv);
+  }
+
+  /**
+   * Add an existing delete marker to this Delete object.
+   * @param kv An existing KeyValue of type "delete".
+   * @return this for invocation chaining
+   * @throws IOException
+   */
+  public Delete add(Cell kv) throws IOException {
     if (!CellUtil.isDelete(kv)) {
       throw new IOException("The recently added KeyValue is not of type "
           + "delete. Rowkey: " + Bytes.toStringBinary(this.row));
@@ -178,7 +189,6 @@ public class Delete extends Mutation implements 
Comparable<Row> {
     return this;
   }
 
-
   /**
    * Delete all versions of all columns of the specified family.
    * <p>

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index fcf2c34..01ba0e0 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -579,7 +579,7 @@ public final class ProtobufUtil {
           delete =
             new Delete(cell.getRowArray(), cell.getRowOffset(), 
cell.getRowLength(), timestamp);
         }
-        delete.addDeleteMarker(cell);
+        delete.add(cell);
       }
     } else {
       if (delete == null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
index 542ade9..65e95b6 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java
@@ -730,7 +730,7 @@ public final class ProtobufUtil {
           delete =
             new Delete(cell.getRowArray(), cell.getRowOffset(), 
cell.getRowLength(), timestamp);
         }
-        delete.addDeleteMarker(cell);
+        delete.add(cell);
       }
     } else {
       if (delete == null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRowProcessorEndpoint.java
----------------------------------------------------------------------
diff --git 
a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRowProcessorEndpoint.java
 
b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRowProcessorEndpoint.java
index ed53027..39109f8 100644
--- 
a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRowProcessorEndpoint.java
+++ 
b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRowProcessorEndpoint.java
@@ -548,7 +548,7 @@ public class TestRowProcessorEndpoint {
             KeyValue kvDelete =
                 new KeyValue(rows[i], CellUtil.cloneFamily(kv), 
CellUtil.cloneQualifier(kv), 
                     kv.getTimestamp(), KeyValue.Type.Delete);
-            d.addDeleteMarker(kvDelete);
+            d.add(kvDelete);
             Put p = new Put(rows[1 - i]);
             KeyValue kvAdd =
                 new KeyValue(rows[1 - i], CellUtil.cloneFamily(kv), 
CellUtil.cloneQualifier(kv),

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
index 1bb3d25..b5bb2ec 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
@@ -354,7 +354,7 @@ public class Import extends Configured implements Tool {
          */
         if (CellUtil.isDeleteFamily(kv)) {
           Delete deleteFamily = new Delete(key.get());
-          deleteFamily.addDeleteMarker(kv);
+          deleteFamily.add(kv);
           if (durability != null) {
             deleteFamily.setDurability(durability);
           }
@@ -364,7 +364,7 @@ public class Import extends Configured implements Tool {
           if (delete == null) {
             delete = new Delete(key.get());
           }
-          delete.addDeleteMarker(kv);
+          delete.add(kv);
         } else {
           if (put == null) {
             put = new Put(key.get());

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java
index f077659..b1e655c 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java
@@ -182,7 +182,7 @@ public class WALPlayer extends Configured implements Tool {
                 }
               }
               if (CellUtil.isDelete(cell)) {
-                del.addDeleteMarker(cell);
+                del.add(cell);
               } else {
                 put.add(cell);
               }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
index a3d6d13..620b28b 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSink.java
@@ -191,7 +191,7 @@ public class ReplicationSink {
               addToHashMultiMap(rowMap, table, clusterIds, m);
             }
             if (CellUtil.isDelete(cell)) {
-              ((Delete) m).addDeleteMarker(cell);
+              ((Delete) m).add(cell);
             } else {
               ((Put) m).add(cell);
             }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
index 529ae0b..c6091c3 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
@@ -400,7 +400,7 @@ public class VisibilityController implements 
MasterObserver, RegionObserver,
                 p.add(cell);
               } else if (m instanceof Delete) {
                 Delete d = (Delete) m;
-                d.addDeleteMarker(cell);
+                d.add(cell);
               }
             }
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a7014ce4/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java
index df4c1bd..4a9741a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALSplitter.java
@@ -2376,7 +2376,7 @@ public class WALSplitter {
         }
       }
       if (CellUtil.isDelete(cell)) {
-        ((Delete) m).addDeleteMarker(cell);
+        ((Delete) m).add(cell);
       } else {
         ((Put) m).add(cell);
       }

Reply via email to