public class TestHStore extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
TestHStore.CustomDefaultMemStore |
static class |
TestHStore.DummyStoreEngine |
(package private) static class |
TestHStore.FaultyFileSystem
Faulty file system that will fail if you write past its fault position the FIRST TIME only;
thereafter it will succeed.
|
(package private) static class |
TestHStore.FaultyOutputStream |
static class |
TestHStore.MyCompactingMemStore |
static class |
TestHStore.MyCompactingMemStore2 |
static class |
TestHStore.MyCompactingMemStore3 |
static class |
TestHStore.MyCompactingMemStore4 |
static class |
TestHStore.MyCompactingMemStore5 |
static class |
TestHStore.MyCompactingMemStore6 |
static class |
TestHStore.MyCompactingMemStoreWithCustomCompactor |
static class |
TestHStore.MyDefaultMemStore |
(package private) static class |
TestHStore.MyDefaultMemStore1 |
static class |
TestHStore.MyDefaultStoreFlusher |
private static class |
TestHStore.MyList<T> |
(package private) static interface |
TestHStore.MyListHook |
private static class |
TestHStore.MyMemStoreCompactor |
private static class |
TestHStore.MyStore |
private static class |
TestHStore.MyStoreHook |
private static class |
TestHStore.MyThread |
Modifier and Type | Field and Description |
---|---|
private static int |
BLOCKSIZE_SMALL |
static HBaseClassTestRule |
CLASS_RULE |
private static String |
DIR |
(package private) List<org.apache.hadoop.hbase.Cell> |
expected |
(package private) byte[] |
family |
(package private) org.apache.hadoop.hbase.client.Get |
get |
(package private) long |
id |
private static org.slf4j.Logger |
LOG |
org.junit.rules.TestName |
name |
(package private) byte[] |
qf1 |
(package private) byte[] |
qf2 |
(package private) byte[] |
qf3 |
(package private) byte[] |
qf4 |
(package private) byte[] |
qf5 |
(package private) byte[] |
qf6 |
(package private) NavigableSet<byte[]> |
qualifiers |
(package private) org.apache.hadoop.hbase.regionserver.HRegion |
region |
(package private) List<org.apache.hadoop.hbase.Cell> |
result |
(package private) byte[] |
row |
(package private) byte[] |
row2 |
(package private) org.apache.hadoop.hbase.regionserver.HStore |
store |
(package private) byte[] |
table |
private static HBaseTestingUtility |
TEST_UTIL |
Constructor and Description |
---|
TestHStore() |
Modifier and Type | Method and Description |
---|---|
private void |
addStoreFile() |
private void |
archiveStoreFile(int index) |
private void |
assertCheck() |
private void |
closeCompactedFile(int index) |
private long |
countMemStoreScanner(org.apache.hadoop.hbase.regionserver.StoreScanner scanner) |
private org.apache.hadoop.hbase.Cell |
createCell(byte[] row,
byte[] qualifier,
long ts,
long sequenceId,
byte[] value) |
private org.apache.hadoop.hbase.Cell |
createCell(byte[] qualifier,
long ts,
long sequenceId,
byte[] value) |
private void |
doWriteTestLargeCellAndSmallCellConcurrently(IntBinaryOperator getFlushByteSize) |
private void |
flush(int storeFilessize) |
private static org.apache.hadoop.hbase.regionserver.StoreFlushContext |
flushStore(org.apache.hadoop.hbase.regionserver.HStore store,
long id) |
private List<org.apache.hadoop.hbase.Cell> |
getKeyValueSet(long[] timestamps,
int numRows,
byte[] qualifier,
byte[] family)
Generate a list of KeyValues for testing based on given parameters
|
private static long |
getLowestTimeStampFromFS(org.apache.hadoop.fs.FileSystem fs,
Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> candidates) |
private <T> T |
getTypeKeyValueScanner(org.apache.hadoop.hbase.regionserver.StoreScanner storeScanner,
Class<T> keyValueScannerClass) |
private void |
init(String methodName) |
private org.apache.hadoop.hbase.regionserver.HStore |
init(String methodName,
org.apache.hadoop.conf.Configuration conf) |
private org.apache.hadoop.hbase.regionserver.HStore |
init(String methodName,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd) |
private org.apache.hadoop.hbase.regionserver.HStore |
init(String methodName,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.client.TableDescriptorBuilder builder,
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd) |
private org.apache.hadoop.hbase.regionserver.HStore |
init(String methodName,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.client.TableDescriptorBuilder builder,
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd,
TestHStore.MyStoreHook hook) |
private org.apache.hadoop.hbase.regionserver.HStore |
init(String methodName,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.client.TableDescriptorBuilder builder,
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd,
TestHStore.MyStoreHook hook,
boolean switchToPread) |
private void |
initHRegion(String methodName,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.client.TableDescriptorBuilder builder,
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd,
TestHStore.MyStoreHook hook,
boolean switchToPread) |
private TestHStore.MyStore |
initMyStore(String methodName,
org.apache.hadoop.conf.Configuration conf,
TestHStore.MyStoreHook hook) |
private org.apache.hadoop.hbase.regionserver.HStoreFile |
mockStoreFile(long createdTime) |
private org.apache.hadoop.hbase.regionserver.HStoreFile |
mockStoreFileWithLength(long length) |
void |
setUp() |
void |
tearDown() |
static void |
tearDownAfterClass() |
void |
testAge() |
void |
testClearSnapshotGetScannerConcurrently()
This test is for HBASE-26465,
test
AbstractMemStore.clearSnapshot(long) and DefaultMemStore.getScanners(long) execute
concurrently. |
void |
testCompactingMemStoreCellExceedInmemoryFlushSize() |
void |
testCompactingMemStoreNoCellButDataSizeExceedsInmemoryFlushSize() |
void |
testCompactingMemStoreWriteLargeCellAndSmallCellConcurrently() |
void |
testCreateScannerAndSnapshotConcurrently() |
void |
testCreateWriter()
Verify that compression and data block encoding are respected by the createWriter method, used
on store flush.
|
void |
testDeleteExpiredStoreFiles() |
void |
testDeleteExpiredStoreFiles(int minVersions) |
void |
testEmptyStoreFile()
Test for hbase-1686.
|
void |
testExtendsDefaultMemStore()
This test is for HBASE-26476
|
void |
testFlattenAndSnapshotCompactingMemStoreConcurrently()
This test is for HBASE-26384,
test
CompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action) and CompactingMemStore.snapshot()
execute concurrently. |
void |
testFlattenSnapshotWriteCompactingMemeStoreConcurrently()
This test is for HBASE-26384,
test
CompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action) CompactingMemStore.snapshot()
and writeMemStore execute concurrently. |
private void |
testFlushBeforeCompletingScan(TestHStore.MyListHook hook,
org.apache.hadoop.hbase.filter.Filter filter,
int expectedSize) |
void |
testFlushBeforeCompletingScanWithFilter() |
void |
testFlushBeforeCompletingScanWithFilterHint() |
void |
testFlushBeforeCompletingScanWoFilter() |
void |
testFlushSizeSizing()
Test we do not lose data if we fail a flush and then close.
|
void |
testGet_FromFilesOnly()
Getting data from files only
|
void |
testGet_FromMemStoreAndFiles()
Getting data from memstore and files
|
void |
testGet_FromMemStoreOnly()
Getting data from memstore only
|
void |
testHandleErrorsInFlush() |
void |
testHFileContextSetWithCFAndTable() |
void |
testImmutableMemStoreLABRefCnt()
This test is for HBASE-26494, test the
RefCnt behaviors in ImmutableMemStoreLAB |
void |
testInMemoryCompactionTypeWithLowerCase() |
void |
testLowestModificationTime() |
void |
testMaxPreadBytesConfiguredToBeLessThanZero() |
void |
testMemoryLeakWhenFlushMemStoreRetrying()
This test is for HBASE-26488
|
void |
testMultipleTimestamps()
Test to ensure correctness when using Stores with multiple timestamps
|
void |
testNumberOfMemStoreScannersAfterFlush() |
private void |
testNumberOfMemStoreScannersAfterFlush(List<org.apache.hadoop.hbase.Cell> inputCellsBeforeSnapshot,
List<org.apache.hadoop.hbase.Cell> inputCellsAfterSnapshot) |
void |
testOnConfigurationChange() |
void |
testReclaimChunkWhenScaning() |
void |
testRefreshStoreFiles() |
void |
testRefreshStoreFilesNotChanged() |
void |
testRunDoubleMemStoreCompactors()
If there are two running InMemoryFlushRunnable, the later InMemoryFlushRunnable may change the
versionedList.
|
void |
testScanWithDoubleFlush() |
void |
testSpaceQuotaChangeAfterReplacement() |
void |
testSplitWithEmptyColFam()
Test for HBASE-3492 - Test split on empty colfam (no store files).
|
void |
testStoreBloomFilterMetricsWithBloomNone() |
void |
testStoreBloomFilterMetricsWithBloomRow() |
void |
testStoreBloomFilterMetricsWithBloomRowCol() |
void |
testStoreBloomFilterMetricsWithBloomRowPrefix() |
void |
testStoreUsesConfigurationFromHcdAndHtd() |
void |
testStoreUsesSearchEngineOverride() |
void |
testSwitchingPreadtoStreamParallelyWithCompactionDischarger() |
void |
testTimeRangeIfSomeCellsAreDroppedInFlush() |
private void |
testTimeRangeIfSomeCellsAreDroppedInFlush(int maxVersion) |
private void |
writeAndRead(org.apache.hadoop.hbase.regionserver.BloomType bloomType,
int numStoreFiles) |
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
public org.junit.rules.TestName name
org.apache.hadoop.hbase.regionserver.HRegion region
org.apache.hadoop.hbase.regionserver.HStore store
byte[] table
byte[] family
byte[] row
byte[] row2
byte[] qf1
byte[] qf2
byte[] qf3
byte[] qf4
byte[] qf5
byte[] qf6
NavigableSet<byte[]> qualifiers
long id
org.apache.hadoop.hbase.client.Get get
private static final HBaseTestingUtility TEST_UTIL
private static final int BLOCKSIZE_SMALL
public TestHStore()
public void setUp() throws IOException
IOException
private void init(String methodName) throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd) throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptorBuilder builder, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd) throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptorBuilder builder, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd, TestHStore.MyStoreHook hook) throws IOException
IOException
private void initHRegion(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptorBuilder builder, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd, TestHStore.MyStoreHook hook, boolean switchToPread) throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptorBuilder builder, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd, TestHStore.MyStoreHook hook, boolean switchToPread) throws IOException
IOException
public void testFlushSizeSizing() throws Exception
Exception
public void testStoreBloomFilterMetricsWithBloomRowCol() throws IOException
IOException
public void testStoreBloomFilterMetricsWithBloomRow() throws IOException
IOException
public void testStoreBloomFilterMetricsWithBloomRowPrefix() throws IOException
IOException
public void testStoreBloomFilterMetricsWithBloomNone() throws IOException
IOException
private void writeAndRead(org.apache.hadoop.hbase.regionserver.BloomType bloomType, int numStoreFiles) throws IOException
IOException
public void testCreateWriter() throws Exception
Exception
public void testDeleteExpiredStoreFiles() throws Exception
Exception
public void testDeleteExpiredStoreFiles(int minVersions) throws Exception
minVersions
- the MIN_VERSIONS for the column familyException
public void testLowestModificationTime() throws Exception
Exception
private static long getLowestTimeStampFromFS(org.apache.hadoop.fs.FileSystem fs, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> candidates) throws IOException
IOException
public void testEmptyStoreFile() throws IOException
IOException
public void testGet_FromMemStoreOnly() throws IOException
IOException
public void testTimeRangeIfSomeCellsAreDroppedInFlush() throws IOException
IOException
private void testTimeRangeIfSomeCellsAreDroppedInFlush(int maxVersion) throws IOException
IOException
public void testGet_FromFilesOnly() throws IOException
IOException
public void testGet_FromMemStoreAndFiles() throws IOException
IOException
private void flush(int storeFilessize) throws IOException
IOException
private void assertCheck()
public static void tearDownAfterClass() throws IOException
IOException
public void testHandleErrorsInFlush() throws Exception
Exception
private static org.apache.hadoop.hbase.regionserver.StoreFlushContext flushStore(org.apache.hadoop.hbase.regionserver.HStore store, long id) throws IOException
IOException
private List<org.apache.hadoop.hbase.Cell> getKeyValueSet(long[] timestamps, int numRows, byte[] qualifier, byte[] family)
public void testMultipleTimestamps() throws IOException
IOException
public void testSplitWithEmptyColFam() throws IOException
IOException
- When the IO operations fail.public void testStoreUsesConfigurationFromHcdAndHtd() throws Exception
Exception
public void testStoreUsesSearchEngineOverride() throws Exception
Exception
private void addStoreFile() throws IOException
IOException
private void archiveStoreFile(int index) throws IOException
IOException
private void closeCompactedFile(int index) throws IOException
IOException
public void testRefreshStoreFiles() throws Exception
Exception
public void testRefreshStoreFilesNotChanged() throws IOException
IOException
private long countMemStoreScanner(org.apache.hadoop.hbase.regionserver.StoreScanner scanner)
public void testNumberOfMemStoreScannersAfterFlush() throws IOException
IOException
private void testNumberOfMemStoreScannersAfterFlush(List<org.apache.hadoop.hbase.Cell> inputCellsBeforeSnapshot, List<org.apache.hadoop.hbase.Cell> inputCellsAfterSnapshot) throws IOException
IOException
private org.apache.hadoop.hbase.Cell createCell(byte[] qualifier, long ts, long sequenceId, byte[] value) throws IOException
IOException
private org.apache.hadoop.hbase.Cell createCell(byte[] row, byte[] qualifier, long ts, long sequenceId, byte[] value) throws IOException
IOException
public void testFlushBeforeCompletingScanWoFilter() throws IOException, InterruptedException
IOException
InterruptedException
public void testFlushBeforeCompletingScanWithFilter() throws IOException, InterruptedException
IOException
InterruptedException
public void testFlushBeforeCompletingScanWithFilterHint() throws IOException, InterruptedException
IOException
InterruptedException
private void testFlushBeforeCompletingScan(TestHStore.MyListHook hook, org.apache.hadoop.hbase.filter.Filter filter, int expectedSize) throws IOException, InterruptedException
IOException
InterruptedException
public void testCreateScannerAndSnapshotConcurrently() throws IOException, InterruptedException
IOException
InterruptedException
public void testScanWithDoubleFlush() throws IOException
IOException
public void testReclaimChunkWhenScaning() throws IOException
IOException
public void testRunDoubleMemStoreCompactors() throws IOException, InterruptedException
IOException
InterruptedException
public void testAge() throws IOException
IOException
private org.apache.hadoop.hbase.regionserver.HStoreFile mockStoreFile(long createdTime)
private TestHStore.MyStore initMyStore(String methodName, org.apache.hadoop.conf.Configuration conf, TestHStore.MyStoreHook hook) throws IOException
IOException
public void testSwitchingPreadtoStreamParallelyWithCompactionDischarger() throws Exception
Exception
public void testMaxPreadBytesConfiguredToBeLessThanZero() throws Exception
Exception
public void testInMemoryCompactionTypeWithLowerCase() throws IOException, InterruptedException
IOException
InterruptedException
public void testSpaceQuotaChangeAfterReplacement() throws IOException
IOException
public void testHFileContextSetWithCFAndTable() throws Exception
Exception
public void testCompactingMemStoreNoCellButDataSizeExceedsInmemoryFlushSize() throws IOException, InterruptedException
IOException
InterruptedException
public void testCompactingMemStoreCellExceedInmemoryFlushSize() throws Exception
Exception
public void testCompactingMemStoreWriteLargeCellAndSmallCellConcurrently() throws IOException, InterruptedException
IOException
InterruptedException
private void doWriteTestLargeCellAndSmallCellConcurrently(IntBinaryOperator getFlushByteSize) throws IOException, InterruptedException
IOException
InterruptedException
public void testFlattenAndSnapshotCompactingMemStoreConcurrently() throws Exception
This test is for HBASE-26384, testCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
andCompactingMemStore.snapshot()
execute concurrently. The threads sequence before HBASE-26384 is(The bug only exists for branch-2,and I add UTs for both branch-2 and master): 1. TheCompactingMemStore
size exceedsCompactingMemStore.getInmemoryFlushSize()
,the write thread adds a newImmutableSegment
to the head ofCompactingMemStore.pipeline
,and start a in memory compact thread to executeCompactingMemStore.inMemoryCompaction()
. 2. The in memory compact thread starts and then stopping beforeCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
. 3. The snapshot thread startsCompactingMemStore.snapshot()
concurrently,after the snapshot thread executingCompactingMemStore.getImmutableSegments()
,the in memory compact thread continues. AssumingVersionedSegmentsList.version
returned fromCompactingMemStore.getImmutableSegments()
is v. 4. The snapshot thread stopping beforeCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
. 5. The in memory compact thread completesCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,CompactionPipeline.version
is still v. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
, and becauseCompactionPipeline.version
is v,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
thinks it is successful and continue flushing,but theImmutableSegment
inCompactionPipeline
has changed becauseCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,so theImmutableSegment
is not removed in fact and still remaining inCompactionPipeline
. After HBASE-26384, the 5-6 step is changed to following, which is expected behavior: 5. The in memory compact thread completesCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,CompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
changeCompactionPipeline.version
to v+1. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
, and becauseCompactionPipeline.version
is v+1,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
failed and retry the while loop inCompactingMemStore.pushPipelineToSnapshot()
once again, because there is no concurrentCompactingMemStore.inMemoryCompaction()
now,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
succeeds.
Exception
public void testFlattenSnapshotWriteCompactingMemeStoreConcurrently() throws Exception
This test is for HBASE-26384, testCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
CompactingMemStore.snapshot()
and writeMemStore execute concurrently. The threads sequence before HBASE-26384 is(The bug only exists for branch-2,and I add UTs for both branch-2 and master): 1. TheCompactingMemStore
size exceedsCompactingMemStore.getInmemoryFlushSize()
,the write thread adds a newImmutableSegment
to the head ofCompactingMemStore.pipeline
,and start a in memory compact thread to executeCompactingMemStore.inMemoryCompaction()
. 2. The in memory compact thread starts and then stopping beforeCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
. 3. The snapshot thread startsCompactingMemStore.snapshot()
concurrently,after the snapshot thread executingCompactingMemStore.getImmutableSegments()
,the in memory compact thread continues. AssumingVersionedSegmentsList.version
returned fromCompactingMemStore.getImmutableSegments()
is v. 4. The snapshot thread stopping beforeCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
. 5. The in memory compact thread completesCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,CompactionPipeline.version
is still v. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
, and becauseCompactionPipeline.version
is v,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
thinks it is successful and continue flushing,but theImmutableSegment
inCompactionPipeline
has changed becauseCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,so theImmutableSegment
is not removed in fact and still remaining inCompactionPipeline
. After HBASE-26384, the 5-6 step is changed to following, which is expected behavior, and I add step 7-8 to test there is new segment added before retry. 5. The in memory compact thread completesCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
,CompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action)
changeCompactionPipeline.version
to v+1. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
, and becauseCompactionPipeline.version
is v+1,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
failed and retry,VersionedSegmentsList.version
returned fromCompactingMemStore.getImmutableSegments()
is v+1. 7. The write thread continues writing toCompactingMemStore
andCompactingMemStore
size exceedsCompactingMemStore.getInmemoryFlushSize()
,CompactingMemStore.flushInMemory(MutableSegment)
is called and a newImmutableSegment
is added to the head ofCompactingMemStore.pipeline
,CompactionPipeline.version
is still v+1. 8. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
, and becauseCompactionPipeline.version
is still v+1,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
succeeds.The newImmutableSegment
remained at the head ofCompactingMemStore.pipeline
,the old is removed byCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)
.
Exception
public void testClearSnapshotGetScannerConcurrently() throws Exception
This test is for HBASE-26465, testAbstractMemStore.clearSnapshot(long)
andDefaultMemStore.getScanners(long)
execute concurrently. The threads sequence before HBASE-26465 is: 1.The flush thread startsDefaultMemStore
flushing after some cells have be added toDefaultMemStore
. 2.The flush thread stopping beforeAbstractMemStore.clearSnapshot(long)
inHStore#updateStorefiles
after completed flushing memStore to hfile. 3.The scan thread starts and stopping afterDefaultMemStore.getSnapshotSegments()
inDefaultMemStore.getScanners(long)
,here the scan thread gets theDefaultMemStore.snapshot()
which is created by the flush thread. 4.The flush thread continuesAbstractMemStore.clearSnapshot(long)
and closeDefaultMemStore.snapshot()
,because the reference count of the correspondingMemStoreLABImpl
is 0, theChunk
s in correspondingMemStoreLABImpl
are recycled. 5.The scan thread continuesDefaultMemStore.getScanners(long)
,and create aSegmentScanner
for thisDefaultMemStore.snapshot()
, and increase the reference count of the correspondingMemStoreLABImpl
, butChunk
s in correspondingMemStoreLABImpl
are recycled by step 4, and theseChunk
s may be overwritten by other write threads,which may cause serious problem. After HBASE-26465,DefaultMemStore.getScanners(long)
andAbstractMemStore.clearSnapshot(long)
could not execute concurrently.
Exception
private <T> T getTypeKeyValueScanner(org.apache.hadoop.hbase.regionserver.StoreScanner storeScanner, Class<T> keyValueScannerClass)
public void testOnConfigurationChange() throws IOException
IOException
public void testExtendsDefaultMemStore() throws Exception
Exception
public void testMemoryLeakWhenFlushMemStoreRetrying() throws Exception
Exception
public void testImmutableMemStoreLABRefCnt() throws Exception
RefCnt
behaviors in ImmutableMemStoreLAB
Exception
private org.apache.hadoop.hbase.regionserver.HStoreFile mockStoreFileWithLength(long length)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.