[HUDI-3732] Fixing rollback validation (#5157)
* Fixing rollback validation * Adding tests
This commit is contained in:
committed by
GitHub
parent
80011df995
commit
73a21092f8
@@ -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()));
|
||||
});
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user