HBASE-12449 Use the max timestamp of current or old cell's timestamp in HRegion.append()
This commit is contained in:
parent
d3e7c3cfa9
commit
b97c3daf90
|
@ -5390,9 +5390,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
if (idx < results.size()
|
if (idx < results.size()
|
||||||
&& CellUtil.matchingQualifier(results.get(idx), cell)) {
|
&& CellUtil.matchingQualifier(results.get(idx), cell)) {
|
||||||
oldCell = results.get(idx);
|
oldCell = results.get(idx);
|
||||||
|
long ts = Math.max(now, oldCell.getTimestamp());
|
||||||
// allocate an empty kv once
|
// allocate an empty kv once
|
||||||
newCell = new KeyValue(row.length, cell.getFamilyLength(),
|
newCell = new KeyValue(row.length, cell.getFamilyLength(),
|
||||||
cell.getQualifierLength(), now, KeyValue.Type.Put,
|
cell.getQualifierLength(), ts, KeyValue.Type.Put,
|
||||||
oldCell.getValueLength() + cell.getValueLength(),
|
oldCell.getValueLength() + cell.getValueLength(),
|
||||||
oldCell.getTagsLength() + cell.getTagsLength());
|
oldCell.getTagsLength() + cell.getTagsLength());
|
||||||
// copy in the value
|
// copy in the value
|
||||||
|
@ -5603,8 +5604,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
boolean noWriteBack = (amount == 0);
|
boolean noWriteBack = (amount == 0);
|
||||||
|
|
||||||
Cell c = null;
|
Cell c = null;
|
||||||
|
long ts = now;
|
||||||
if (idx < results.size() && CellUtil.matchingQualifier(results.get(idx), kv)) {
|
if (idx < results.size() && CellUtil.matchingQualifier(results.get(idx), kv)) {
|
||||||
c = results.get(idx);
|
c = results.get(idx);
|
||||||
|
ts = Math.max(now, c.getTimestamp());
|
||||||
if(c.getValueLength() == Bytes.SIZEOF_LONG) {
|
if(c.getValueLength() == Bytes.SIZEOF_LONG) {
|
||||||
amount += Bytes.toLong(c.getValueArray(), c.getValueOffset(), Bytes.SIZEOF_LONG);
|
amount += Bytes.toLong(c.getValueArray(), c.getValueOffset(), Bytes.SIZEOF_LONG);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5620,7 +5623,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver { //
|
||||||
byte[] val = Bytes.toBytes(amount);
|
byte[] val = Bytes.toBytes(amount);
|
||||||
int oldCellTagsLen = (c == null) ? 0 : c.getTagsLength();
|
int oldCellTagsLen = (c == null) ? 0 : c.getTagsLength();
|
||||||
int incCellTagsLen = kv.getTagsLength();
|
int incCellTagsLen = kv.getTagsLength();
|
||||||
Cell newKV = new KeyValue(row.length, family.getKey().length, q.length, now,
|
Cell newKV = new KeyValue(row.length, family.getKey().length, q.length, ts,
|
||||||
KeyValue.Type.Put, val.length, oldCellTagsLen + incCellTagsLen);
|
KeyValue.Type.Put, val.length, oldCellTagsLen + incCellTagsLen);
|
||||||
System.arraycopy(row, 0, newKV.getRowArray(), newKV.getRowOffset(), row.length);
|
System.arraycopy(row, 0, newKV.getRowArray(), newKV.getRowOffset(), row.length);
|
||||||
System.arraycopy(family.getKey(), 0, newKV.getFamilyArray(), newKV.getFamilyOffset(),
|
System.arraycopy(family.getKey(), 0, newKV.getFamilyArray(), newKV.getFamilyOffset(),
|
||||||
|
|
Loading…
Reference in New Issue