From 463bc0a8e1e2d2e5fdeedc6d2860f7a2e3b58987 Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Tue, 25 Dec 2018 17:42:38 +0800 Subject: [PATCH] HBASE-21640 Remove the TODO when increment zero --- .../java/org/apache/hadoop/hbase/regionserver/HRegion.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 21458c4..b390d78 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -8036,33 +8036,25 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi for (int i = 0; i < deltas.size(); i++) { Cell delta = deltas.get(i); Cell currentValue = null; - boolean firstWrite = false; if (currentValuesIndex < currentValues.size() && CellUtil.matchingQualifier(currentValues.get(currentValuesIndex), delta)) { currentValue = currentValues.get(currentValuesIndex); if (i < (deltas.size() - 1) && !CellUtil.matchingQualifier(delta, deltas.get(i + 1))) { currentValuesIndex++; } - } else { - firstWrite = true; } // Switch on whether this an increment or an append building the new Cell to apply. Cell newCell = null; MutationType mutationType = null; - boolean apply = true; switch (op) { case INCREMENT: mutationType = MutationType.INCREMENT; - // If delta amount to apply is 0, don't write WAL or MemStore. long deltaAmount = getLongValue(delta); - // TODO: Does zero value mean reset Cell? For example, the ttl. - apply = deltaAmount != 0; final long newValue = currentValue == null ? deltaAmount : getLongValue(currentValue) + deltaAmount; newCell = reckonDelta(delta, currentValue, columnFamily, now, mutation, (oldCell) -> Bytes.toBytes(newValue)); break; case APPEND: mutationType = MutationType.APPEND; - // Always apply Append. TODO: Does empty delta value mean reset Cell? It seems to. newCell = reckonDelta(delta, currentValue, columnFamily, now, mutation, (oldCell) -> ByteBuffer.wrap(new byte[delta.getValueLength() + oldCell.getValueLength()]) .put(oldCell.getValueArray(), oldCell.getValueOffset(), oldCell.getValueLength()) @@ -8078,10 +8070,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi newCell = coprocessorHost.postMutationBeforeWAL(mutationType, mutation, currentValue, newCell); } - // If apply, we need to update memstore/WAL with new value; add it toApply. - if (apply || firstWrite) { - toApply.add(newCell); - } + toApply.add(newCell); // Add to results to get returned to the Client. If null, cilent does not want results. if (results != null) { results.add(newCell); -- 2.7.4