You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/04/13 16:18:31 UTC

[GitHub] [hudi] yihua commented on a diff in pull request #4296: [HUDI-2997] Skip the corrupt meta file for pending rollback action

yihua commented on code in PR #4296:
URL: https://github.com/apache/hudi/pull/4296#discussion_r849668968


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/AbstractHoodieWriteClient.java:
##########
@@ -898,21 +899,22 @@ private HoodieTimeline getInflightTimelineExcludeCompactionAndClustering(HoodieT
   }
 
   /**
-   * Fetch map of pending commits to be rolledback to {@link HoodiePendingRollbackInfo}.
+   * 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 rolledback instants to Rollback Instant and Rollback plan Pair.
+   * @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) {
-    return metaClient.getActiveTimeline().filterPendingRollbackTimeline().getInstants().map(
-        entry -> {
-          try {
-            HoodieRollbackPlan rollbackPlan = RollbackUtils.getRollbackPlan(metaClient, entry);
-            return Pair.of(rollbackPlan.getInstantToRollback().getCommitTime(), Option.of(new HoodiePendingRollbackInfo(entry, rollbackPlan)));
-          } catch (IOException e) {
-            throw new HoodieIOException("Fetching rollback plan failed for " + entry, e);
-          }
-        }
-    ).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
+    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);
+        infoMap.putIfAbsent(rollbackPlan.getInstantToRollback().getCommitTime(), Option.of(new HoodiePendingRollbackInfo(instant, rollbackPlan)));
+      } catch (IOException e) {
+        LOG.warn("Fetching rollback plan failed for " + infoMap + ", skip the plan", e);

Review Comment:
   #5245 has revised this logic to delete corrupted requested rollback plan if IOException is thrown while trying to get the rollback plan.



-- 
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-unsubscribe@hudi.apache.org

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