You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by an...@apache.org on 2014/09/14 10:42:19 UTC

git commit: HBASE-11971 [0.98] Deprecate KeyValue based APIs in WALEdit.

Repository: hbase
Updated Branches:
  refs/heads/0.98 55a790e34 -> 696f0f883


HBASE-11971 [0.98] Deprecate KeyValue based APIs in WALEdit.


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

Branch: refs/heads/0.98
Commit: 696f0f883143a08a4e6e0ddfaa8abc7488ab1260
Parents: 55a790e
Author: anoopsjohn <an...@gmail.com>
Authored: Sun Sep 14 14:11:49 2014 +0530
Committer: anoopsjohn <an...@gmail.com>
Committed: Sun Sep 14 14:11:49 2014 +0530

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/wal/WALEdit.java  | 36 ++++++++++++++++++--
 1 file changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/696f0f88/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
index fd223a4..d037dac 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
@@ -22,19 +22,19 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.List;
 import java.util.NavigableMap;
 import java.util.TreeMap;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.codec.Codec;
-import org.apache.hadoop.hbase.io.HeapSize;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValueUtil;
+import org.apache.hadoop.hbase.codec.Codec;
+import org.apache.hadoop.hbase.io.HeapSize;
 import org.apache.hadoop.hbase.protobuf.generated.WALProtos.CompactionDescriptor;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ClassSize;
@@ -123,11 +123,27 @@ public class WALEdit implements Writable, HeapSize {
     this.compressionContext = compressionContext;
   }
 
+  /**
+   * Adds a KeyValue to this edit
+   * @param kv
+   * @return this for chained action
+   * @deprecated Use {@link #add(Cell)} instead
+   */
+  @Deprecated
   public WALEdit add(KeyValue kv) {
     this.kvs.add(kv);
     return this;
   }
 
+  /**
+   * Adds a Cell to this edit
+   * @param cell
+   * @return this for chained action
+   */
+  public WALEdit add(Cell cell) {
+    return add(KeyValueUtil.ensureKeyValue(cell));
+  }
+
   public boolean isEmpty() {
     return kvs.isEmpty();
   }
@@ -136,10 +152,24 @@ public class WALEdit implements Writable, HeapSize {
     return kvs.size();
   }
 
+  /**
+   * @return The KeyValues associated with this edit
+   * @deprecated Use {@link #getCells()} instead
+   */
+  @Deprecated
   public ArrayList<KeyValue> getKeyValues() {
     return kvs;
   }
 
+  /**
+   * @return The Cells associated with this edit
+   */
+  public ArrayList<Cell> getCells() {
+    ArrayList<Cell> cells = new ArrayList<Cell>(kvs.size());
+    cells.addAll(kvs);
+    return cells;
+  }
+
   public NavigableMap<byte[], Integer> getAndRemoveScopes() {
     NavigableMap<byte[], Integer> result = scopes;
     scopes = null;