hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject hbase git commit: HBASE-12445 hbase is removing all remaining cells immediately after the cell marked with marker = KeyValue.Type.DeleteColumn via PUT (Hani Nadra)
Date Wed, 12 Nov 2014 23:52:19 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 1f0d96079 -> b25e5bb89


HBASE-12445 hbase is removing all remaining cells immediately after the cell marked with marker
= KeyValue.Type.DeleteColumn via PUT (Hani Nadra)


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

Branch: refs/heads/branch-1
Commit: b25e5bb8909bb81bb69b31b068004726a23db25b
Parents: 1f0d960
Author: Enis Soztutar <enis@apache.org>
Authored: Wed Nov 12 15:50:10 2014 -0800
Committer: Enis Soztutar <enis@apache.org>
Committed: Wed Nov 12 15:50:48 2014 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/protobuf/ProtobufUtil.java       |  4 +++-
 .../hadoop/hbase/client/TestPutWithDelete.java    | 18 ++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b25e5bb8/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 0ed1445..c832cdf 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
@@ -1110,6 +1110,7 @@ public final class ProtobufUtil {
       List<Cell> values = family.getValue();
       if (values != null && values.size() > 0) {
         for (Cell cell: values) {
+          valueBuilder.clear();
           valueBuilder.setQualifier(ByteStringer.wrap(
               cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
           valueBuilder.setValue(ByteStringer.wrap(
@@ -1171,6 +1172,7 @@ public final class ProtobufUtil {
       columnBuilder.clear();
       columnBuilder.setFamily(ByteStringer.wrap(family.getKey()));
       for (Cell cell: family.getValue()) {
+        valueBuilder.clear();
         valueBuilder.setQualifier(ByteStringer.wrap(
             cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
         valueBuilder.setValue(ByteStringer.wrap(
@@ -1965,7 +1967,7 @@ public final class ProtobufUtil {
           for (Permission.Action a : actions) {
             builder.addAction(toPermissionAction(a));
           }
-	}
+        }
         ret.setNamespacePermission(builder);
         return ret.build();
       } else if (tablePerm.hasTable()) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/b25e5bb8/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
index aaf37cb..fa4c6a9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
@@ -60,6 +60,7 @@ public class TestPutWithDelete {
       put.add(family, Bytes.toBytes("A"), Bytes.toBytes("a"));
       put.add(family, Bytes.toBytes("B"), Bytes.toBytes("b"));
       put.add(family, Bytes.toBytes("C"), Bytes.toBytes("c"));
+      put.add(family, Bytes.toBytes("D"), Bytes.toBytes("d"));
       table.put(put);
       // get row back and assert the values
       Get get = new Get(rowKey);
@@ -70,23 +71,28 @@ public class TestPutWithDelete {
           Bytes.toString(result.getValue(family, Bytes.toBytes("B"))).equals("b"));
       assertTrue("Column C value should be c",
           Bytes.toString(result.getValue(family, Bytes.toBytes("C"))).equals("c"));
+      assertTrue("Column D value should be d",
+          Bytes.toString(result.getValue(family, Bytes.toBytes("D"))).equals("d"));
       // put the same row again with C column deleted
       put = new Put(rowKey);
-      put.add(family, Bytes.toBytes("A"), Bytes.toBytes("a"));
-      put.add(family, Bytes.toBytes("B"), Bytes.toBytes("b"));
+      put.add(family, Bytes.toBytes("A"), Bytes.toBytes("a1"));
+      put.add(family, Bytes.toBytes("B"), Bytes.toBytes("b1"));
       KeyValue marker = new KeyValue(rowKey, family, Bytes.toBytes("C"),
           HConstants.LATEST_TIMESTAMP, KeyValue.Type.DeleteColumn);
+      put.add(family, Bytes.toBytes("D"), Bytes.toBytes("d1"));
       put.add(marker);
       table.put(put);
       // get row back and assert the values
       get = new Get(rowKey);
       result = table.get(get);
-      assertTrue("Column A value should be a",
-          Bytes.toString(result.getValue(family, Bytes.toBytes("A"))).equals("a"));
-      assertTrue("Column B value should be b",
-          Bytes.toString(result.getValue(family, Bytes.toBytes("B"))).equals("b"));
+      assertTrue("Column A value should be a1",
+          Bytes.toString(result.getValue(family, Bytes.toBytes("A"))).equals("a1"));
+      assertTrue("Column B value should be b1",
+          Bytes.toString(result.getValue(family, Bytes.toBytes("B"))).equals("b1"));
       assertTrue("Column C should not exist",
           result.getValue(family, Bytes.toBytes("C")) == null);
+      assertTrue("Column D value should be d1",
+          Bytes.toString(result.getValue(family, Bytes.toBytes("D"))).equals("d1"));
     } finally {
       table.close();
     }


Mime
View raw message