rahil-c commented on code in PR #13642:
URL: https://github.com/apache/hudi/pull/13642#discussion_r2244227162


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -130,6 +145,29 @@ public boolean needsUpgrade(HoodieTableVersion 
toWriteVersion) {
    * @param instantTime current instant time that should not be touched.
    */
   public void run(HoodieTableVersion toVersion, String instantTime) {
+    // Fetch version from property file and current version
+    HoodieTableVersion fromVersion = 
metaClient.getTableConfig().getTableVersion();
+    // Determine if we are upgrading or downgrading
+    boolean isUpgrade = fromVersion.versionCode() < toVersion.versionCode();
+    if (isUpgrade && !config.autoUpgrade()) {
+      // if we are attempting to upgrade and auto-upgrade is disabled
+      // we set the write config table version to bounded by the current hudi 
table version
+      // and then exit out the upgrade process
+      config.setValue(HoodieWriteConfig.WRITE_TABLE_VERSION, 
String.valueOf(fromVersion));

Review Comment:
   Just to confirm, I saw that on `master` when it would hit these autoUpgrade 
disabled cases, we would configure the write config like so.
   
   
https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/SevenToEightUpgradeHandler.java#L95
   
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-
   
common/src/main/java/org/apache/hudi/table/upgrade/EightToNineUpgradeHandler.java#L53
   
   Hence why i did the same. If this is not needed though then will remove it.
   cc @yihua 



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