danny0405 commented on code in PR #4739:
URL: https://github.com/apache/hudi/pull/4739#discussion_r867299333


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -1301,4 +1359,33 @@ public void close() {
     this.heartbeatClient.stop();
     this.txnManager.close();
   }
+
+  private void setWriteTimer(HoodieTable<T, I, K, O> table) {
+    String commitType = table.getMetaClient().getCommitActionType();
+    if (commitType.equals(HoodieTimeline.COMMIT_ACTION)) {
+      writeTimer = metrics.getCommitCtx();
+    } else if (commitType.equals(HoodieTimeline.DELTA_COMMIT_ACTION)) {
+      writeTimer = metrics.getDeltaCommitCtx();
+    }
+  }
+
+  private void tryUpgrade(HoodieTableMetaClient metaClient, Option<String> 
instantTime) {
+    UpgradeDowngrade upgradeDowngrade =
+        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);
+
+      Map<String, Option<HoodiePendingRollbackInfo>> pendingRollbacks = 
getPendingRollbackInfos(metaClient);

Review Comment:
   >In general, given that upgrade/downgrade could be acting upon and modifying 
table's current state it has to be in a consistent one
   
   I'm wondering the exact point here, i have two questions here:
   
   1. we already do a rollback when starting a new instant, so why here we 
rollback again ?
   2. the intermediate/corrupted data would sooner or later be rolled back, and 
i see that most of the upgrade/downgrade logic does not touch the data 
files/but only the table configs, so why there is need to rollback here ?



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