[HUDI-2753] Ensure list based rollback strategy is used for restore (#3983)
This commit is contained in:
committed by
GitHub
parent
cbcbec4d38
commit
04eb5fdc65
@@ -599,7 +599,7 @@ public abstract class AbstractHoodieWriteClient<T extends HoodieRecordPayload, I
|
||||
if (commitInstantOpt.isPresent()) {
|
||||
LOG.info("Scheduling Rollback at instant time :" + rollbackInstantTime);
|
||||
Option<HoodieRollbackPlan> rollbackPlanOption = table.scheduleRollback(context, rollbackInstantTime,
|
||||
commitInstantOpt.get(), false);
|
||||
commitInstantOpt.get(), false, config.shouldRollbackUsingMarkers());
|
||||
if (rollbackPlanOption.isPresent()) {
|
||||
// execute rollback
|
||||
HoodieRollbackMetadata rollbackMetadata = table.rollback(context, rollbackInstantTime, commitInstantOpt.get(), true,
|
||||
@@ -1024,7 +1024,7 @@ public abstract class AbstractHoodieWriteClient<T extends HoodieRecordPayload, I
|
||||
|
||||
protected void rollbackInflightClustering(HoodieInstant inflightInstant, HoodieTable<T, I, K, O> table) {
|
||||
String commitTime = HoodieActiveTimeline.createNewInstantTime();
|
||||
table.scheduleRollback(context, commitTime, inflightInstant, false);
|
||||
table.scheduleRollback(context, commitTime, inflightInstant, false, config.shouldRollbackUsingMarkers());
|
||||
table.rollback(context, commitTime, inflightInstant, false, false);
|
||||
table.getActiveTimeline().revertReplaceCommitInflightToRequested(inflightInstant);
|
||||
}
|
||||
|
||||
@@ -442,12 +442,13 @@ public abstract class HoodieTable<T extends HoodieRecordPayload, I, K, O> implem
|
||||
* @param context HoodieEngineContext
|
||||
* @param instantTime Instant Time for scheduling rollback
|
||||
* @param instantToRollback instant to be rolled back
|
||||
* @param shouldRollbackUsingMarkers uses marker based rollback strategy when set to true. uses list based rollback when false.
|
||||
* @return HoodieRollbackPlan containing info on rollback.
|
||||
*/
|
||||
public abstract Option<HoodieRollbackPlan> scheduleRollback(HoodieEngineContext context,
|
||||
String instantTime,
|
||||
HoodieInstant instantToRollback,
|
||||
boolean skipTimelinePublish);
|
||||
boolean skipTimelinePublish, boolean shouldRollbackUsingMarkers);
|
||||
|
||||
/**
|
||||
* Rollback the (inflight/committed) record changes with the given commit time.
|
||||
@@ -490,7 +491,7 @@ public abstract class HoodieTable<T extends HoodieRecordPayload, I, K, O> implem
|
||||
*/
|
||||
public void rollbackInflightCompaction(HoodieInstant inflightInstant) {
|
||||
String commitTime = HoodieActiveTimeline.createNewInstantTime();
|
||||
scheduleRollback(context, commitTime, inflightInstant, false);
|
||||
scheduleRollback(context, commitTime, inflightInstant, false, config.shouldRollbackUsingMarkers());
|
||||
rollback(context, commitTime, inflightInstant, false, false);
|
||||
getActiveTimeline().revertCompactionInflightToRequested(inflightInstant);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CopyOnWriteRestoreActionExecutor<T extends HoodieRecordPayload, I,
|
||||
}
|
||||
table.getMetaClient().reloadActiveTimeline();
|
||||
String newInstantTime = HoodieActiveTimeline.createNewInstantTime();
|
||||
table.scheduleRollback(context, newInstantTime, instantToRollback, false);
|
||||
table.scheduleRollback(context, newInstantTime, instantToRollback, false, false);
|
||||
table.getMetaClient().reloadActiveTimeline();
|
||||
CopyOnWriteRollbackActionExecutor rollbackActionExecutor = new CopyOnWriteRollbackActionExecutor(
|
||||
context,
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MergeOnReadRestoreActionExecutor<T extends HoodieRecordPayload, I,
|
||||
}
|
||||
table.getMetaClient().reloadActiveTimeline();
|
||||
String instantTime = HoodieActiveTimeline.createNewInstantTime();
|
||||
table.scheduleRollback(context, instantTime, instantToRollback, false);
|
||||
table.scheduleRollback(context, instantTime, instantToRollback, false, false);
|
||||
table.getMetaClient().reloadActiveTimeline();
|
||||
MergeOnReadRollbackActionExecutor rollbackActionExecutor = new MergeOnReadRollbackActionExecutor(
|
||||
context,
|
||||
|
||||
@@ -50,6 +50,7 @@ public class BaseRollbackPlanActionExecutor<T extends HoodieRecordPayload, I, K,
|
||||
|
||||
protected final HoodieInstant instantToRollback;
|
||||
private final boolean skipTimelinePublish;
|
||||
private final boolean shouldRollbackUsingMarkers;
|
||||
|
||||
public static final Integer ROLLBACK_PLAN_VERSION_1 = 1;
|
||||
public static final Integer LATEST_ROLLBACK_PLAN_VERSION = ROLLBACK_PLAN_VERSION_1;
|
||||
@@ -59,10 +60,12 @@ public class BaseRollbackPlanActionExecutor<T extends HoodieRecordPayload, I, K,
|
||||
HoodieTable<T, I, K, O> table,
|
||||
String instantTime,
|
||||
HoodieInstant instantToRollback,
|
||||
boolean skipTimelinePublish) {
|
||||
boolean skipTimelinePublish,
|
||||
boolean shouldRollbackUsingMarkers) {
|
||||
super(context, config, table, instantTime);
|
||||
this.instantToRollback = instantToRollback;
|
||||
this.skipTimelinePublish = skipTimelinePublish;
|
||||
this.shouldRollbackUsingMarkers = shouldRollbackUsingMarkers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +87,7 @@ public class BaseRollbackPlanActionExecutor<T extends HoodieRecordPayload, I, K,
|
||||
* @return
|
||||
*/
|
||||
private BaseRollbackPlanActionExecutor.RollbackStrategy getRollbackStrategy() {
|
||||
if (config.shouldRollbackUsingMarkers()) {
|
||||
if (shouldRollbackUsingMarkers) {
|
||||
return new MarkerBasedRollbackStrategy(table, context, config, instantTime);
|
||||
} else {
|
||||
return new ListingBasedRollbackStrategy(table, context, config, instantTime);
|
||||
|
||||
Reference in New Issue
Block a user