Class AbstractTestFSWAL
java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.AbstractTestFSWAL
- Direct Known Subclasses:
TestAsyncFSWAL,TestFSHLog
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.apache.hadoop.conf.Configurationfinal org.junit.rules.TestNameprotected static org.apache.hadoop.fs.Pathprotected static org.apache.hadoop.fs.FileSystemprotected static final org.slf4j.Loggerprivate static final Set<byte[]>protected static final HBaseTestingUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEdits(org.apache.hadoop.hbase.wal.WAL log, org.apache.hadoop.hbase.client.RegionInfo hri, org.apache.hadoop.hbase.client.TableDescriptor htd, int times, org.apache.hadoop.hbase.regionserver.MultiVersionConcurrencyControl mvcc, NavigableMap<byte[], Integer> scopes, String cf) private org.apache.hadoop.hbase.regionserver.HRegioncreateHoldingHRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptor htd, org.apache.hadoop.hbase.wal.WAL wal) private org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?>createHoldingWAL(String testName, AtomicBoolean startHoldingForAppend, CountDownLatch holdAppend) private voiddoPutWithAsyncWAL(ExecutorService exec, org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.client.Put put, Runnable flushOrCloseRegion, AtomicBoolean startHoldingForAppend, CountDownLatch flushOrCloseFinished, CountDownLatch holdAppend) protected voidflushRegion(org.apache.hadoop.hbase.wal.WAL wal, byte[] regionEncodedName, Set<byte[]> flushedFamilyNames) helper method to simulate region flush for a WAL.static longgetEarliestMemStoreSeqNum(org.apache.hadoop.hbase.wal.WAL wal, byte[] encodedRegionName) protected abstract org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?>newSlowWAL(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, String WALDir, String archiveDir, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.hbase.regionserver.wal.WALActionsListener> listeners, boolean failIfWALExists, String prefix, String suffix, Runnable action) protected abstract org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?>newWAL(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, String WALDir, String archiveDir, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.hbase.regionserver.wal.WALActionsListener> listeners, boolean failIfWALExists, String prefix, String suffix) voidsetUp()static voidstatic voidvoidvoidOn rolling a wal after reaching the threshold,WAL.rollWriter()returns the list of regions which should be flushed in order to archive the oldest wal file.private voidtestFindMemStoresEligibleForFlush(org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> wal) voidTest flush for sure has a sequence id that is beyond the last edit appended.voidvoidvoidvoidvoidtests the log comparator.voidA loaded WAL coprocessor won't break existing WAL test cases.voidprivate voidwaitNumRolledLogFiles(org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> wal, int expected)
-
Field Details
-
LOG
-
CONF
-
FS
-
DIR
-
TEST_UTIL
-
currentTest
-
STORES_TO_FLUSH
-
-
Constructor Details
-
AbstractTestFSWAL
public AbstractTestFSWAL()
-
-
Method Details
-
setUp
- Throws:
Exception
-
setUpBeforeClass
- Throws:
Exception
-
tearDownAfterClass
- Throws:
Exception
-
newWAL
protected abstract org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> newWAL(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, String WALDir, String archiveDir, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.hbase.regionserver.wal.WALActionsListener> listeners, boolean failIfWALExists, String prefix, String suffix) throws IOException - Throws:
IOException
-
newSlowWAL
protected abstract org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> newSlowWAL(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, String WALDir, String archiveDir, org.apache.hadoop.conf.Configuration conf, List<org.apache.hadoop.hbase.regionserver.wal.WALActionsListener> listeners, boolean failIfWALExists, String prefix, String suffix, Runnable action) throws IOException - Throws:
IOException
-
testWALCoprocessorLoaded
A loaded WAL coprocessor won't break existing WAL test cases.- Throws:
Exception
-
flushRegion
protected void flushRegion(org.apache.hadoop.hbase.wal.WAL wal, byte[] regionEncodedName, Set<byte[]> flushedFamilyNames) helper method to simulate region flush for a WAL. -
testWALComparator
tests the log comparator. Ensure that we are not mixing meta logs with non-meta logs (throws exception if we do). Comparison is based on the timestamp present in the wal name.- Throws:
Exception
-
waitNumRolledLogFiles
private void waitNumRolledLogFiles(org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> wal, int expected) -
testFindMemStoresEligibleForFlush
private void testFindMemStoresEligibleForFlush(org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> wal) throws IOException - Throws:
IOException
-
testFindMemStoresEligibleForFlush
On rolling a wal after reaching the threshold,WAL.rollWriter()returns the list of regions which should be flushed in order to archive the oldest wal file.This method tests this behavior by inserting edits and rolling the wal enough times to reach the max number of logs threshold. It checks whether we get the "right regions and stores" for flush on rolling the wal.
- Throws:
Exception
-
testFailedToCreateWALIfParentRenamed
public void testFailedToCreateWALIfParentRenamed() throws IOException, org.apache.hadoop.hbase.util.CommonFSUtils.StreamLacksCapabilityException- Throws:
IOExceptionorg.apache.hadoop.hbase.util.CommonFSUtils.StreamLacksCapabilityException
-
testFlushSequenceIdIsGreaterThanAllEditsInHFile
Test flush for sure has a sequence id that is beyond the last edit appended. We do this by slowing appends in the background ring buffer thread while in foreground we call flush. The addition of the sync over HRegion in flush should fix an issue where flush was returning before all of its appends had made it out to the WAL (HBASE-11109).- Throws:
IOException- See Also:
-
testSyncNoAppend
- Throws:
IOException
-
testWriteEntryCanBeNull
- Throws:
IOException
-
testRollWriterForClosedWAL
- Throws:
IOException
-
createHoldingWAL
private org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> createHoldingWAL(String testName, AtomicBoolean startHoldingForAppend, CountDownLatch holdAppend) throws IOException - Throws:
IOException
-
createHoldingHRegion
private org.apache.hadoop.hbase.regionserver.HRegion createHoldingHRegion(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.client.TableDescriptor htd, org.apache.hadoop.hbase.wal.WAL wal) throws IOException - Throws:
IOException
-
doPutWithAsyncWAL
private void doPutWithAsyncWAL(ExecutorService exec, org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.client.Put put, Runnable flushOrCloseRegion, AtomicBoolean startHoldingForAppend, CountDownLatch flushOrCloseFinished, CountDownLatch holdAppend) throws InterruptedException, IOException - Throws:
InterruptedExceptionIOException
-
testUnflushedSeqIdTrackingWithAsyncWal
- Throws:
IOExceptionInterruptedException
-
getEarliestMemStoreSeqNum
public static long getEarliestMemStoreSeqNum(org.apache.hadoop.hbase.wal.WAL wal, byte[] encodedRegionName) -
testMaxFlushedSequenceIdGoBackwards
- Throws:
IOExceptionInterruptedException
-