This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-0.6
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git

commit bdb2068079186648675ba0628db251d2020b0d0f
Author: Jingsong <[email protected]>
AuthorDate: Tue Dec 19 16:38:58 2023 +0800

    [core] Use isAutoTag in TagAutoCreation
---
 .../main/java/org/apache/paimon/tag/TagAutoCreation.java    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java 
b/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
index c4e9f7948..ba7069bd8 100644
--- a/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
+++ b/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
@@ -67,7 +67,7 @@ public class TagAutoCreation {
 
         this.periodHandler.validateDelay(delay);
 
-        SortedMap<Snapshot, String> tags = tagManager.tags(t -> 
!t.startsWith("savepoint"));
+        SortedMap<Snapshot, String> tags = tagManager.tags(this::isAutoTag);
 
         if (tags.isEmpty()) {
             this.nextSnapshot =
@@ -81,6 +81,15 @@ public class TagAutoCreation {
         }
     }
 
+    private boolean isAutoTag(String tag) {
+        try {
+            periodHandler.tagToTime(tag);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
     public boolean forceCreatingSnapshot() {
         return timeExtractor instanceof ProcessTimeExtractor
                 && (nextTag == null
@@ -122,7 +131,7 @@ public class TagAutoCreation {
             nextTag = periodHandler.nextTagTime(thisTag);
 
             if (numRetainedMax != null) {
-                SortedMap<Snapshot, String> tags = tagManager.tags(t -> 
!t.startsWith("savepoint"));
+                SortedMap<Snapshot, String> tags = 
tagManager.tags(this::isAutoTag);
                 if (tags.size() > numRetainedMax) {
                     int toDelete = tags.size() - numRetainedMax;
                     int i = 0;

Reply via email to