Class TestHRegionReplayEvents
java.lang.Object
org.apache.hadoop.hbase.regionserver.TestHRegionReplayEvents
Tests of HRegion methods for replaying flush, compaction, region open, etc events for secondary
region replicas
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
static org.apache.hadoop.conf.Configuration
protected byte[]
private String
private byte[][]
private org.apache.hadoop.hbase.client.TableDescriptor
private static final org.slf4j.Logger
protected String
org.junit.rules.TestName
private org.apache.hadoop.hbase.client.RegionInfo
private org.apache.hadoop.hbase.regionserver.HRegion
private org.apache.hadoop.hbase.wal.WALStreamReader
private org.apache.hadoop.fs.Path
protected final byte[]
protected final byte[]
private org.apache.hadoop.hbase.regionserver.RegionServerServices
private org.apache.hadoop.hbase.client.RegionInfo
private org.apache.hadoop.hbase.regionserver.HRegion
protected byte[]
private static HBaseTestingUtility
private org.apache.hadoop.hbase.wal.WAL
private org.apache.hadoop.hbase.wal.WAL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
assertPathListsEqual
(List<String> list1, List<String> list2) Paths can be qualified or not.private org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor
clone
(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor flush, long flushSeqId) private String
createHFileForFamilies
(org.apache.hadoop.fs.Path testPath, byte[] family, byte[] valueBytes) private org.apache.hadoop.hbase.wal.WALStreamReader
private void
disableReads
(org.apache.hadoop.hbase.regionserver.HRegion region) (package private) String
getName()
private static org.apache.hadoop.hbase.regionserver.HRegion
initHRegion
(byte[] tableName, byte[] startKey, byte[] stopKey, String callingMethod, org.apache.hadoop.conf.Configuration conf, boolean isReadOnly, org.apache.hadoop.hbase.client.Durability durability, org.apache.hadoop.hbase.wal.WAL wal, byte[]... families) private static org.apache.hadoop.hbase.regionserver.HRegion
initHRegion
(byte[] tableName, String callingMethod, byte[]... families) private void
putDataByReplay
(org.apache.hadoop.hbase.regionserver.HRegion region, int startRow, int numRows, byte[] qf, byte[]... families) private void
putDataWithFlushes
(org.apache.hadoop.hbase.regionserver.HRegion region, int flushInterval, int numRows, int numRowsAfterFlush) Puts a total of numRows + numRowsAfterFlush records indexed with numeric row keys.private void
replay
(org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.client.Put put, long replaySeqId) (package private) static int
replayEdit
(org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.wal.WAL.Entry entry) void
setUp()
static void
void
tearDown()
static void
void
void
Tests a case where we replay only a flush start marker, then the region is closed.void
void
Tests the reads enabled flag for the region.void
void
Tests replaying region open markers from primary region.void
Tests the case where we prepare a flush with some seqId and we receive a flush commit marker larger than the previous flush start marker.void
Tests the case where we prepare a flush with some seqId and we receive a flush commit marker less than the previous flush start marker.void
testReplayFlushCommitMarkerWithoutFlushStartMarker
(boolean droppableMemstore) Tests the case where we receive a flush commit before receiving any flush prepare markersvoid
Tests the case where we receive a flush commit before receiving any flush prepare markers.void
Tests the case where we receive a flush commit before receiving any flush prepare markers.void
void
void
Tests cases where we prepare a flush with some seqId and we receive other flush start markers equal to, greater or less than the previous flush start marker.void
void
void
void
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region.void
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region.void
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region.void
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region.void
void
Tests replaying region open markers from primary region.void
Tests the case where we replay a region open event after a flush start but before receiving flush commitvoid
Tests that a region opened in secondary mode would not write region open / close events to its WAL.void
void
Tests whether edits coming in for replay are skipped which have smaller seq id than the seqId of the last replayed region open event.void
Tests the case where a request for flush cache is sent to the region, but region cannot flush.
-
Field Details
-
CLASS_RULE
-
LOG
-
name
-
TEST_UTIL
-
CONF
-
dir
-
families
-
tableName
-
method
-
row
-
row2
-
cq
-
rootDir
-
htd
-
rss
-
-
secondaryHri
-
primaryRegion
-
secondaryRegion
-
walPrimary
-
walSecondary
-
reader
-
-
Constructor Details
-
TestHRegionReplayEvents
public TestHRegionReplayEvents()
-
-
Method Details
-
setUpBeforeClass
- Throws:
Exception
-
tearDownAfterClass
- Throws:
Exception
-
setUp
- Throws:
Exception
-
tearDown
- Throws:
Exception
-
getName
-
testRegionReplicaSecondaryCannotFlush
- Throws:
IOException
-
testOnlyReplayingFlushStartDoesNotHoldUpRegionClose
Tests a case where we replay only a flush start marker, then the region is closed. This region should not block indefinitely- Throws:
IOException
-
replayEdit
static int replayEdit(org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.wal.WAL.Entry entry) throws IOException - Throws:
IOException
-
createWALReaderForPrimary
private org.apache.hadoop.hbase.wal.WALStreamReader createWALReaderForPrimary() throws FileNotFoundException, IOException- Throws:
FileNotFoundException
IOException
-
testBatchReplayWithMultipleNonces
- Throws:
IOException
-
testReplayFlushesAndCompactions
- Throws:
IOException
-
testReplayFlushStartMarkers
Tests cases where we prepare a flush with some seqId and we receive other flush start markers equal to, greater or less than the previous flush start marker.- Throws:
IOException
-
testReplayFlushCommitMarkerSmallerThanFlushStartMarker
Tests the case where we prepare a flush with some seqId and we receive a flush commit marker less than the previous flush start marker.- Throws:
IOException
-
testReplayFlushCommitMarkerLargerThanFlushStartMarker
Tests the case where we prepare a flush with some seqId and we receive a flush commit marker larger than the previous flush start marker.- Throws:
IOException
-
testReplayFlushCommitMarkerWithoutFlushStartMarkerDroppableMemstore
public void testReplayFlushCommitMarkerWithoutFlushStartMarkerDroppableMemstore() throws IOExceptionTests the case where we receive a flush commit before receiving any flush prepare markers. The memstore edits should be dropped after the flush commit replay since they should be in flushed files- Throws:
IOException
-
testReplayFlushCommitMarkerWithoutFlushStartMarkerNonDroppableMemstore
public void testReplayFlushCommitMarkerWithoutFlushStartMarkerNonDroppableMemstore() throws IOExceptionTests the case where we receive a flush commit before receiving any flush prepare markers. The memstore edits should be not dropped after the flush commit replay since not every edit will be in flushed files (based on seqId)- Throws:
IOException
-
testReplayFlushCommitMarkerWithoutFlushStartMarker
public void testReplayFlushCommitMarkerWithoutFlushStartMarker(boolean droppableMemstore) throws IOException Tests the case where we receive a flush commit before receiving any flush prepare markers- Throws:
IOException
-
clone
private org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor clone(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor flush, long flushSeqId) -
testReplayRegionOpenEvent
Tests replaying region open markers from primary region. Checks whether the files are picked up- Throws:
IOException
-
testReplayRegionOpenEventAfterFlushStart
Tests the case where we replay a region open event after a flush start but before receiving flush commit- Throws:
IOException
-
testSkippingEditsWithSmallerSeqIdAfterRegionOpenEvent
Tests whether edits coming in for replay are skipped which have smaller seq id than the seqId of the last replayed region open event.- Throws:
IOException
-
testReplayFlushSeqIds
- Throws:
IOException
-
testSeqIdsFromReplay
- Throws:
IOException
-
testSecondaryRegionDoesNotWriteRegionEventsToWAL
Tests that a region opened in secondary mode would not write region open / close events to its WAL.- Throws:
IOException
-
testRegionReadsEnabledFlag
Tests the reads enabled flag for the region. When unset all reads should be rejected- Throws:
IOException
-
testWriteFlushRequestMarker
Tests the case where a request for flush cache is sent to the region, but region cannot flush. It should write the flush request marker instead.- Throws:
IOException
-
testReplayingFlushRequestRestoresReadsEnabledState
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region. Replaying CANNOT_FLUSH flush marker entry should restore the reads enabled status in the region and allow the reads to continue.- Throws:
IOException
-
testReplayingFlushRestoresReadsEnabledState
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region. Replaying flush start and commit entries should restore the reads enabled status in the region and allow the reads to continue.- Throws:
IOException
-
testReplayingFlushWithEmptyMemstoreRestoresReadsEnabledState
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region. Replaying flush start and commit entries should restore the reads enabled status in the region and allow the reads to continue.- Throws:
IOException
-
testReplayingRegionOpenEventRestoresReadsEnabledState
Test the case where the secondary region replica is not in reads enabled state because it is waiting for a flush or region open marker from primary region. Replaying region open event entry from primary should restore the reads enabled status in the region and allow the reads to continue.- Throws:
IOException
-
testRefresStoreFiles
- Throws:
IOException
-
assertPathListsEqual
Paths can be qualified or not. This does the assertion using String->Path conversion. -
disableReads
-
replay
private void replay(org.apache.hadoop.hbase.regionserver.HRegion region, org.apache.hadoop.hbase.client.Put put, long replaySeqId) throws IOException - Throws:
IOException
-
testReplayBulkLoadEvent
Tests replaying region open markers from primary region. Checks whether the files are picked up- Throws:
IOException
-
testReplayingFlushCommitWithFileAlreadyDeleted
- Throws:
IOException
-
testReplayingCompactionWithFileAlreadyDeleted
- Throws:
IOException
-
testReplayingRegionOpenEventWithFileAlreadyDeleted
- Throws:
IOException
-
testReplayingBulkLoadEventWithFileAlreadyDeleted
- Throws:
IOException
-
createHFileForFamilies
private String createHFileForFamilies(org.apache.hadoop.fs.Path testPath, byte[] family, byte[] valueBytes) throws IOException - Throws:
IOException
-
putDataWithFlushes
private void putDataWithFlushes(org.apache.hadoop.hbase.regionserver.HRegion region, int flushInterval, int numRows, int numRowsAfterFlush) throws IOException Puts a total of numRows + numRowsAfterFlush records indexed with numeric row keys. Does a flush every flushInterval number of records. Then it puts numRowsAfterFlush number of more rows but does not execute flush after- Throws:
IOException
-
putDataByReplay
private void putDataByReplay(org.apache.hadoop.hbase.regionserver.HRegion region, int startRow, int numRows, byte[] qf, byte[]... families) throws IOException - Throws:
IOException
-
initHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion initHRegion(byte[] tableName, String callingMethod, byte[]... families) throws IOException - Throws:
IOException
-
initHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion initHRegion(byte[] tableName, byte[] startKey, byte[] stopKey, String callingMethod, org.apache.hadoop.conf.Configuration conf, boolean isReadOnly, org.apache.hadoop.hbase.client.Durability durability, org.apache.hadoop.hbase.wal.WAL wal, byte[]... families) throws IOException - Throws:
IOException
-