diff --git hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java index 7988352..31f8b0d 100644 --- hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java +++ hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java @@ -567,8 +567,14 @@ public final class CellUtil { @Override public Cell cloneToCell() { - Cell clonedBaseCell = ((ShareableMemory) this.cell).cloneToCell(); - return new TagRewriteCell(clonedBaseCell, this.tags); + if (cell.getTagsLength() == 0) { + Cell clonedBaseCell = ((ShareableMemory) this.cell).cloneToCell(); + return new TagRewriteCell(clonedBaseCell, this.tags); + } else { + final int size = getSerializedSize(true); + byte[] buf = new byte[size]; + return KeyValueUtil.copyCellTo(this, buf, 0, size); + } } } diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 71cc247..8707081 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -7527,11 +7527,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi Append mutation) throws IOException { // Forward any tags found on the delta. - List tags = TagUtil.carryForwardTags(delta); - long ts = now; Cell newCell = null; byte [] row = mutation.getRow(); if (currentValue != null) { + List tags = TagUtil.carryForwardTags(delta); + long ts = now; tags = TagUtil.carryForwardTags(tags, currentValue); ts = Math.max(now, currentValue.getTimestamp()); tags = TagUtil.carryForwardTTLTag(tags, mutation.getTTL()); @@ -7563,8 +7563,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi // Append's KeyValue.Type==Put and ts==HConstants.LATEST_TIMESTAMP CellUtil.updateLatestStamp(delta, now); newCell = delta; - tags = TagUtil.carryForwardTTLTag(tags, mutation.getTTL()); - if (tags != null) { + if (mutation.getTTL() != Long.MAX_VALUE) { + List tags = TagUtil.carryForwardTags(delta); + tags = TagUtil.carryForwardTTLTag(tags, mutation.getTTL()); newCell = CellUtil.createCell(delta, tags); } }