From 356c1307021e931e871307077f71aab79dc43def Mon Sep 17 00:00:00 2001 From: Yu Li Date: Mon, 11 Jul 2016 22:43:26 +0800 Subject: [PATCH] HBASE-16194 Should count in MSLAB chunk allocation into heap size change when adding duplicate cells, addendum --- .../hbase/regionserver/AbstractMemStore.java | 14 +++++++------- .../hbase/regionserver/MemStoreCompactor.java | 4 ++-- .../hadoop/hbase/regionserver/MutableSegment.java | 8 ++++---- .../apache/hadoop/hbase/regionserver/Segment.java | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java index 79e95af0fde..2b9910f5898 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/AbstractMemStore.java @@ -109,8 +109,8 @@ public abstract class AbstractMemStore implements MemStore { @Override public long add(Cell cell) { Cell toAdd = maybeCloneWithAllocator(cell); - boolean useMSLAB = (toAdd != cell); - return internalAdd(toAdd, useMSLAB); + boolean mslabUsed = (toAdd != cell); + return internalAdd(toAdd, mslabUsed); } /** @@ -157,8 +157,8 @@ public abstract class AbstractMemStore implements MemStore { @Override public long delete(Cell deleteCell) { Cell toAdd = maybeCloneWithAllocator(deleteCell); - boolean useMSLAB = (toAdd != deleteCell); - long s = internalAdd(toAdd, useMSLAB); + boolean mslabUsed = (toAdd != deleteCell); + long s = internalAdd(toAdd, mslabUsed); return s; } @@ -390,11 +390,11 @@ public abstract class AbstractMemStore implements MemStore { * * Callers should ensure they already have the read lock taken * @param toAdd the cell to add - * @param useMSLAB whether using MSLAB + * @param mslabUsed whether using MSLAB * @return the heap size change in bytes */ - private long internalAdd(final Cell toAdd, final boolean useMSLAB) { - long s = active.add(toAdd, useMSLAB); + private long internalAdd(final Cell toAdd, final boolean mslabUsed) { + long s = active.add(toAdd, mslabUsed); setOldestEditTimeToNow(); checkActiveSize(); return s; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.java index 23f792bd170..042de0a4f6d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreCompactor.java @@ -197,8 +197,8 @@ class MemStoreCompactor { // The scanner is doing all the elimination logic // now we just copy it to the new segment Cell newKV = result.maybeCloneWithAllocator(c); - boolean useMSLAB = (newKV != c); - result.internalAdd(newKV, useMSLAB); + boolean mslabUsed = (newKV != c); + result.internalAdd(newKV, mslabUsed); } kvs.clear(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java index 6e54060b50a..e62249ae85a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MutableSegment.java @@ -36,11 +36,11 @@ public class MutableSegment extends Segment { /** * Adds the given cell into the segment * @param cell the cell to add - * @param useMSLAB whether using MSLAB + * @param mslabUsed whether using MSLAB * @return the change in the heap size */ - public long add(Cell cell, boolean useMSLAB) { - return internalAdd(cell, useMSLAB); + public long add(Cell cell, boolean mslabUsed) { + return internalAdd(cell, mslabUsed); } /** @@ -91,4 +91,4 @@ public class MutableSegment extends Segment { tagsPresent = true; } } -} \ No newline at end of file +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java index adb101efffb..33c3bfb6f3d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Segment.java @@ -250,13 +250,13 @@ public abstract class Segment { return comparator; } - protected long internalAdd(Cell cell, boolean useMSLAB) { + protected long internalAdd(Cell cell, boolean mslabUsed) { boolean succ = getCellSet().add(cell); long s = AbstractMemStore.heapSizeChange(cell, succ); // If there's already a same cell in the CellSet and we are using MSLAB, we must count in the // MSLAB allocation size as well, or else there will be memory leak (occupied heap size larger // than the counted number) - if (!succ && useMSLAB) { + if (!succ && mslabUsed) { s += getCellLength(cell); } updateMetaInfo(cell, s); @@ -309,4 +309,4 @@ public abstract class Segment { res += "Min ts "+getMinTimestamp()+"; "; return res; } -} \ No newline at end of file +}