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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/RollbackHelperV1.java:
##########
@@ -168,6 +255,23 @@ public List<HoodieRollbackStat> 
performRollback(HoodieEngineContext context, Str
     return addLogFilesFromPreviousFailedRollbacksToStat(context, 
mergedRollbackStatByPartitionPath, logPaths);
   }
 
+  /**
+   * Collect all file info that needs to be rolled back, using the V1-specific
+   * 6-param {@code maybeDeleteAndCollectStats} so V6 log-block requests are 
handled correctly.
+   */
+  @Override
+  public List<HoodieRollbackStat> collectRollbackStats(HoodieEngineContext 
context, HoodieInstant instantToRollback,
+                                                       
List<HoodieRollbackRequest> rollbackRequests) {
+    int parallelism = Math.max(Math.min(rollbackRequests.size(), 
config.getRollbackParallelism()), 1);
+    context.setJobStatus(this.getClass().getSimpleName(), "Collect rollback 
stats: " + config.getTableName());
+    List<SerializableHoodieRollbackRequest> serializableRequests = 
rollbackRequests.stream()
+        
.map(SerializableHoodieRollbackRequest::new).collect(Collectors.toList());
+    return context.reduceByKey(
+        maybeDeleteAndCollectStats(context, EMPTY_STRING, instantToRollback,

Review Comment:
   🤖 Passing `EMPTY_STRING` as `instantTime` here flows into 
`WriteMarkersFactory.get(config.getMarkersType(), table, instantTime)` inside 
the 6-param `maybeDeleteAndCollectStats`, which creates markers under 
`.hoodie/.temp//` — a malformed path. The parent class's implementation (before 
this PR) handled `logBlocksToBeDeleted` in its 5-param method without any 
marker creation. Could you either pass the rollback instant time 
(`instantToRollback.requestedTime()`) instead of `EMPTY_STRING`, or skip marker 
creation when `doDelete=false`?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/RollbackHelper.java:
##########
@@ -146,14 +151,25 @@ List<Pair<String, HoodieRollbackStat>> 
maybeDeleteAndCollectStats(HoodieEngineCo
                   )
               .withStorage(metaClient.getStorage())
               .withTableVersion(tableVersion)
-              .withFileExtension(HoodieLogFile.DELTA_EXTENSION).build();
+              .withFileExtension(HoodieLogFile.DELTA_EXTENSION);
+

Review Comment:
   🤖 Good instinct — I traced through the code and confirmed that for V8+, 
`getLogBlocksToBeDeleted()` is always empty because (a) marker-based rollbacks 
use `IOType.CREATE` for log files, and (b) listing-based rollback has the 
`isTableVersionLessThanEight` guard. The new `checkArgument` in 
`RollbackHelper.maybeDeleteAndCollectStats` now enforces this invariant 
explicitly, which is a nice safety net.



-- 
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]

Reply via email to