1
0

[HUDI-3732] Fixing rollback validation (#5157)

* Fixing rollback validation

* Adding tests
This commit is contained in:
Sivabalan Narayanan
2022-03-31 04:55:24 -07:00
committed by GitHub
parent 80011df995
commit 73a21092f8
4 changed files with 49 additions and 1 deletions

View File

@@ -136,6 +136,9 @@ public abstract class BaseRestoreActionExecutor<T extends HoodieRecordPayload, I
.filter(instant -> HoodieActiveTimeline.GREATER_THAN.test(instant.getTimestamp(), restoreInstantTime))
.collect(Collectors.toList());
instantsToRollback.forEach(entry -> {
if (entry.isCompleted()) {
table.getActiveTimeline().deleteCompletedRollback(entry);
}
table.getActiveTimeline().deletePending(new HoodieInstant(HoodieInstant.State.INFLIGHT, HoodieTimeline.ROLLBACK_ACTION, entry.getTimestamp()));
table.getActiveTimeline().deletePending(new HoodieInstant(HoodieInstant.State.REQUESTED, HoodieTimeline.ROLLBACK_ACTION, entry.getTimestamp()));
});

View File

@@ -186,7 +186,12 @@ public abstract class BaseRollbackActionExecutor<T extends HoodieRecordPayload,
}
}
List<String> inflights = inflightAndRequestedCommitTimeline.getInstants().map(HoodieInstant::getTimestamp)
List<String> inflights = inflightAndRequestedCommitTimeline.getInstants().filter(instant -> {
if (!instant.getAction().equals(HoodieTimeline.REPLACE_COMMIT_ACTION)) {
return true;
}
return !ClusteringUtils.isPendingClusteringInstant(table.getMetaClient(), instant);
}).map(HoodieInstant::getTimestamp)
.collect(Collectors.toList());
if ((instantTimeToRollback != null) && !inflights.isEmpty()
&& (inflights.indexOf(instantTimeToRollback) != inflights.size() - 1)) {