This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 0f9a8e748f [core] Fix auto tags skipping periods with
tag.creation-delay (#11185)
0f9a8e748f is described below
commit 0f9a8e748f4b2c11b452d7c6df79bbc79202bb13
Author: chenjian2664 <[email protected]>
AuthorDate: Mon Nov 16 21:04:42 2026 +0800
[core] Fix auto tags skipping periods with tag.creation-delay (#11185)
---
.../org/apache/paimon/tag/TagAutoCreation.java | 6 ++++-
.../org/apache/paimon/tag/TagAutoManagerTest.java | 27 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
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 b6dd51f360..1fd81ef305 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
@@ -168,7 +168,11 @@ public class TagAutoCreation {
LOG.info("The next tag time is {}.", nextTag);
if (nextTag == null
|| isAfterOrEqual(time.minus(delay),
periodHandler.nextTagTime(nextTag))) {
- LocalDateTime thisTag = periodHandler.normalizeToPreviousTag(time);
+ // The first tag is created at once. Later tags are named from the
delayed time checked
+ // above, otherwise a tag is created before its delay passes and
the due one is skipped.
+ LocalDateTime thisTag =
+ periodHandler.normalizeToPreviousTag(
+ nextTag == null ? time : time.minus(delay));
LOG.info("Create tag for snapshot {} with time {}.",
snapshot.id(), thisTag);
if (automaticCompletion && nextTag != null) {
thisTag = nextTag;
diff --git
a/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoManagerTest.java
b/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoManagerTest.java
index fb01f2d557..c332e26310 100644
--- a/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoManagerTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoManagerTest.java
@@ -128,6 +128,33 @@ public class TagAutoManagerTest extends
PrimaryKeyTableTestBase {
commit.close();
}
+ @Test
+ public void testTagDelayDoesNotSkipPeriods() throws Exception {
+ Options options = new Options();
+ options.set(TAG_AUTOMATIC_CREATION, TagCreationMode.WATERMARK);
+ options.set(TAG_CREATION_PERIOD, TagCreationPeriod.HOURLY);
+ options.set(TAG_CREATION_DELAY, Duration.ofMinutes(10));
+ FileStoreTable table = this.table.copy(options.toMap());
+ TableCommitImpl commit =
table.newCommit(commitUser).ignoreEmptyCommit(false);
+ TagManager tagManager = table.store().newTagManager();
+
+ commit.commit(new ManifestCommittable(0,
utcMills("2023-07-18T12:05:00")));
+ assertThat(tagManager.allTagNames()).containsOnly("2023-07-18 11");
+
+ // the delay of hour 12 has not passed
+ commit.commit(new ManifestCommittable(1,
utcMills("2023-07-18T13:05:00")));
+ assertThat(tagManager.allTagNames()).containsOnly("2023-07-18 11");
+
+ // the delay of hour 12 has passed, but the delay of hour 13 has not
+ commit.commit(new ManifestCommittable(2,
utcMills("2023-07-18T14:05:00")));
+ assertThat(tagManager.allTagNames()).containsOnly("2023-07-18 11",
"2023-07-18 12");
+
+ commit.commit(new ManifestCommittable(3,
utcMills("2023-07-18T15:05:00")));
+ assertThat(tagManager.allTagNames())
+ .containsOnly("2023-07-18 11", "2023-07-18 12", "2023-07-18
13");
+ commit.close();
+ }
+
@Test
public void testTagSinkWatermark() throws Exception {
Options options = new Options();