Class TestCreateTableProcedureDescriptorWriteFailure
java.lang.Object
org.apache.hadoop.hbase.master.procedure.TestCreateTableProcedureDescriptorWriteFailure
@Tag("org.apache.hadoop.hbase.testclassification.MasterTests") @Tag("org.apache.hadoop.hbase.testclassification.MediumTests")
public class TestCreateTableProcedureDescriptorWriteFailure
extends Object
Test for HBASE-30539:
CreateTableProcedure must not move on to hbase:meta and
region assignment when the table descriptor could not be written.
FSTableDescriptors.writeTableDescriptor retries 10 times. If every attempt fails it must
throw, so that the create procedure stays in CREATE_TABLE_WRITE_FS_LAYOUT and retries,
instead of publishing a table whose region servers can never load a descriptor ("Missing table
descriptor for ...") and whose assign procedure retries forever.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classADistributedFileSystemthat refuses to create any file whose path containsfailPathContains, simulating the NameNode answering "could only be written to 0 of the 1 minReplication nodes". -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static StringSubstring identifying the file creations to fail; null means do not inject.private static final AtomicIntegerprivate static intStop injecting once this many failures were injected; default is to fail forever.private static final HBaseTestingUtilprivate static final intSame asmaxAttemptsinFSTableDescriptors.writeTableDescriptor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertTableCreatedWithDescriptor(org.apache.hadoop.hbase.TableName tableName) voidstatic voidsetUp()private longsubmitCreateTable(org.apache.hadoop.hbase.TableName tableName) static voidvoidEvery write of the table descriptor fails, so the 10 in-method attempts ofwriteTableDescriptorare exhausted, over and over.voidMore failures than the in-method attempts: the first round of 10 writes is exhausted andCREATE_TABLE_WRITE_FS_LAYOUTfails, then the procedure retries that step, the write succeeds and the procedure completes without ever having added the table tohbase:metain between.voidA few transient failures, fewer than the 10 in-method attempts, are absorbed by the retry loop inwriteTableDescriptor: the procedure never notices.
-
Field Details
-
UTIL
-
WRITE_ATTEMPTS
Same asmaxAttemptsinFSTableDescriptors.writeTableDescriptor.- See Also:
-
failPathContains
Substring identifying the file creations to fail; null means do not inject. -
maxInjectedFailures
Stop injecting once this many failures were injected; default is to fail forever. -
INJECTED_FAILURES
-
-
Constructor Details
-
TestCreateTableProcedureDescriptorWriteFailure
-
-
Method Details
-
setUp
- Throws:
Exception
-
tearDownCluster
- Throws:
Exception
-
resetInjection
-
testCreateTableDoesNotProceedWhenTableDescriptorWriteFails
Every write of the table descriptor fails, so the 10 in-method attempts ofwriteTableDescriptorare exhausted, over and over. The create procedure must keep retryingCREATE_TABLE_WRITE_FS_LAYOUT: it must not fail, finish, add the regions tohbase:metaor start anyTransitRegionStateProcedurefor region assignment. Once the injection is cleared, i.e. HDFS recovers, the same procedure completes, the descriptor is on the file system and the region server can load it.- Throws:
Exception
-
testTransientWriteFailuresAbsorbedByWriteRetries
A few transient failures, fewer than the 10 in-method attempts, are absorbed by the retry loop inwriteTableDescriptor: the procedure never notices.- Throws:
Exception
-
testProcedureRetriesAfterWriteAttemptsExhaustedThenSucceeds
More failures than the in-method attempts: the first round of 10 writes is exhausted andCREATE_TABLE_WRITE_FS_LAYOUTfails, then the procedure retries that step, the write succeeds and the procedure completes without ever having added the table tohbase:metain between.- Throws:
Exception
-
submitCreateTable
- Throws:
IOException
-
assertTableCreatedWithDescriptor
private void assertTableCreatedWithDescriptor(org.apache.hadoop.hbase.TableName tableName) throws Exception - Throws:
Exception
-