vinothchandar commented on a change in pull request #3427:
URL: https://github.com/apache/hudi/pull/3427#discussion_r686385905
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/config/HoodieMetadataConfig.java
##########
@@ -141,6 +148,10 @@ public boolean useFileListingMetadata() {
return getBoolean(METADATA_ENABLE_PROP);
Review comment:
ideally we should rename this method
##########
File path:
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestHoodieBackedMetadata.java
##########
@@ -192,6 +192,54 @@ public void testMetadataTableBootstrap() throws Exception {
}
}
+ /**
+ * Test enable/disable sync via the config.
+ */
+ @Test
+ public void testSyncConfig() throws Exception {
+ init(HoodieTableType.COPY_ON_WRITE);
+ HoodieSparkEngineContext engineContext = new HoodieSparkEngineContext(jsc);
+
+ // Create the metadata table
+ String firstCommitTime = HoodieActiveTimeline.createNewInstantTime();
+ try (SparkRDDWriteClient client = new SparkRDDWriteClient(engineContext,
getWriteConfig(true, true), true)) {
+ client.startCommitWithTime(firstCommitTime);
+ client.insert(jsc.parallelize(dataGen.generateInserts(firstCommitTime,
2)), firstCommitTime);
+ client.syncTableMetadata();
+ assertTrue(fs.exists(new Path(metadataTableBasePath)));
+ validateMetadata(client);
+ }
+
+ // If sync is disabled, the table will not sync
+ HoodieWriteConfig config = getWriteConfigBuilder(true, true, false)
+ .withMetadataConfig(HoodieMetadataConfig.newBuilder()
+
.enable(true).enableMetrics(false).enableSync(false).build()).build();
+ final String metadataTableMetaPath = metadataTableBasePath +
Path.SEPARATOR + HoodieTableMetaClient.METAFOLDER_NAME;
+ String secondCommitTime = HoodieActiveTimeline.createNewInstantTime();
+ try (SparkRDDWriteClient client = new SparkRDDWriteClient(engineContext,
config, true)) {
+ client.startCommitWithTime(secondCommitTime);
+ client.insert(jsc.parallelize(dataGen.generateInserts(secondCommitTime,
2)), secondCommitTime);
Review comment:
wondering if theere is a lighter weight way of testing this, without
incurring the full write path.
--
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]