use of org.apache.hudi.common.testutils.HoodieMetadataTestTable in project hudi by apache.
the class TestHoodieMetadataBootstrap method testMetadataBootstrapInflightCommit.
@Test
public void testMetadataBootstrapInflightCommit() throws Exception {
HoodieTableType tableType = COPY_ON_WRITE;
init(tableType, false);
doPreBootstrapWriteOperation(testTable, INSERT, "0000001");
doPreBootstrapWriteOperation(testTable, "0000002");
// add an inflight commit
HoodieCommitMetadata inflightCommitMeta = testTable.doWriteOperation("00000007", UPSERT, emptyList(), asList("p1", "p2"), 2, true, true);
// bootstrap and following validation should fail. bootstrap should not happen.
bootstrapAndVerifyFailure();
// once the commit is complete, metadata should get fully synced.
// in prod code path, SparkHoodieBackedTableMetadataWriter.create() will be called for every commit,
// which may not be the case here if we directly call HoodieBackedTableMetadataWriter.update()
// hence lets first move the commit to complete and invoke sync directly
((HoodieMetadataTestTable) testTable).moveInflightCommitToComplete("00000007", inflightCommitMeta, true);
syncTableMetadata(writeConfig);
validateMetadata(testTable);
}
Aggregations