danny0405 commented on code in PR #5535:
URL: https://github.com/apache/hudi/pull/5535#discussion_r867743829
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -1558,13 +1558,15 @@ private void tryUpgrade(HoodieTableMetaClient
metaClient, Option<String> instant
new UpgradeDowngrade(metaClient, config, context,
upgradeDowngradeHelper);
if
(upgradeDowngrade.needsUpgradeOrDowngrade(HoodieTableVersion.current())) {
- // Ensure no inflight commits by setting EAGER policy and explicitly
cleaning all failed commits
- List<String> instantsToRollback = getInstantsToRollback(metaClient,
HoodieFailedWritesCleaningPolicy.EAGER, instantTime);
+ if
(config.getWriteConcurrencyMode().supportsOptimisticConcurrencyControl()) {
+ // Ensure no inflight commits by setting EAGER policy and explicitly
cleaning all failed commits
+ List<String> instantsToRollback = getInstantsToRollback(metaClient,
HoodieFailedWritesCleaningPolicy.EAGER, instantTime);
- Map<String, Option<HoodiePendingRollbackInfo>> pendingRollbacks =
getPendingRollbackInfos(metaClient);
- instantsToRollback.forEach(entry -> pendingRollbacks.putIfAbsent(entry,
Option.empty()));
+ Map<String, Option<HoodiePendingRollbackInfo>> pendingRollbacks =
getPendingRollbackInfos(metaClient);
+ instantsToRollback.forEach(entry ->
pendingRollbacks.putIfAbsent(entry, Option.empty()));
Review Comment:
The pre-upgrade rollback was introduced in
https://github.com/apache/hudi/pull/2374, with a pre-condition that when the
write concurrency mode is based on optimistic lock.
While in https://github.com/apache/hudi/pull/4114, the pre-condition was
removed, which i think is a regression because we already do the rollback when
starting new instant/commit before write. In single writer mode, there is no
need to do redundant rollback again before upgrade.
--
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]