vinothchandar commented on a change in pull request #3428:
URL: https://github.com/apache/hudi/pull/3428#discussion_r686389337
##########
File path:
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestHoodieBackedMetadata.java
##########
@@ -857,6 +859,62 @@ public void testMetadataOutOfSync() throws Exception {
validateMetadata(unsyncedClient);
}
+ /**
+ * Test that failure to perform deltacommit on the metadata table does not
lead to missed sync.
+ */
+ @Test
+ public void testMetdataTableCommitFailure() throws Exception {
+ init(HoodieTableType.COPY_ON_WRITE);
+ HoodieSparkEngineContext engineContext = new HoodieSparkEngineContext(jsc);
+
+ try (SparkRDDWriteClient client = new SparkRDDWriteClient(engineContext,
getWriteConfig(true, true))) {
+ // Write 1
+ String newCommitTime = "001";
+ List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, 20);
+ client.startCommitWithTime(newCommitTime);
+ List<WriteStatus> writeStatuses =
client.bulkInsert(jsc.parallelize(records, 1), newCommitTime).collect();
+ assertNoWriteErrors(writeStatuses);
+
+ // Write 2
+ newCommitTime = "002";
+ client.startCommitWithTime(newCommitTime);
+ records = dataGen.generateInserts(newCommitTime, 20);
+ writeStatuses = client.insert(jsc.parallelize(records, 1),
newCommitTime).collect();
+ assertNoWriteErrors(writeStatuses);
+ }
+
+ // At this time both commits 001 and 002 must be synced to the metadata
table
+ HoodieTableMetaClient metadataMetaClient =
HoodieTableMetaClient.builder().setConf(hadoopConf).setBasePath(metadataTableBasePath).build();
+ HoodieActiveTimeline timeline = metadataMetaClient.getActiveTimeline();
+ assertTrue(timeline.containsInstant(new HoodieInstant(false,
HoodieTimeline.DELTA_COMMIT_ACTION, "001")));
+ assertTrue(timeline.containsInstant(new HoodieInstant(false,
HoodieTimeline.DELTA_COMMIT_ACTION, "002")));
+
+ // Delete the 002 deltacommit completed instant to make it inflight
+ FileCreateUtils.deleteDeltaCommit(metadataTableBasePath, "002");
Review comment:
This is just simulating a failure, as if 002 failed, by deleting the
delta commit file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]