hudi-agent commented on code in PR #18237:
URL: https://github.com/apache/hudi/pull/18237#discussion_r3430787802


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriterTableVersionSix.java:
##########
@@ -315,7 +316,12 @@ void compactIfNecessary(BaseHoodieWriteClient<?,I,?,O> 
writeClient, Option<Strin
 
   @Override
   protected void executeClean(BaseHoodieWriteClient writeClient, String 
instantTime) {
-    writeClient.clean(createCleanTimestamp(instantTime));
+    String cleanInstant = createCleanTimestamp(instantTime);
+    if 
(getMetadataMetaClient().getActiveTimeline().getCleanerTimeline().filterCompletedInstants().containsInstant(cleanInstant))
 {
+      LOG.info("Clean with same {} time is already present in the timeline, 
hence skipping to clean", cleanInstant);

Review Comment:
   🤖 nit: "skipping to clean" reads a bit oddly — could you rephrase to 
something like "already present in the timeline, skipping clean"?
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriterTableVersionSix.java:
##########
@@ -341,14 +347,17 @@ private String createRollbackTimestamp(String timestamp) {
     return timestamp + getRollbackOperationSuffix();
   }
 
-  private String createCleanTimestamp(String timestamp) {
-    return timestamp + getCleanOperationSuffix();
+  @VisibleForTesting
+  static String createCleanTimestamp(String timestamp) {
+    return timestamp + CLEAN_OPERATION_SUFFIX;
   }
 
   private String createRestoreTimestamp(String timestamp) {
     return timestamp + getRestoreOperationSuffix();
   }
 
+  private static final String CLEAN_OPERATION_SUFFIX = "002";

Review Comment:
   🤖 nit: declaring a `static final` constant between instance methods is easy 
to miss — would it be worth moving `CLEAN_OPERATION_SUFFIX` to the top of the 
class with the other field declarations?
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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