linliu-code commented on code in PR #13519:
URL: https://github.com/apache/hudi/pull/13519#discussion_r2265492797
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java:
##########
@@ -164,17 +167,20 @@ public void run(HoodieTableVersion toVersion, String
instantTime) {
// upgrade
while (fromVersion.versionCode() < toVersion.versionCode()) {
HoodieTableVersion nextVersion =
HoodieTableVersion.fromVersionCode(fromVersion.versionCode() + 1);
- tablePropsToAdd.putAll(upgrade(fromVersion, nextVersion, instantTime));
+ UpgradeDowngrade.TableConfigChangeSet tableConfigChangeSet =
+ upgrade(fromVersion, nextVersion, instantTime);
+ tablePropsToAdd.putAll(tableConfigChangeSet.getPropertiesToUpdate());
+
tablePropsToRemove.addAll(tableConfigChangeSet.getPropertiesToDelete());
fromVersion = nextVersion;
}
} else {
// downgrade
isDowngrade = true;
while (fromVersion.versionCode() > toVersion.versionCode()) {
HoodieTableVersion prevVersion =
HoodieTableVersion.fromVersionCode(fromVersion.versionCode() - 1);
- Pair<Map<ConfigProperty, String>, List<ConfigProperty>>
tablePropsToAddAndRemove = downgrade(fromVersion, prevVersion, instantTime);
- tablePropsToAdd.putAll(tablePropsToAddAndRemove.getLeft());
- tablePropsToRemove.addAll(tablePropsToAddAndRemove.getRight());
+ UpgradeDowngrade.TableConfigChangeSet tableConfigChangeSet =
downgrade(fromVersion, prevVersion, instantTime);
+ tablePropsToAdd.putAll(tableConfigChangeSet.getPropertiesToUpdate());
+
tablePropsToRemove.addAll(tableConfigChangeSet.getPropertiesToDelete());
Review Comment:
I also had this concern. I think the original design is to make sure there
should be only ONE write for the table configuration to ensure atomicity. If
one write crashes in between, it will be complex to figure out how to roll back.
I will double check the logic to ensure I have the right assumption.
--
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]