leangjonathan commented on code in PR #10861:
URL: https://github.com/apache/iceberg/pull/10861#discussion_r1704731376


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1015,6 +1015,11 @@ public Builder upgradeFormatVersion(int 
newFormatVersion) {
           "Cannot downgrade v%s table to v%s",
           formatVersion,
           newFormatVersion);
+      Preconditions.checkArgument(
+          newFormatVersion <= formatVersion + 1,
+          "Cannot skip format version(s) to upgrade v%s table to v%s",
+          formatVersion,
+          newFormatVersion);

Review Comment:
   This sounds alright, I'll remove the assert here and find a way to perform a 
serial upgrade internally.
   
   Some implementation notes I have so far:
   - Currently the internal implementation of performing a format version 
upgrade is to add to the list of metadata changes a 
MetadataUpdate.UpgradeFormatVersion instance.
   - `MetadataUpdate.UpgradeFormatVersion` tracks the target version but not 
the origin version. This may mean that multiple instances of 
MetadataUpdate.UpgradeFormatVersion should be populated into the list of 
metadata changes to simulate this multi-version upgrade.
   - `UpdateRequirements` class which defines all upgrade requirements has no 
requirements for the `MetadataUpdate.UpgradeFormatVersion` class due to the 
fact that backwards compatibility has never been broken (yet). 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to