Class AbstractTestFSWAL
java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.AbstractTestFSWAL
- Direct Known Subclasses:
TestAsyncFSWAL
,TestFSHLog
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected static org.apache.hadoop.conf.Configuration
final org.junit.rules.TestName
protected static org.apache.hadoop.fs.Path
protected static org.apache.hadoop.fs.FileSystem
protected static final org.slf4j.Logger
private static final Set<byte[]>
protected static final HBaseTestingUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addEdits
(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.HRegion
createHoldingHRegion
(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 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) protected void
flushRegion
(org.apache.hadoop.hbase.wal.WAL wal, byte[] regionEncodedName, Set<byte[]> flushedFamilyNames) helper method to simulate region flush for a WAL.static long
getEarliestMemStoreSeqNum
(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) void
setUp()
static void
static void
void
void
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.private void
testFindMemStoresEligibleForFlush
(org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<?> wal) void
Test flush for sure has a sequence id that is beyond the last edit appended.void
void
void
void
void
tests the log comparator.void
A loaded WAL coprocessor won't break existing WAL test cases.void
private void
waitNumRolledLogFiles
(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:
IOException
org.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:
InterruptedException
IOException
-
testUnflushedSeqIdTrackingWithAsyncWal
- Throws:
IOException
InterruptedException
-
getEarliestMemStoreSeqNum
public static long getEarliestMemStoreSeqNum(org.apache.hadoop.hbase.wal.WAL wal, byte[] encodedRegionName) -
testMaxFlushedSequenceIdGoBackwards
- Throws:
IOException
InterruptedException
-