public class TestWALSplit extends Object
WAL splitting code.| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
TestWALSplit.Corruptions |
(package private) class |
TestWALSplit.ZombieLastLogWriterRegionServer
This thread will keep writing to a 'wal' file even after the split process has started.
|
| Modifier and Type | Field and Description |
|---|---|
static HBaseClassTestRule |
CLASS_RULE |
private static org.apache.hadoop.conf.Configuration |
conf |
private org.apache.hadoop.fs.Path |
CORRUPTDIR |
private static int |
ENTRIES |
private static byte[] |
FAMILY |
private static String |
FILENAME_BEING_SPLIT |
private org.apache.hadoop.fs.FileSystem |
fs |
private static String[] |
GROUP |
private static String |
HBASE_SKIP_ERRORS |
private org.apache.hadoop.fs.Path |
HBASEDIR |
private org.apache.hadoop.fs.Path |
HBASELOGDIR |
private static org.slf4j.Logger |
LOG |
org.junit.rules.TestName |
name |
private static int |
NUM_WRITERS |
private org.apache.hadoop.fs.Path |
OLDLOGDIR |
private static byte[] |
QUALIFIER |
private static List<String> |
REGIONS |
private static String |
ROBBER |
private static org.apache.hadoop.hbase.TableName |
TABLE_NAME |
private org.apache.hadoop.fs.Path |
TABLEDIR |
protected static HBaseTestingUtility |
TEST_UTIL |
private String |
TMPDIRNAME |
private static byte[] |
VALUE |
private static String |
WAL_FILE_PREFIX |
private org.apache.hadoop.fs.Path |
WALDIR |
private org.apache.hadoop.hbase.wal.WALFactory |
wals |
private static String |
ZOMBIE |
| Constructor and Description |
|---|
TestWALSplit() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
appendCompactionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w,
org.apache.hadoop.hbase.client.RegionInfo hri,
String[] inputs,
String output) |
static long |
appendEntry(org.apache.hadoop.hbase.wal.WALProvider.Writer writer,
org.apache.hadoop.hbase.TableName table,
byte[] region,
byte[] row,
byte[] family,
byte[] qualifier,
byte[] value,
long seq) |
private static void |
appendRegionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w,
String region) |
private void |
closeOrFlush(boolean close,
org.apache.hadoop.fs.FSDataOutputStream out) |
private void |
corruptWAL(org.apache.hadoop.fs.Path path,
TestWALSplit.Corruptions corruption,
boolean close) |
private int |
countWAL(org.apache.hadoop.fs.Path log) |
private org.apache.hadoop.fs.Path |
createRecoveredEditsPathForRegion() |
private static org.apache.hadoop.hbase.wal.WAL.Entry |
createTestEntry(org.apache.hadoop.hbase.TableName table,
byte[] region,
byte[] row,
byte[] family,
byte[] qualifier,
byte[] value,
long seq) |
private void |
doTestThreading(int numFakeEdits,
int bufferSize,
int writerSlowness)
Sets up a log splitter with a mock reader and writer.
|
private org.apache.hadoop.hbase.wal.WALProvider.Writer |
generateWALs(int leaveOpen) |
private org.apache.hadoop.hbase.wal.WALProvider.Writer |
generateWALs(int writers,
int entries,
int leaveOpen) |
private org.apache.hadoop.hbase.wal.WALProvider.Writer |
generateWALs(int writers,
int entries,
int leaveOpen,
int regionEvents) |
private org.apache.hadoop.fs.Path[] |
getLogForRegion(org.apache.hadoop.hbase.TableName table,
String region) |
private void |
ignoreCorruption(TestWALSplit.Corruptions corruption,
int entryCount,
int expectedCount) |
private void |
injectEmptyFile(String suffix,
boolean closeFile) |
private boolean |
logsAreEqual(org.apache.hadoop.fs.Path p1,
org.apache.hadoop.fs.Path p2) |
private void |
makeRegionDirs(List<String> regions) |
private void |
retryOverHdfsProblem(org.apache.hadoop.fs.FileSystem spiedFs) |
void |
setUp() |
static void |
setUpBeforeClass() |
private int |
splitAndCount(int expectedFiles,
int expectedEntries) |
private Set<String> |
splitCorruptWALs(FaultyProtobufLogReader.FailureType failureType) |
void |
tearDown() |
static void |
tearDownAfterClass() |
void |
testConcurrentSplitLogAndReplayRecoverEdit() |
void |
testCorruptedFileGetsArchivedIfSkipErrors() |
void |
testCorruptedLogFilesSkipErrorsFalseDoesNotTouchLogs() |
void |
testCorruptWALTrailer() |
void |
testEmptyLogFiles() |
private void |
testEmptyLogFiles(boolean close) |
void |
testEmptyOpenLogFiles() |
void |
testEOFisIgnored() |
void |
testFirstLineCorruptionLogFileSkipErrorsPasses() |
void |
testHasRecoveredEdits() |
void |
testIOEOnOutputThread() |
void |
testLogCannotBeWrittenOnceParsed()
Simulates splitting a WAL out from under a regionserver that is still trying to write it.
|
void |
testLogDirectoryShouldBeDeletedAfterSuccessfulSplit() |
void |
testLogsGetArchivedAfterSplit() |
void |
testMiddleGarbageCorruptionSkipErrorsReadsHalfOfFile() |
void |
testMovedWALDuringRecovery() |
void |
testOldRecoveredEditsFileSidelined()
Test old recovered edits file doesn't break WALSplitter.
|
void |
testOpenZeroLengthReportedFileButWithDataGetsSplit() |
void |
testRecoveredEditsPathForMeta() |
void |
testRetryOpenDuringRecovery() |
void |
testSplit() |
void |
testSplitDeletedRegion() |
void |
testSplitLeavesCompactionEventsEdits() |
void |
testSplitLogFileDeletedRegionDir() |
void |
testSplitLogFileEmpty() |
void |
testSplitLogFileFirstLineCorruptionLog() |
void |
testSplitLogFileMultipleRegions() |
void |
testSplitPreservesEdits() |
void |
testSplitRemovesRegionEventsEdits() |
void |
testSplitWillFailIfWritingToRegionFails() |
void |
testTerminationAskedByReporter() |
void |
testThreading()
Test log split process with fake data and lots of edits to trigger threading
issues.
|
void |
testThreadingSlowWriterSmallBuffer()
Test blocking behavior of the log split process if writers are writing slower
than the reader is reading.
|
void |
testTrailingGarbageCorruptionLogFileSkipErrorsFalseThrows() |
void |
testTralingGarbageCorruptionFileSkipErrorsPasses() |
private void |
useDifferentDFSClient() |
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static org.apache.hadoop.conf.Configuration conf
private org.apache.hadoop.fs.FileSystem fs
protected static final HBaseTestingUtility TEST_UTIL
private org.apache.hadoop.fs.Path HBASEDIR
private org.apache.hadoop.fs.Path HBASELOGDIR
private org.apache.hadoop.fs.Path WALDIR
private org.apache.hadoop.fs.Path OLDLOGDIR
private org.apache.hadoop.fs.Path CORRUPTDIR
private org.apache.hadoop.fs.Path TABLEDIR
private String TMPDIRNAME
private static final int NUM_WRITERS
private static final int ENTRIES
private static final String FILENAME_BEING_SPLIT
private static final org.apache.hadoop.hbase.TableName TABLE_NAME
private static final byte[] FAMILY
private static final byte[] QUALIFIER
private static final byte[] VALUE
private static final String WAL_FILE_PREFIX
private static final String HBASE_SKIP_ERRORS
public org.junit.rules.TestName name
private org.apache.hadoop.hbase.wal.WALFactory wals
public TestWALSplit()
public static void setUpBeforeClass() throws Exception
Exceptionpublic static void tearDownAfterClass() throws Exception
Exceptionpublic void testLogCannotBeWrittenOnceParsed() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void testRecoveredEditsPathForMeta() throws IOException
IOExceptionpublic void testOldRecoveredEditsFileSidelined() throws IOException
IOExceptionprivate org.apache.hadoop.fs.Path createRecoveredEditsPathForRegion() throws IOException
IOExceptionpublic void testHasRecoveredEdits() throws IOException
IOExceptionprivate void useDifferentDFSClient() throws IOException
IOExceptionpublic void testSplitPreservesEdits() throws IOException
IOExceptionpublic void testSplitRemovesRegionEventsEdits() throws IOException
IOExceptionpublic void testSplitLeavesCompactionEventsEdits() throws IOException
IOExceptionprivate int splitAndCount(int expectedFiles, int expectedEntries) throws IOException
expectedEntries - -1 to not assertIOExceptionpublic void testEmptyLogFiles() throws IOException
IOExceptionpublic void testEmptyOpenLogFiles() throws IOException
IOExceptionprivate void testEmptyLogFiles(boolean close) throws IOException
IOExceptionpublic void testOpenZeroLengthReportedFileButWithDataGetsSplit() throws IOException
IOExceptionpublic void testTralingGarbageCorruptionFileSkipErrorsPasses() throws IOException
IOExceptionpublic void testFirstLineCorruptionLogFileSkipErrorsPasses() throws IOException
IOExceptionpublic void testMiddleGarbageCorruptionSkipErrorsReadsHalfOfFile() throws IOException
IOExceptionpublic void testCorruptedFileGetsArchivedIfSkipErrors() throws IOException
IOExceptionprivate Set<String> splitCorruptWALs(FaultyProtobufLogReader.FailureType failureType) throws IOException
IOException - if the split process failspublic void testTrailingGarbageCorruptionLogFileSkipErrorsFalseThrows() throws IOException
IOExceptionpublic void testCorruptedLogFilesSkipErrorsFalseDoesNotTouchLogs() throws IOException
IOExceptionprivate void ignoreCorruption(TestWALSplit.Corruptions corruption, int entryCount, int expectedCount) throws IOException
IOExceptionpublic void testEOFisIgnored() throws IOException
IOExceptionpublic void testCorruptWALTrailer() throws IOException
IOExceptionpublic void testLogsGetArchivedAfterSplit() throws IOException
IOExceptionpublic void testSplit() throws IOException
IOExceptionpublic void testLogDirectoryShouldBeDeletedAfterSuccessfulSplit() throws IOException
IOExceptionpublic void testSplitWillFailIfWritingToRegionFails() throws Exception
Exceptionpublic void testSplitDeletedRegion() throws IOException
IOExceptionpublic void testIOEOnOutputThread() throws Exception
Exceptionprivate void retryOverHdfsProblem(org.apache.hadoop.fs.FileSystem spiedFs) throws Exception
spiedFs - should be instrumented for failure.Exceptionpublic void testMovedWALDuringRecovery() throws Exception
Exceptionpublic void testRetryOpenDuringRecovery() throws Exception
Exceptionpublic void testTerminationAskedByReporter() throws IOException, org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException
IOExceptionorg.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileExceptionpublic void testThreading() throws Exception
Exceptionpublic void testThreadingSlowWriterSmallBuffer() throws Exception
Exceptionprivate void doTestThreading(int numFakeEdits, int bufferSize, int writerSlowness) throws Exception
numFakeEdits - number of fake edits to push through pipelinebufferSize - size of in-memory bufferwriterSlowness - writer threads will sleep this many ms per editExceptionpublic void testSplitLogFileDeletedRegionDir() throws IOException
IOExceptionpublic void testSplitLogFileEmpty() throws IOException
IOExceptionpublic void testSplitLogFileMultipleRegions() throws IOException
IOExceptionpublic void testSplitLogFileFirstLineCorruptionLog() throws IOException
IOExceptionpublic void testConcurrentSplitLogAndReplayRecoverEdit() throws IOException
IOExceptionprivate org.apache.hadoop.hbase.wal.WALProvider.Writer generateWALs(int leaveOpen) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.wal.WALProvider.Writer generateWALs(int writers, int entries, int leaveOpen) throws IOException
IOExceptionprivate void makeRegionDirs(List<String> regions) throws IOException
IOExceptionprivate org.apache.hadoop.hbase.wal.WALProvider.Writer generateWALs(int writers, int entries, int leaveOpen, int regionEvents) throws IOException
leaveOpen - index to leave un-closed. -1 to close all.IOExceptionprivate org.apache.hadoop.fs.Path[] getLogForRegion(org.apache.hadoop.hbase.TableName table, String region) throws IOException
IOExceptionprivate void corruptWAL(org.apache.hadoop.fs.Path path, TestWALSplit.Corruptions corruption, boolean close) throws IOException
IOExceptionprivate void closeOrFlush(boolean close, org.apache.hadoop.fs.FSDataOutputStream out) throws IOException
IOExceptionprivate int countWAL(org.apache.hadoop.fs.Path log) throws IOException
IOExceptionprivate static void appendCompactionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w, org.apache.hadoop.hbase.client.RegionInfo hri, String[] inputs, String output) throws IOException
IOExceptionprivate static void appendRegionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w, String region) throws IOException
IOExceptionpublic static long appendEntry(org.apache.hadoop.hbase.wal.WALProvider.Writer writer, org.apache.hadoop.hbase.TableName table, byte[] region, byte[] row, byte[] family, byte[] qualifier, byte[] value, long seq) throws IOException
IOExceptionprivate static org.apache.hadoop.hbase.wal.WAL.Entry createTestEntry(org.apache.hadoop.hbase.TableName table, byte[] region, byte[] row, byte[] family, byte[] qualifier, byte[] value, long seq)
private void injectEmptyFile(String suffix, boolean closeFile) throws IOException
IOExceptionprivate boolean logsAreEqual(org.apache.hadoop.fs.Path p1, org.apache.hadoop.fs.Path p2) throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.