vinothchandar commented on code in PR #12206:
URL: https://github.com/apache/hudi/pull/12206#discussion_r1831968583


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/MarkerBasedRollbackStrategy.java:
##########
@@ -91,4 +101,83 @@ public List<HoodieRollbackRequest> 
getRollbackRequests(HoodieInstant instantToRo
       throw new HoodieRollbackException("Error rolling back using marker files 
written for " + instantToRollback, e);
     }
   }
+
+  protected HoodieRollbackRequest createRollbackRequestForCreateMerge(String 
fileId,
+                                                                      String 
partitionPath,
+                                                                      
StoragePath filePath,
+                                                                      
HoodieInstant instantToRollback) {
+    if (table.version().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return new HoodieRollbackRequest(partitionPath, fileId, 
instantToRollback.getTimestamp(),
+          Collections.singletonList(filePath.toString()), 
Collections.emptyMap());
+    } else {
+      String baseInstantTime = null;
+      if (FSUtils.isBaseFile(filePath)) {
+        HoodieBaseFile baseFileToDelete = new 
HoodieBaseFile(filePath.toString());
+        fileId = baseFileToDelete.getFileId();
+        baseInstantTime = baseFileToDelete.getCommitTime();

Review Comment:
   yes. 



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/MarkerBasedRollbackStrategy.java:
##########
@@ -91,4 +101,83 @@ public List<HoodieRollbackRequest> 
getRollbackRequests(HoodieInstant instantToRo
       throw new HoodieRollbackException("Error rolling back using marker files 
written for " + instantToRollback, e);
     }
   }
+
+  protected HoodieRollbackRequest createRollbackRequestForCreateMerge(String 
fileId,
+                                                                      String 
partitionPath,
+                                                                      
StoragePath filePath,
+                                                                      
HoodieInstant instantToRollback) {
+    if (table.version().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {
+      return new HoodieRollbackRequest(partitionPath, fileId, 
instantToRollback.getTimestamp(),
+          Collections.singletonList(filePath.toString()), 
Collections.emptyMap());
+    } else {
+      String baseInstantTime = null;
+      if (FSUtils.isBaseFile(filePath)) {
+        HoodieBaseFile baseFileToDelete = new 
HoodieBaseFile(filePath.toString());
+        fileId = baseFileToDelete.getFileId();
+        baseInstantTime = baseFileToDelete.getCommitTime();
+      } else if (FSUtils.isLogFile(filePath)) {
+        throw new HoodieRollbackException("Log files should have only APPEND 
as IOTypes " + filePath);
+      }
+      Objects.requireNonNull(fileId, "Cannot find valid fileId from path: " + 
filePath);
+      Objects.requireNonNull(baseInstantTime, "Cannot find valid base instant 
from path: " + filePath);
+      return new HoodieRollbackRequest(partitionPath, fileId, baseInstantTime,
+          Collections.singletonList(filePath.toString()),
+          Collections.emptyMap());
+    }
+  }
+
+  protected HoodieRollbackRequest createRollbackRequestForAppend(String fileId,
+                                                                 String 
relativePartitionPath,
+                                                                 StoragePath 
filePath,
+                                                                 HoodieInstant 
instantToRollback,
+                                                                 String 
filePathToRollback) {
+    if (table.version().greaterThanOrEquals(HoodieTableVersion.EIGHT)) {

Review Comment:
   yes



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