Class TestIOFencing
If we happen to assign a region before it fully done with in its old location -- i.e. it is on two servers at the same time -- all can work fine until the case where the region on the dying server decides to compact or otherwise change the region file set. The region in its new location will then get a surprise when it tries to do something w/ a file removed by the region in its old location on dying server.
Making a test for this case is a little tough in that even if a file is deleted up on the namenode, if the file was opened before the delete, it will continue to let reads happen until something changes the state of cached blocks in the dfsclient that was already open (a block from the deleted file is cleaned from the datanode by NN).
What we will do below is do an explicit check for existence on the files listed in the region that has had some files removed because of a compaction. This sort of hurry's along and makes certain what is a chance occurance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classAn override of HRegion that allows us park compactions in a holding pattern and then when appropriate for the test, allow them proceed again.static classAn override of HRegion that allows us park compactions in a holding pattern and then when appropriate for the test, allow them proceed again.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static final byte[]private static final intprivate static final org.slf4j.Loggerprivate static final intprivate static final org.apache.hadoop.hbase.TableNameprivate static final HBaseTestingUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidTest that puts up a regionserver, starts a compaction on a loaded region but holds the compaction until after we have killed the server and the region has come up on a new regionserver altogether.voidTest that puts up a regionserver, starts a compaction on a loaded region but holds the compaction completion until after we have killed the server and the region has come up on a new regionserver altogether.
-
Field Details
-
CLASS_RULE
-
LOG
-
TEST_UTIL
-
TABLE_NAME
-
FAMILY
-
FIRST_BATCH_COUNT
- See Also:
-
SECOND_BATCH_COUNT
- See Also:
-
-
Constructor Details
-
TestIOFencing
public TestIOFencing()
-
-
Method Details
-
testFencingAroundCompaction
Test that puts up a regionserver, starts a compaction on a loaded region but holds the compaction until after we have killed the server and the region has come up on a new regionserver altogether. This fakes the double assignment case where region in one location changes the files out from underneath a region being served elsewhere.- Throws:
Exception
-
testFencingAroundCompactionAfterWALSync
Test that puts up a regionserver, starts a compaction on a loaded region but holds the compaction completion until after we have killed the server and the region has come up on a new regionserver altogether. This fakes the double assignment case where region in one location changes the files out from underneath a region being served elsewhere.- Throws:
Exception
-
doTest
public void doTest(Class<?> regionClass, org.apache.hadoop.hbase.MemoryCompactionPolicy policy) throws Exception - Throws:
Exception
-