@@ -120,6 +120,7 @@ List<Pair<String, HoodieRollbackStat>> maybeDeleteAndCollectStats(HoodieEngineCo
120120 return partitionToRollbackStats .stream ();
121121 } else if (!rollbackRequest .getLogBlocksToBeDeleted ().isEmpty ()) {
122122 HoodieLogFormat .Writer writer = null ;
123+ final Path filePath ;
123124 try {
124125 String fileId = rollbackRequest .getFileId ();
125126 String latestBaseInstant = rollbackRequest .getLatestBaseInstant ();
@@ -135,7 +136,10 @@ List<Pair<String, HoodieRollbackStat>> maybeDeleteAndCollectStats(HoodieEngineCo
135136 if (doDelete ) {
136137 Map <HoodieLogBlock .HeaderMetadataType , String > header = generateHeader (instantToRollback .getTimestamp ());
137138 // if update belongs to an existing log file
138- writer .appendBlock (new HoodieCommandBlock (header ));
139+ // use the log file path from AppendResult in case the file handle may roll over
140+ filePath = writer .appendBlock (new HoodieCommandBlock (header )).logFile ().getPath ();
141+ } else {
142+ filePath = writer .getLogFile ().getPath ();
139143 }
140144 } catch (IOException | InterruptedException io ) {
141145 throw new HoodieRollbackException ("Failed to rollback for instant " + instantToRollback , io );
@@ -153,7 +157,7 @@ List<Pair<String, HoodieRollbackStat>> maybeDeleteAndCollectStats(HoodieEngineCo
153157 // getFileStatus would reflect correct stats and FileNotFoundException is not thrown in
154158 // cloud-storage : HUDI-168
155159 Map <FileStatus , Long > filesToNumBlocksRollback = Collections .singletonMap (
156- metaClient .getFs ().getFileStatus (Objects .requireNonNull (writer ). getLogFile (). getPath ( )),
160+ metaClient .getFs ().getFileStatus (Objects .requireNonNull (filePath )),
157161 1L
158162 );
159163
0 commit comments