nsivabalan commented on a change in pull request #4123:
URL: https://github.com/apache/hudi/pull/4123#discussion_r757465479



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java
##########
@@ -608,7 +627,7 @@ public boolean rollback(final String commitInstantTime, 
boolean skipLocking) thr
           .findFirst());
       if (commitInstantOpt.isPresent()) {
         LOG.info("Scheduling Rollback at instant time :" + 
rollbackInstantTime);
-        Option<HoodieRollbackPlan> rollbackPlanOption = 
table.scheduleRollback(context, rollbackInstantTime,
+        Option<HoodieRollbackPlan> rollbackPlanOption = pendingRollback ? 
Option.of(pendingRollbackInfo.getValue()) : table.scheduleRollback(context, 
rollbackInstantTime,

Review comment:
       NTR: I could not use Option.of().OrElse, bcoz, table.scheduleRollback 
already returns an Option<HoodieRollbackPlan> and so 
Option.of(pendingRollbackInfo.getValue()).orElse( table.scheduleRollback(...) ) 
does not work. 

##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java
##########
@@ -584,22 +585,40 @@ public void restoreToSavepoint(String savepointTime) {
 
   @Deprecated
   public boolean rollback(final String commitInstantTime) throws 
HoodieRollbackException {
-    return rollback(commitInstantTime, false);
+    HoodieTable<T, I, K, O> table = createTable(config, hadoopConf);
+    Pair<HoodieInstant, HoodieRollbackPlan> pendingRollbackInfo = 
getPendingRollback(table.getMetaClient(), commitInstantTime);
+    return rollback(commitInstantTime, pendingRollbackInfo,false);
   }
 
   /**
    * @Deprecated
    * Rollback the inflight record changes with the given commit time. This
    * will be removed in future in favor of {@link 
AbstractHoodieWriteClient#restoreToInstant(String)}
-   *
+   * Adding this api for backwards compatability.
    * @param commitInstantTime Instant time of the commit
    * @param skipLocking if this is triggered by another parent transaction, 
locking can be skipped.
    * @throws HoodieRollbackException if rollback cannot be performed 
successfully
    */
   @Deprecated
   public boolean rollback(final String commitInstantTime, boolean skipLocking) 
throws HoodieRollbackException {
+    return rollback(commitInstantTime, null, skipLocking);
+  }
+
+  /**
+   * @Deprecated
+   * Rollback the inflight record changes with the given commit time. This
+   * will be removed in future in favor of {@link 
AbstractHoodieWriteClient#restoreToInstant(String)}
+   *
+   * @param commitInstantTime Instant time of the commit
+   * @param pendingRollbackInfo pending rollback instant and plan if rollback 
failed from previous attempt.
+   * @param skipLocking if this is triggered by another parent transaction, 
locking can be skipped.
+   * @throws HoodieRollbackException if rollback cannot be performed 
successfully
+   */
+  @Deprecated
+  public boolean rollback(final String commitInstantTime, Pair<HoodieInstant, 
HoodieRollbackPlan> pendingRollbackInfo, boolean skipLocking) throws 
HoodieRollbackException {

Review comment:
       NTW: We need both HoodieInstant, HoodieRollbackPlan of a previous 
rollback. HoodieRollbackPlan does not have info on the rollback instant itself. 
It has info about the commit being rolledback, but not the rollback instant. 
Hence, had to introduce this new class to hold both these together.




-- 
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: commits-unsubscr...@hudi.apache.org

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


Reply via email to