HBASE-16194 Should count in MSLAB chunk allocation into heap size change when adding duplicate cells, addendum
This commit is contained in:
parent
0875c35781
commit
356c130702
|
@ -109,8 +109,8 @@ public abstract class AbstractMemStore implements MemStore {
|
||||||
@Override
|
@Override
|
||||||
public long add(Cell cell) {
|
public long add(Cell cell) {
|
||||||
Cell toAdd = maybeCloneWithAllocator(cell);
|
Cell toAdd = maybeCloneWithAllocator(cell);
|
||||||
boolean useMSLAB = (toAdd != cell);
|
boolean mslabUsed = (toAdd != cell);
|
||||||
return internalAdd(toAdd, useMSLAB);
|
return internalAdd(toAdd, mslabUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,8 +157,8 @@ public abstract class AbstractMemStore implements MemStore {
|
||||||
@Override
|
@Override
|
||||||
public long delete(Cell deleteCell) {
|
public long delete(Cell deleteCell) {
|
||||||
Cell toAdd = maybeCloneWithAllocator(deleteCell);
|
Cell toAdd = maybeCloneWithAllocator(deleteCell);
|
||||||
boolean useMSLAB = (toAdd != deleteCell);
|
boolean mslabUsed = (toAdd != deleteCell);
|
||||||
long s = internalAdd(toAdd, useMSLAB);
|
long s = internalAdd(toAdd, mslabUsed);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,11 +390,11 @@ public abstract class AbstractMemStore implements MemStore {
|
||||||
*
|
*
|
||||||
* Callers should ensure they already have the read lock taken
|
* Callers should ensure they already have the read lock taken
|
||||||
* @param toAdd the cell to add
|
* @param toAdd the cell to add
|
||||||
* @param useMSLAB whether using MSLAB
|
* @param mslabUsed whether using MSLAB
|
||||||
* @return the heap size change in bytes
|
* @return the heap size change in bytes
|
||||||
*/
|
*/
|
||||||
private long internalAdd(final Cell toAdd, final boolean useMSLAB) {
|
private long internalAdd(final Cell toAdd, final boolean mslabUsed) {
|
||||||
long s = active.add(toAdd, useMSLAB);
|
long s = active.add(toAdd, mslabUsed);
|
||||||
setOldestEditTimeToNow();
|
setOldestEditTimeToNow();
|
||||||
checkActiveSize();
|
checkActiveSize();
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -197,8 +197,8 @@ class MemStoreCompactor {
|
||||||
// The scanner is doing all the elimination logic
|
// The scanner is doing all the elimination logic
|
||||||
// now we just copy it to the new segment
|
// now we just copy it to the new segment
|
||||||
Cell newKV = result.maybeCloneWithAllocator(c);
|
Cell newKV = result.maybeCloneWithAllocator(c);
|
||||||
boolean useMSLAB = (newKV != c);
|
boolean mslabUsed = (newKV != c);
|
||||||
result.internalAdd(newKV, useMSLAB);
|
result.internalAdd(newKV, mslabUsed);
|
||||||
|
|
||||||
}
|
}
|
||||||
kvs.clear();
|
kvs.clear();
|
||||||
|
|
|
@ -36,11 +36,11 @@ public class MutableSegment extends Segment {
|
||||||
/**
|
/**
|
||||||
* Adds the given cell into the segment
|
* Adds the given cell into the segment
|
||||||
* @param cell the cell to add
|
* @param cell the cell to add
|
||||||
* @param useMSLAB whether using MSLAB
|
* @param mslabUsed whether using MSLAB
|
||||||
* @return the change in the heap size
|
* @return the change in the heap size
|
||||||
*/
|
*/
|
||||||
public long add(Cell cell, boolean useMSLAB) {
|
public long add(Cell cell, boolean mslabUsed) {
|
||||||
return internalAdd(cell, useMSLAB);
|
return internalAdd(cell, mslabUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -250,13 +250,13 @@ public abstract class Segment {
|
||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long internalAdd(Cell cell, boolean useMSLAB) {
|
protected long internalAdd(Cell cell, boolean mslabUsed) {
|
||||||
boolean succ = getCellSet().add(cell);
|
boolean succ = getCellSet().add(cell);
|
||||||
long s = AbstractMemStore.heapSizeChange(cell, succ);
|
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
|
// 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
|
// MSLAB allocation size as well, or else there will be memory leak (occupied heap size larger
|
||||||
// than the counted number)
|
// than the counted number)
|
||||||
if (!succ && useMSLAB) {
|
if (!succ && mslabUsed) {
|
||||||
s += getCellLength(cell);
|
s += getCellLength(cell);
|
||||||
}
|
}
|
||||||
updateMetaInfo(cell, s);
|
updateMetaInfo(cell, s);
|
||||||
|
|
Loading…
Reference in New Issue