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

jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new b652dddf41c Make IoTDBTtlIT stable under slow CI (#19004)
b652dddf41c is described below

commit b652dddf41c41a86329845fac4214ec034a87575
Author: Caideyipi <[email protected]>
AuthorDate: Mon Oct 26 11:02:35 2026 +0800

    Make IoTDBTtlIT stable under slow CI (#19004)
    
    * Fix TTL integration test timing flakiness
    
    * Preserve TTL unset coverage with wide timing windows
---
 .../java/org/apache/iotdb/db/it/IoTDBTtlIT.java    | 40 ++++++++++++----------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java
index a0ad94a9944..d2dd50ebcf5 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTtlIT.java
@@ -102,12 +102,12 @@ public class IoTDBTtlIT {
       for (int i = 0; i < 100; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 100 + i, i));
+                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 1000000 + i, i));
       }
       for (int i = 0; i < 100; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 100000 + i, i));
+                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 10000000 + i, i));
       }
 
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.TTL_SG1")) {
@@ -118,7 +118,7 @@ public class IoTDBTtlIT {
         assertEquals(200, cnt);
       }
 
-      statement.execute("SET TTL TO root.TTL_SG1 10000");
+      statement.execute("SET TTL TO root.TTL_SG1 5000000");
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.TTL_SG1")) {
         int cnt = 0;
         while (resultSet.next()) {
@@ -132,7 +132,7 @@ public class IoTDBTtlIT {
         try {
           statement.execute(
               String.format(
-                  "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", 
now - 500000 + i, i));
+                  "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", 
now - 8000000 + i, i));
         } catch (SQLException e) {
           assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), 
e.getErrorCode());
         }
@@ -148,12 +148,12 @@ public class IoTDBTtlIT {
       }
 
       statement.execute("UNSET TTL TO root.TTL_SG1");
-      // make sure other nodes have applied UNSET TTL
-      Thread.sleep(1000);
+      // UNSET TTL waits for the procedure to update all DataNode TTL caches.
+      // Stay outside the previous TTL so these inserts verify that UNSET TTL 
took effect.
       for (int i = 0; i < 100; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 30000 + i, i));
+                "INSERT INTO root.TTL_SG1(timestamp, s1) VALUES (%d, %d)", now 
- 8000000 + i, i));
       }
 
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.TTL_SG1")) {
@@ -169,13 +169,14 @@ public class IoTDBTtlIT {
       for (int i = 0; i < 100; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", 
now - 100 + i, i));
+                "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)",
+                now - 10000000 + i, i));
       }
       for (int i = 100; i < 200; i++) {
         statement.execute(
             String.format(
                 "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)",
-                now - 10000000 + i, i));
+                now - 100000000 + i, i));
       }
 
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.sg.TTL_SG3")) {
@@ -189,13 +190,14 @@ public class IoTDBTtlIT {
       for (int i = 200; i < 300; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", 
now - 100 + i, i));
+                "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)",
+                now - 10000000 + i, i));
       }
       for (int i = 300; i < 400; i++) {
         statement.execute(
             String.format(
                 "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)",
-                now - 10000000 + i, i));
+                now - 100000000 + i, i));
       }
 
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.sg.TTL_SG4")) {
@@ -206,7 +208,7 @@ public class IoTDBTtlIT {
         assertEquals(200, cnt);
       }
 
-      statement.execute("SET TTL TO root.sg.** 100000");
+      statement.execute("SET TTL TO root.sg.** 50000000");
       try (ResultSet resultSet = statement.executeQuery("SELECT * FROM 
root.sg.**")) {
         int cnt = 0;
         while (resultSet.next()) {
@@ -220,7 +222,7 @@ public class IoTDBTtlIT {
           statement.execute(
               String.format(
                   "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)",
-                  now - 5000000 + i, i));
+                  now - 80000000 + i, i));
         } catch (SQLException e) {
           assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), 
e.getErrorCode());
         }
@@ -231,7 +233,7 @@ public class IoTDBTtlIT {
           statement.execute(
               String.format(
                   "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)",
-                  now - 5000000 + i, i));
+                  now - 80000000 + i, i));
         } catch (SQLException e) {
           assertEquals(TSStatusCode.OUT_OF_TTL.getStatusCode(), 
e.getErrorCode());
         }
@@ -246,17 +248,19 @@ public class IoTDBTtlIT {
       }
 
       statement.execute("UNSET TTL TO root.sg.**");
-      // make sure other nodes have applied UNSET TTL
-      Thread.sleep(1000);
+      // UNSET TTL waits for the procedure to update all DataNode TTL caches.
+      // Check wildcard UNSET TTL with data that the previous TTL would reject.
       for (int i = 0; i < 100; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)", 
now - 30000 + i, i));
+                "INSERT INTO root.sg.TTL_SG3(timestamp, s1) VALUES (%d, %d)",
+                now - 80000000 + i, i));
       }
       for (int i = 100; i < 200; i++) {
         statement.execute(
             String.format(
-                "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)", 
now - 30000 + i, i));
+                "INSERT INTO root.sg.TTL_SG4(timestamp, s1) VALUES (%d, %d)",
+                now - 80000000 + i, i));
       }
       try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM 
root.sg.**")) {
         int cnt = 0;

Reply via email to