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
IOExceptionprivate void init(String methodName) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.regionserver.HStore init(String methodName, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor hcd) throws IOException
IOExceptionprivate 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
IOExceptionprivate 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
IOExceptionprivate 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
IOExceptionprivate 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
IOExceptionpublic void testFlushSizeSizing() throws Exception
Exceptionpublic void testStoreBloomFilterMetricsWithBloomRowCol() throws IOException
IOExceptionpublic void testStoreBloomFilterMetricsWithBloomRow() throws IOException
IOExceptionpublic void testStoreBloomFilterMetricsWithBloomRowPrefix() throws IOException
IOExceptionpublic void testStoreBloomFilterMetricsWithBloomNone() throws IOException
IOExceptionprivate void writeAndRead(org.apache.hadoop.hbase.regionserver.BloomType bloomType, int numStoreFiles) throws IOException
IOExceptionpublic void testCreateWriter() throws Exception
Exceptionpublic void testDeleteExpiredStoreFiles() throws Exception
Exceptionpublic void testDeleteExpiredStoreFiles(int minVersions) throws Exception
minVersions - the MIN_VERSIONS for the column familyExceptionpublic void testLowestModificationTime() throws Exception
Exceptionprivate static long getLowestTimeStampFromFS(org.apache.hadoop.fs.FileSystem fs, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> candidates) throws IOException
IOExceptionpublic void testEmptyStoreFile() throws IOException
IOExceptionpublic void testGet_FromMemStoreOnly() throws IOException
IOExceptionpublic void testTimeRangeIfSomeCellsAreDroppedInFlush() throws IOException
IOExceptionprivate void testTimeRangeIfSomeCellsAreDroppedInFlush(int maxVersion) throws IOException
IOExceptionpublic void testGet_FromFilesOnly() throws IOException
IOExceptionpublic void testGet_FromMemStoreAndFiles() throws IOException
IOExceptionprivate void flush(int storeFilessize) throws IOException
IOExceptionprivate void assertCheck()
public static void tearDownAfterClass() throws IOException
IOExceptionpublic void testHandleErrorsInFlush() throws Exception
Exceptionprivate static org.apache.hadoop.hbase.regionserver.StoreFlushContext flushStore(org.apache.hadoop.hbase.regionserver.HStore store, long id) throws IOException
IOExceptionprivate List<org.apache.hadoop.hbase.Cell> getKeyValueSet(long[] timestamps, int numRows, byte[] qualifier, byte[] family)
public void testMultipleTimestamps() throws IOException
IOExceptionpublic void testSplitWithEmptyColFam() throws IOException
IOException - When the IO operations fail.public void testStoreUsesConfigurationFromHcdAndHtd() throws Exception
Exceptionpublic void testStoreUsesSearchEngineOverride() throws Exception
Exceptionprivate void addStoreFile() throws IOException
IOExceptionprivate void archiveStoreFile(int index) throws IOException
IOExceptionprivate void closeCompactedFile(int index) throws IOException
IOExceptionpublic void testRefreshStoreFiles() throws Exception
Exceptionpublic void testRefreshStoreFilesNotChanged() throws IOException
IOExceptionprivate long countMemStoreScanner(org.apache.hadoop.hbase.regionserver.StoreScanner scanner)
public void testNumberOfMemStoreScannersAfterFlush() throws IOException
IOExceptionprivate void testNumberOfMemStoreScannersAfterFlush(List<org.apache.hadoop.hbase.Cell> inputCellsBeforeSnapshot, List<org.apache.hadoop.hbase.Cell> inputCellsAfterSnapshot) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.Cell createCell(byte[] qualifier, long ts, long sequenceId, byte[] value) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.Cell createCell(byte[] row, byte[] qualifier, long ts, long sequenceId, byte[] value) throws IOException
IOExceptionpublic void testFlushBeforeCompletingScanWoFilter() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testFlushBeforeCompletingScanWithFilter() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testFlushBeforeCompletingScanWithFilterHint() throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate void testFlushBeforeCompletingScan(TestHStore.MyListHook hook, org.apache.hadoop.hbase.filter.Filter filter, int expectedSize) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testCreateScannerAndSnapshotConcurrently() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testScanWithDoubleFlush() throws IOException
IOExceptionpublic void testReclaimChunkWhenScaning() throws IOException
IOExceptionpublic void testRunDoubleMemStoreCompactors() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testAge() throws IOException
IOExceptionprivate 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
IOExceptionpublic void testSwitchingPreadtoStreamParallelyWithCompactionDischarger() throws Exception
Exceptionpublic void testMaxPreadBytesConfiguredToBeLessThanZero() throws Exception
Exceptionpublic void testInMemoryCompactionTypeWithLowerCase() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testSpaceQuotaChangeAfterReplacement() throws IOException
IOExceptionpublic void testHFileContextSetWithCFAndTable() throws Exception
Exceptionpublic void testCompactingMemStoreNoCellButDataSizeExceedsInmemoryFlushSize() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testCompactingMemStoreCellExceedInmemoryFlushSize() throws Exception
Exceptionpublic void testCompactingMemStoreWriteLargeCellAndSmallCellConcurrently() throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate void doWriteTestLargeCellAndSmallCellConcurrently(IntBinaryOperator getFlushByteSize) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic 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. TheCompactingMemStoresize exceedsCompactingMemStore.getInmemoryFlushSize(),the write thread adds a newImmutableSegmentto 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.versionreturned 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.versionis still v. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList), and becauseCompactionPipeline.versionis v,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)thinks it is successful and continue flushing,but theImmutableSegmentinCompactionPipelinehas changed becauseCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action),so theImmutableSegmentis 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.versionto v+1. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList), and becauseCompactionPipeline.versionis 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.
Exceptionpublic 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. TheCompactingMemStoresize exceedsCompactingMemStore.getInmemoryFlushSize(),the write thread adds a newImmutableSegmentto 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.versionreturned 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.versionis still v. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList), and becauseCompactionPipeline.versionis v,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)thinks it is successful and continue flushing,but theImmutableSegmentinCompactionPipelinehas changed becauseCompactingMemStore.flattenOneSegment(long, org.apache.hadoop.hbase.regionserver.MemStoreCompactionStrategy.Action),so theImmutableSegmentis 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.versionto v+1. 6. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList), and becauseCompactionPipeline.versionis v+1,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)failed and retry,VersionedSegmentsList.versionreturned fromCompactingMemStore.getImmutableSegments()is v+1. 7. The write thread continues writing toCompactingMemStoreandCompactingMemStoresize exceedsCompactingMemStore.getInmemoryFlushSize(),CompactingMemStore.flushInMemory(MutableSegment)is called and a newImmutableSegmentis added to the head ofCompactingMemStore.pipeline,CompactionPipeline.versionis still v+1. 8. The snapshot thread continuesCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList), and becauseCompactionPipeline.versionis still v+1,CompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList)succeeds.The newImmutableSegmentremained at the head ofCompactingMemStore.pipeline,the old is removed byCompactingMemStore.swapPipelineWithNull(org.apache.hadoop.hbase.regionserver.VersionedSegmentsList).
Exceptionpublic 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 startsDefaultMemStoreflushing after some cells have be added toDefaultMemStore. 2.The flush thread stopping beforeAbstractMemStore.clearSnapshot(long)inHStore#updateStorefilesafter 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 correspondingMemStoreLABImplis 0, theChunks in correspondingMemStoreLABImplare recycled. 5.The scan thread continuesDefaultMemStore.getScanners(long),and create aSegmentScannerfor thisDefaultMemStore.snapshot(), and increase the reference count of the correspondingMemStoreLABImpl, butChunks in correspondingMemStoreLABImplare recycled by step 4, and theseChunks 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.
Exceptionprivate <T> T getTypeKeyValueScanner(org.apache.hadoop.hbase.regionserver.StoreScanner storeScanner, Class<T> keyValueScannerClass)
public void testOnConfigurationChange() throws IOException
IOExceptionpublic void testExtendsDefaultMemStore() throws Exception
Exceptionpublic void testMemoryLeakWhenFlushMemStoreRetrying() throws Exception
Exceptionpublic void testImmutableMemStoreLABRefCnt() throws Exception
RefCnt behaviors in ImmutableMemStoreLABExceptionprivate org.apache.hadoop.hbase.regionserver.HStoreFile mockStoreFileWithLength(long length)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.