nsivabalan commented on a change in pull request #3836:
URL: https://github.com/apache/hudi/pull/3836#discussion_r743670241



##########
File path: 
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/SparkRDDWriteClient.java
##########
@@ -95,10 +95,19 @@ public SparkRDDWriteClient(HoodieEngineContext context, 
HoodieWriteConfig writeC
   public SparkRDDWriteClient(HoodieEngineContext context, HoodieWriteConfig 
writeConfig,
                              Option<EmbeddedTimelineService> timelineService) {
     super(context, writeConfig, timelineService);
+    bootstrapMetadataTable();
+  }
+
+  private void bootstrapMetadataTable() {
     if (config.isMetadataTableEnabled()) {
-      // If the metadata table does not exist, it should be bootstrapped here
-      // TODO: Check if we can remove this requirement - auto bootstrap on 
commit
-      
SparkHoodieBackedTableMetadataWriter.create(context.getHadoopConf().get(), 
config, context);
+      // Defer bootstrap if upgrade / downgrade is pending
+      HoodieTableMetaClient metaClient = createMetaClient(true);
+      UpgradeDowngrade upgradeDowngrade = new UpgradeDowngrade(
+          metaClient, config, context, 
SparkUpgradeDowngradeHelper.getInstance());
+      if 
(!upgradeDowngrade.needsUpgradeOrDowngrade(HoodieTableVersion.current())) {

Review comment:
       @prashantwason : can you help me understand something. if upgrade is 
required, we defer the bootstrapping. So, when exactly the upgrade happens? in 
a subsequent commit? so IIUC, on first commit where upgrade happens, metadata 
won't be bootstrapped and with 2 -> 3, we will delete the metadata table. and 
on 2nd commit, will trigger the actual bootstrap of metadata table. 
   




-- 
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]


Reply via email to