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
This commit is contained in:
anoopsamjohn 2013-11-01 10:23:52 +00:00
parent dcf61670d4
commit 22b465ea1c
1 changed files with 13 additions and 1 deletions

View File

@ -717,6 +717,9 @@ public final class ProtobufUtil {
increment.setTimeRange(minStamp, maxStamp); increment.setTimeRange(minStamp, maxStamp);
} }
increment.setDurability(toDurability(proto.getDurability())); increment.setDurability(toDurability(proto.getDurability()));
for (NameBytesPair attribute : proto.getAttributeList()) {
increment.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
}
return increment; return increment;
} }
@ -959,7 +962,7 @@ public final class ProtobufUtil {
} }
ColumnValue.Builder columnBuilder = ColumnValue.newBuilder(); ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
QualifierValue.Builder valueBuilder = QualifierValue.newBuilder(); QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
for (Map.Entry<byte[], List<Cell>> family: increment.getFamilyCellMap().entrySet()) { for (Map.Entry<byte[], List<Cell>> family: increment.getFamilyCellMap().entrySet()) {
columnBuilder.setFamily(ZeroCopyLiteralByteString.wrap(family.getKey())); columnBuilder.setFamily(ZeroCopyLiteralByteString.wrap(family.getKey()));
columnBuilder.clearQualifierValue(); columnBuilder.clearQualifierValue();
List<Cell> values = family.getValue(); List<Cell> values = family.getValue();
@ -973,6 +976,15 @@ public final class ProtobufUtil {
} }
builder.addColumnValue(columnBuilder.build()); builder.addColumnValue(columnBuilder.build());
} }
Map<String, byte[]> attributes = increment.getAttributesMap();
if (!attributes.isEmpty()) {
NameBytesPair.Builder attributeBuilder = NameBytesPair.newBuilder();
for (Map.Entry<String, byte[]> attribute : attributes.entrySet()) {
attributeBuilder.setName(attribute.getKey());
attributeBuilder.setValue(ZeroCopyLiteralByteString.wrap(attribute.getValue()));
builder.addAttribute(attributeBuilder.build());
}
}
return builder.build(); return builder.build();
} }