yihua commented on code in PR #13642:
URL: https://github.com/apache/hudi/pull/13642#discussion_r2257662736


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -130,6 +145,24 @@ 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 exit out the upgrade process
+      LOG.warn("AUTO_UPGRADE_VERSION was explicitly disabled, skipping table 
version upgrade process");

Review Comment:
   nit: 
   ```suggestion
         LOG.warn("hoodie.write.auto.upgrade was explicitly disabled, skipping 
table version upgrade process");
   ```



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -144,23 +178,18 @@ public void run(HoodieTableVersion toVersion, String 
instantTime) {
               .run(toVersion, instantTime);
         }
       } catch (Exception e) {
-        LOG.warn("Unable to upgrade or downgrade the metadata table to version 
" + toVersion
-            + ", ignoring the error and continue.", e);
+        throw new HoodieUpgradeDowngradeException("Upgrade/downgrade for the 
Hudi metadata table failed. "
+            + "Please try again. If the failure repeats for metadata table, it 
is recommended to disable "
+            + "the metadata table so that the upgrade and downgrade can 
continue for the data table.", e);

Review Comment:
   @rahil-c do you have a test case covering this?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -144,23 +178,18 @@ public void run(HoodieTableVersion toVersion, String 
instantTime) {
               .run(toVersion, instantTime);
         }
       } catch (Exception e) {
-        LOG.warn("Unable to upgrade or downgrade the metadata table to version 
" + toVersion
-            + ", ignoring the error and continue.", e);
+        throw new HoodieUpgradeDowngradeException("Upgrade/downgrade for the 
Hudi metadata table failed. "
+            + "Please try again. If the failure repeats for metadata table, it 
is recommended to disable "
+            + "the metadata table so that the upgrade and downgrade can 
continue for the data table.", e);

Review Comment:
   MDT should be automatically deleted when disabled, during the upgrade and 
downgrade process.  If not, this should be fixed.



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