nsivabalan commented on a change in pull request #4971:
URL: https://github.com/apache/hudi/pull/4971#discussion_r823967305
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java
##########
@@ -954,29 +954,42 @@ private HoodieTimeline
getInflightTimelineExcludeCompactionAndClustering(HoodieT
return inflightTimelineExcludeClusteringCommit;
}
- private Option<HoodiePendingRollbackInfo>
getPendingRollbackInfo(HoodieTableMetaClient metaClient, String
commitToRollback) {
- return getPendingRollbackInfos(metaClient).getOrDefault(commitToRollback,
Option.empty());
+ protected Option<HoodiePendingRollbackInfo>
getPendingRollbackInfo(HoodieTableMetaClient metaClient, String
commitToRollback) {
+ return getPendingRollbackInfo(metaClient, commitToRollback, true);
+ }
+
+ protected Option<HoodiePendingRollbackInfo>
getPendingRollbackInfo(HoodieTableMetaClient metaClient, String
commitToRollback, boolean ignoreCompactionAndClusteringInstants) {
+ return getPendingRollbackInfos(metaClient,
ignoreCompactionAndClusteringInstants).getOrDefault(commitToRollback,
Option.empty());
+ }
+
+ protected Map<String, Option<HoodiePendingRollbackInfo>>
getPendingRollbackInfos(HoodieTableMetaClient metaClient) {
+ return getPendingRollbackInfos(metaClient, true);
}
/**
* Fetch map of pending commits to be rolled-back to {@link
HoodiePendingRollbackInfo}.
* @param metaClient instance of {@link HoodieTableMetaClient} to use.
* @return map of pending commits to be rolled-back instants to Rollback
Instant and Rollback plan Pair.
*/
- protected Map<String, Option<HoodiePendingRollbackInfo>>
getPendingRollbackInfos(HoodieTableMetaClient metaClient) {
+ protected Map<String, Option<HoodiePendingRollbackInfo>>
getPendingRollbackInfos(HoodieTableMetaClient metaClient, boolean
ignoreCompactionAndClusteringInstants) {
List<HoodieInstant> instants =
metaClient.getActiveTimeline().filterPendingRollbackTimeline().getInstants().collect(Collectors.toList());
Map<String, Option<HoodiePendingRollbackInfo>> infoMap = new HashMap<>();
for (HoodieInstant instant : instants) {
try {
HoodieRollbackPlan rollbackPlan =
RollbackUtils.getRollbackPlan(metaClient, instant);
String action = rollbackPlan.getInstantToRollback().getAction();
- if (!HoodieTimeline.COMPACTION_ACTION.equals(action)) {
- boolean isClustering =
HoodieTimeline.REPLACE_COMMIT_ACTION.equals(action)
- && ClusteringUtils.getClusteringPlan(metaClient,
instant).isPresent();
- if (!isClustering) {
- String instantToRollback =
rollbackPlan.getInstantToRollback().getCommitTime();
- infoMap.putIfAbsent(instantToRollback, Option.of(new
HoodiePendingRollbackInfo(instant, rollbackPlan)));
+ if (ignoreCompactionAndClusteringInstants) {
+ if (!HoodieTimeline.COMPACTION_ACTION.equals(action)) {
+ boolean isClustering =
HoodieTimeline.REPLACE_COMMIT_ACTION.equals(action)
+ && ClusteringUtils.getClusteringPlan(metaClient, new
HoodieInstant(true, rollbackPlan.getInstantToRollback().getAction(),
+
rollbackPlan.getInstantToRollback().getCommitTime())).isPresent();
+ if (!isClustering) {
+ String instantToRollback =
rollbackPlan.getInstantToRollback().getCommitTime();
+ infoMap.putIfAbsent(instantToRollback, Option.of(new
HoodiePendingRollbackInfo(instant, rollbackPlan)));
+ }
}
+ } else {
+
infoMap.putIfAbsent(rollbackPlan.getInstantToRollback().getCommitTime(),
Option.of(new HoodiePendingRollbackInfo(instant, rollbackPlan)));
Review comment:
not sure I can get your point.
List<HoodieInstant> instants =
metaClient.getActiveTimeline().filterPendingRollbackTimeline().getInstants().collect(Collectors.toList());
this will return only pending rollbacks. if the rollback was removed at some
place, this won't return that resp rollback instant. can you clarify more
please.
--
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]