HBASE-18030 Per Cell TTL tags may get duplicated with increments/Append causing tags length overflow.

This commit is contained in:
anoopsamjohn 2017-06-06 12:26:21 +05:30
parent 395d9a08e3
commit 8252fe4fbb
1 changed files with 13 additions and 1 deletions

View File

@ -8155,7 +8155,19 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
// If we are making the array in here, given we are the last thing checked, we'll be only thing // If we are making the array in here, given we are the last thing checked, we'll be only thing
// in the array so set its size to '1' (I saw this being done in earlier version of // in the array so set its size to '1' (I saw this being done in earlier version of
// tag-handling). // tag-handling).
if (tags == null) tags = new ArrayList<Tag>(1); if (tags == null) {
tags = new ArrayList<Tag>(1);
} else {
// Remove existing TTL tags if any
Iterator<Tag> tagsItr = tags.iterator();
while (tagsItr.hasNext()) {
Tag tag = tagsItr.next();
if (tag.getType() == TagType.TTL_TAG_TYPE) {
tagsItr.remove();
break;
}
}
}
tags.add(new Tag(TagType.TTL_TAG_TYPE, Bytes.toBytes(ttl))); tags.add(new Tag(TagType.TTL_TAG_TYPE, Bytes.toBytes(ttl)));
return tags; return tags;
} }