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


##########
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);
+
+          String logVersionKey = 
logVersionLookupKey(rollbackRequest.getPartitionPath(), fileId, 
rollbackRequest.getLatestBaseInstant());
+          Pair<Integer, String> preComputedVersion = 
logVersionMap.get(logVersionKey);
+          if (preComputedVersion != null) {
+            writerBuilder.withLogVersion(preComputedVersion.getLeft())
+                .withLogWriteToken(preComputedVersion.getRight());
+          }

Review Comment:
   logWriteToken is going to take up UNKNOWN_WRITE_TOKEN in both cases (v6 and 
greater). but if we do not set here, it could lead to another listing call w/n. 
   
   ```
         if (logVersion == null) {
           LOG.info("Computing the next log version for {} in {}", logFileId, 
parentPath);
           boolean useBaseVersion = 
tableVersion.greaterThanOrEquals(HoodieTableVersion.EIGHT)
               &&  logWriteToken != null;
           if (useBaseVersion) {
             // the log format writer handles the existence check.
             logVersion = HoodieLogFile.LOGFILE_BASE_VERSION;
           } else {
             // compute from storage (expensive)
             Option<Pair<Integer, String>> versionAndWriteToken =
                 FSUtils.getLatestLogVersion(storage, parentPath, logFileId, 
fileExtension, instantTime);
             if (versionAndWriteToken.isPresent()) {
               logVersion = versionAndWriteToken.get().getKey();
               logWriteToken = versionAndWriteToken.get().getValue();
             } else {
               // this is the case where there is no existing log-file.
               logVersion = HoodieLogFile.LOGFILE_BASE_VERSION;
               logWriteToken = UNKNOWN_WRITE_TOKEN;
             }
           }
           LOG.info("Computed the next log version for {} in {} as {} with 
write-token {}", logFileId, parentPath, logVersion, logWriteToken);
         }
   
         if (logWriteToken == null) {
           fileLen = 0L;
           logWriteToken = UNKNOWN_WRITE_TOKEN;
         }
   ```



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