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 768da76..4bbc77b 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 @@ -1114,6 +1114,7 @@ public final class ProtobufUtil { List 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( @@ -1176,6 +1177,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( @@ -1966,7 +1968,7 @@ public final class ProtobufUtil { for (Permission.Action a : actions) { builder.addAction(toPermissionAction(a)); } - } + } ret.setNamespacePermission(builder); return ret.build(); } else if (tablePerm.hasTable()) { 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 5ae5ff8..0e819bb 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 @@ -62,6 +62,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); @@ -72,23 +73,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(); }