From 22b465ea1c071e6b2fc3a2799780b5531fd87c39 Mon Sep 17 00:00:00 2001 From: anoopsamjohn Date: Fri, 1 Nov 2013 10:23:52 +0000 Subject: [PATCH] HBASE-9871 PB issue : Increment attributes are not getting passed to server git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1537884 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/protobuf/ProtobufUtil.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 91404ada7df..d360a92f7ff 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 @@ -717,6 +717,9 @@ public final class ProtobufUtil { increment.setTimeRange(minStamp, maxStamp); } increment.setDurability(toDurability(proto.getDurability())); + for (NameBytesPair attribute : proto.getAttributeList()) { + increment.setAttribute(attribute.getName(), attribute.getValue().toByteArray()); + } return increment; } @@ -959,7 +962,7 @@ public final class ProtobufUtil { } ColumnValue.Builder columnBuilder = ColumnValue.newBuilder(); QualifierValue.Builder valueBuilder = QualifierValue.newBuilder(); - for (Map.Entry> family: increment.getFamilyCellMap().entrySet()) { + for (Map.Entry> family: increment.getFamilyCellMap().entrySet()) { columnBuilder.setFamily(ZeroCopyLiteralByteString.wrap(family.getKey())); columnBuilder.clearQualifierValue(); List values = family.getValue(); @@ -973,6 +976,15 @@ public final class ProtobufUtil { } builder.addColumnValue(columnBuilder.build()); } + Map attributes = increment.getAttributesMap(); + if (!attributes.isEmpty()) { + NameBytesPair.Builder attributeBuilder = NameBytesPair.newBuilder(); + for (Map.Entry attribute : attributes.entrySet()) { + attributeBuilder.setName(attribute.getKey()); + attributeBuilder.setValue(ZeroCopyLiteralByteString.wrap(attribute.getValue())); + builder.addAttribute(attributeBuilder.build()); + } + } return builder.build(); }