Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public void testTTL() throws SQLException, InterruptedException {
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")) {
Expand All @@ -118,7 +118,7 @@ public void testTTL() throws SQLException, InterruptedException {
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()) {
Expand All @@ -132,7 +132,7 @@ public void testTTL() throws SQLException, InterruptedException {
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());
}
Expand All @@ -148,12 +148,12 @@ public void testTTL() throws SQLException, InterruptedException {
}

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")) {
Expand All @@ -169,13 +169,14 @@ public void testTTL() throws SQLException, InterruptedException {
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")) {
Expand All @@ -189,13 +190,14 @@ public void testTTL() throws SQLException, InterruptedException {
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")) {
Expand All @@ -206,7 +208,7 @@ public void testTTL() throws SQLException, InterruptedException {
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()) {
Expand All @@ -220,7 +222,7 @@ public void testTTL() throws SQLException, InterruptedException {
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());
}
Expand All @@ -231,7 +233,7 @@ public void testTTL() throws SQLException, InterruptedException {
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());
}
Expand All @@ -246,17 +248,19 @@ public void testTTL() throws SQLException, InterruptedException {
}

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;
Expand Down
Loading