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 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()
Test hasRecoveredEdits correctly identifies proper recovered edits file on related dir.
|
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 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
Exception
public static void tearDownAfterClass() throws Exception
Exception
public void testLogCannotBeWrittenOnceParsed() throws IOException, InterruptedException
IOException
InterruptedException
public void testRecoveredEditsPathForMeta() throws IOException
IOException
public void testOldRecoveredEditsFileSidelined() throws IOException
IOException
private org.apache.hadoop.fs.Path createRecoveredEditsPathForRegion() throws IOException
IOException
public void testHasRecoveredEdits() throws IOException
IOException
- on any issues found while creating test required files/directories.private void useDifferentDFSClient() throws IOException
IOException
public void testSplitPreservesEdits() throws IOException
IOException
public void testSplitRemovesRegionEventsEdits() throws IOException
IOException
public void testSplitLeavesCompactionEventsEdits() throws IOException
IOException
private int splitAndCount(int expectedFiles, int expectedEntries) throws IOException
expectedEntries
- -1 to not assertIOException
public void testEmptyLogFiles() throws IOException
IOException
public void testEmptyOpenLogFiles() throws IOException
IOException
private void testEmptyLogFiles(boolean close) throws IOException
IOException
public void testOpenZeroLengthReportedFileButWithDataGetsSplit() throws IOException
IOException
public void testTralingGarbageCorruptionFileSkipErrorsPasses() throws IOException
IOException
public void testFirstLineCorruptionLogFileSkipErrorsPasses() throws IOException
IOException
public void testMiddleGarbageCorruptionSkipErrorsReadsHalfOfFile() throws IOException
IOException
public void testCorruptedFileGetsArchivedIfSkipErrors() throws IOException
IOException
private Set<String> splitCorruptWALs(FaultyProtobufLogReader.FailureType failureType) throws IOException
IOException
- if the split process failspublic void testTrailingGarbageCorruptionLogFileSkipErrorsFalseThrows() throws IOException
IOException
public void testCorruptedLogFilesSkipErrorsFalseDoesNotTouchLogs() throws IOException
IOException
private void ignoreCorruption(TestWALSplit.Corruptions corruption, int entryCount, int expectedCount) throws IOException
IOException
public void testEOFisIgnored() throws IOException
IOException
public void testCorruptWALTrailer() throws IOException
IOException
public void testLogsGetArchivedAfterSplit() throws IOException
IOException
public void testSplit() throws IOException
IOException
public void testLogDirectoryShouldBeDeletedAfterSuccessfulSplit() throws IOException
IOException
public void testSplitWillFailIfWritingToRegionFails() throws Exception
Exception
public void testSplitDeletedRegion() throws IOException
IOException
public void testIOEOnOutputThread() throws Exception
Exception
private void retryOverHdfsProblem(org.apache.hadoop.fs.FileSystem spiedFs) throws Exception
spiedFs
- should be instrumented for failure.Exception
public void testMovedWALDuringRecovery() throws Exception
Exception
public void testRetryOpenDuringRecovery() throws Exception
Exception
public void testTerminationAskedByReporter() throws IOException, org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException
IOException
org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException
public void testThreading() throws Exception
Exception
public void testThreadingSlowWriterSmallBuffer() throws Exception
Exception
private 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 editException
public void testSplitLogFileDeletedRegionDir() throws IOException
IOException
public void testSplitLogFileEmpty() throws IOException
IOException
public void testSplitLogFileMultipleRegions() throws IOException
IOException
public void testSplitLogFileFirstLineCorruptionLog() throws IOException
IOException
public void testConcurrentSplitLogAndReplayRecoverEdit() throws IOException
IOException
private org.apache.hadoop.hbase.wal.WALProvider.Writer generateWALs(int leaveOpen) throws IOException
IOException
private org.apache.hadoop.hbase.wal.WALProvider.Writer generateWALs(int writers, int entries, int leaveOpen) throws IOException
IOException
private void makeRegionDirs(List<String> regions) throws IOException
IOException
private 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.IOException
private org.apache.hadoop.fs.Path[] getLogForRegion(org.apache.hadoop.hbase.TableName table, String region) throws IOException
IOException
private void corruptWAL(org.apache.hadoop.fs.Path path, TestWALSplit.Corruptions corruption, boolean close) throws IOException
IOException
private void closeOrFlush(boolean close, org.apache.hadoop.fs.FSDataOutputStream out) throws IOException
IOException
private int countWAL(org.apache.hadoop.fs.Path log) throws IOException
IOException
private static void appendCompactionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w, org.apache.hadoop.hbase.client.RegionInfo hri, String[] inputs, String output) throws IOException
IOException
private static void appendRegionEvent(org.apache.hadoop.hbase.wal.WALProvider.Writer w, String region) throws IOException
IOException
public 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
IOException
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 injectEmptyFile(String suffix, boolean closeFile) throws IOException
IOException
private boolean logsAreEqual(org.apache.hadoop.fs.Path p1, org.apache.hadoop.fs.Path p2) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.