HBASE-16164 Missing close of new compacted segments in few occasions which might leak MSLAB chunks from pool.

This commit is contained in:
anoopsjohn 2016-07-02 11:42:08 +05:30
parent 561eb82968
commit 97f2294bfd
3 changed files with 15 additions and 7 deletions

View File

@ -203,8 +203,9 @@ public class CompactingMemStore extends AbstractMemStore {
this.inMemoryFlushInProgress.set(inMemoryFlushInProgress);
}
public void swapCompactedSegments(VersionedSegmentsList versionedList, ImmutableSegment result) {
pipeline.swap(versionedList, result);
public boolean swapCompactedSegments(VersionedSegmentsList versionedList,
ImmutableSegment result) {
return pipeline.swap(versionedList, result);
}
public boolean hasCompactibleSegments() {

View File

@ -86,7 +86,7 @@ public class CompactionPipeline {
* @return true iff swapped tail with new compacted segment
*/
public boolean swap(VersionedSegmentsList versionedList, ImmutableSegment segment) {
if(versionedList.getVersion() != version) {
if (versionedList.getVersion() != version) {
return false;
}
LinkedList<ImmutableSegment> suffix;
@ -103,7 +103,7 @@ public class CompactionPipeline {
}
swapSuffix(suffix,segment);
}
if(region != null) {
if (region != null) {
// update the global memstore size counter
long suffixSize = CompactingMemStore.getSegmentsSize(suffix);
long newSize = CompactingMemStore.getSegmentSize(segment);

View File

@ -135,9 +135,16 @@ class MemStoreCompactor {
// Phase II: swap the old compaction pipeline
if (!isInterrupted.get()) {
compactingMemStore.swapCompactedSegments(versionedList, result);
// update the wal so it can be truncated and not get too long
compactingMemStore.updateLowestUnflushedSequenceIdInWAL(true); // only if greater
if (compactingMemStore.swapCompactedSegments(versionedList, result)) {
// update the wal so it can be truncated and not get too long
compactingMemStore.updateLowestUnflushedSequenceIdInWAL(true); // only if greater
} else {
// We just ignored the Segment 'result' and swap did not happen.
result.close();
}
} else {
// We just ignore the Segment 'result'.
result.close();
}
} catch (Exception e) {
LOG.debug("Interrupting the MemStore in-memory compaction for store " + compactingMemStore