jonvex commented on code in PR #7605:
URL: https://github.com/apache/hudi/pull/7605#discussion_r1063615487


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -840,11 +841,25 @@ public boolean rollback(final String commitInstantTime, 
Option<HoodiePendingRoll
    */
   public HoodieRestoreMetadata restoreToInstant(final String instantTime, 
boolean initialMetadataTableIfNecessary) throws HoodieRestoreException {
     LOG.info("Begin restore to instant " + instantTime);
-    final String restoreInstantTime = 
HoodieActiveTimeline.createNewInstantTime();
+    final String restoreInstantTime;
     Timer.Context timerContext = metrics.getRollbackCtx();
+    Option<HoodieRestorePlan> restorePlanOption;
     try {
-      HoodieTable<T, I, K, O> table = initTable(WriteOperationType.UNKNOWN, 
Option.of(restoreInstantTime), initialMetadataTableIfNecessary);
-      Option<HoodieRestorePlan> restorePlanOption = 
table.scheduleRestore(context, restoreInstantTime, instantTime);
+      //Use the previous restore if it failed
+      HoodieTable<T, I, K, O> table = initTable(WriteOperationType.UNKNOWN, 
Option.empty(), initialMetadataTableIfNecessary);
+      Option<HoodieInstant> failedRestore = 
table.getRestoreTimeline().filterInflightsAndRequested().lastInstant();
+      if (failedRestore.isPresent() && 
instantTime.equals(RestoreUtils.getRestoreTime(table, failedRestore.get()))) {
+        if (failedRestore.get().isRequested()) {

Review Comment:
   I originally had this that if it is inflight then revert it to requested, 
but that was actually failing because of the following failure:
   BaseRestoreActionExecutor.finishRestore calls saveAsComplete which calls 
transitionState. In transitionState it calls ValidationUtils.checkArgument to 
make sure that the inflight file in the timeline exists. It fails saying the 
file doesn't exist.
   However in BaseRestoreActionExecutor there is a check and if it is in 
requested state it gets transitioned to inflight. And that is before 
finishRestore is called so it doesn't make sense to me why that file doesn't 
exist



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