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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -90,14 +90,34 @@ public static boolean 
needsUpgradeOrDowngrade(HoodieTableMetaClient metaClient,
 
   public static boolean needsUpgrade(HoodieTableMetaClient metaClient, 
HoodieWriteConfig config, HoodieTableVersion toWriteVersion) {
     HoodieTableVersion fromTableVersion = 
metaClient.getTableConfig().getTableVersion();
-    // If table version is less than SIX, then we need to upgrade to SIX first 
before upgrading to any other version, irrespective of autoUpgrade flag
+    if (fromTableVersion.versionCode() >= toWriteVersion.versionCode()) {
+      // if the table version is greater than or equal to the write version, 
then this is not an upgrade
+      LOG.warn("Table version {} is greater than or equal to write version {}. 
No upgrade needed", fromTableVersion, toWriteVersion);
+      return false;
+    }
     if (fromTableVersion.versionCode() < HoodieTableVersion.SIX.versionCode() 
&& toWriteVersion.versionCode() >= HoodieTableVersion.EIGHT.versionCode()) {

Review Comment:
   Ack will do so based on discussion.



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