Skip to content

Commit

Permalink
fix await bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
shuke987 committed Dec 19, 2024
1 parent 99bc691 commit 1084bba
Show file tree
Hide file tree
Showing 26 changed files with 127 additions and 127 deletions.
4 changes: 2 additions & 2 deletions regression-test/plugins/plugin_compaction.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Suite.metaClass.checkComactionStatus = { String backendIP, String backendPort, S
}

Suite.metaClass.assertCompactionStatus = { String backendIP, String backendPort, String tabletID ->
Awaitility.await().untilAsserted({
Awaitility.await().pollInterval(1, SECONDS).untilAsserted({
assert checkComactionStatus(backendIP, backendPort, tabletID)
})
}

Suite.metaClass.assertCompactionStatusAtMost = { String backendIP, String backendPort, String tabletID, long t, TimeUnit tu ->
Awaitility.await().atMost(t, tu).untilAsserted({
Awaitility.await().atMost(t, tu).pollInterval(1, SECONDS).untilAsserted({
assert checkComactionStatus(backendIP, backendPort, tabletID)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ suite('test_delete_sign_with_cumu_compaction') {

def waitForCompaction = { be_host, be_http_port ->
// wait for all compactions done
Awaitility.await().atMost(30, SECONDS).pollInterval(1, SECONDS).until {
Awaitility.await().atMost(30, SECONDS).pollDelay(10, TimeUnit.SECONDS).pollInterval(1, SECONDS).untilAsserted {
String tablet_id = tablet[0]
StringBuilder sb = new StringBuilder();
sb.append("curl -X GET http://${be_host}:${be_http_port}")
Expand All @@ -85,7 +85,7 @@ suite('test_delete_sign_with_cumu_compaction') {
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())

!compactionStatus.run_status
assert !compactionStatus.run_status
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ suite("test_cloud_mow_stale_resp_load_compaction_conflict", "nonConcurrent") {
Assert.assertEquals("success", compactJson.status.toLowerCase())

// wait for full compaction to complete
Awaitility.await().atMost(3, TimeUnit.SECONDS).pollDelay(200, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS).until(
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollDelay(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
{
(code, out, err) = be_get_compaction_status(tabletBackend.Host, tabletBackend.HttpPort, tabletId)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ suite("test_partial_update_compaction_with_higher_version", "nonConcurrent") {
Assert.assertEquals("success", compactJson.status.toLowerCase())

// wait for full compaction to complete
Awaitility.await().atMost(3, TimeUnit.SECONDS).pollDelay(200, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS).until(
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollDelay(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
{
(code, out, err) = be_get_compaction_status(tabletBackend.Host, tabletBackend.HttpPort, tabletId)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ suite("test_partial_update_conflict_skip_compaction", "nonConcurrent") {
Assert.assertEquals("success", compactJson.status.toLowerCase())

// wait for full compaction to complete
Awaitility.await().atMost(3, TimeUnit.SECONDS).pollDelay(200, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS).until(
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollDelay(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
{
(code, out, err) = be_get_compaction_status(tabletBackend.Host, tabletBackend.HttpPort, tabletId)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ suite("test_partial_update_skip_compaction", "nonConcurrent") {
Assert.assertEquals("success", compactJson.status.toLowerCase())

// wait for full compaction to complete
Awaitility.await().atMost(3, TimeUnit.SECONDS).pollDelay(200, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS).until(
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollDelay(10, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
{
(code, out, err) = be_get_compaction_status(tabletBackend.Host, tabletBackend.HttpPort, tabletId)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
"""
int max_try_secs = 1200
String res = "NOT_FINISHED"
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -66,7 +66,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ADD COLUMN value3 CHAR(100) DEFAULT 'A';
"""
max_try_secs = 1200
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand Down Expand Up @@ -113,7 +113,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ALTER TABLE ${tbName1}
DROP COLUMN value3;
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -128,7 +128,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ALTER TABLE ${tbName1}
ADD COLUMN value3 CHAR(100) DEFAULT 'A';
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -146,7 +146,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ALTER TABLE ${tbName1}
ADD COLUMN k2 CHAR(10) KEY DEFAULT 'A';
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand Down Expand Up @@ -190,7 +190,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ALTER TABLE ${tbName1}
DROP COLUMN value3;
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -206,7 +206,7 @@ suite("test_alter_table_column_with_delete_drop_column_dup_key", "schema_change"
ADD COLUMN value3 CHAR(100) DEFAULT 'A';
"""

Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ suite("test_alter_table_column_with_delete_drop_column_unique_key", "schema_chan
"""
int max_try_secs = 1200
String res = "NOT_FINISHED"
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -67,7 +67,7 @@ suite("test_alter_table_column_with_delete_drop_column_unique_key", "schema_chan
ALTER TABLE ${tbName1}
ADD COLUMN value3 CHAR(100) DEFAULT 'A';
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand Down Expand Up @@ -115,7 +115,7 @@ suite("test_alter_table_column_with_delete_drop_column_unique_key", "schema_chan
ALTER TABLE ${tbName1}
DROP COLUMN k2;
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -130,7 +130,7 @@ suite("test_alter_table_column_with_delete_drop_column_unique_key", "schema_chan
ALTER TABLE ${tbName1}
ADD COLUMN value3 CHAR(100) DEFAULT 'A';
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand All @@ -148,7 +148,7 @@ suite("test_alter_table_column_with_delete_drop_column_unique_key", "schema_chan
ALTER TABLE ${tbName1}
ADD COLUMN k2 CHAR(10) KEY DEFAULT 'A';
"""
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ suite("test_agg_keys_schema_change_datev2") {

sql """ alter table ${tbName} add column `datev3` datev2 DEFAULT '2022-01-01' """
int max_try_secs = 300
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand All @@ -102,7 +102,7 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand All @@ -125,7 +125,7 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} add column `datev3` datetimev2 DEFAULT '2022-01-01 11:11:11' """
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand All @@ -141,7 +141,7 @@ suite("test_agg_keys_schema_change_datev2") {
sql """sync"""
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand All @@ -165,7 +165,7 @@ suite("test_agg_keys_schema_change_datev2") {
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} add column `datev3` datetimev2(3) DEFAULT '2022-01-01 11:11:11.111' """

Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand All @@ -191,7 +191,7 @@ suite("test_agg_keys_schema_change_datev2") {
qt_sql """select * from ${tbName} ORDER BY `datek1`;"""
sql """ alter table ${tbName} drop column `datev3` """

Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ suite("test_schema_change_varchar_to_datev2") {

sql """ alter table ${tbName} modify column `k3` date; """
int max_try_secs = 300
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).await().until(() -> {
Awaitility.await().atMost(max_try_secs, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String result = getJobState(tbName)
if (result == "FINISHED") {
return true;
Expand Down
Loading

0 comments on commit 1084bba

Please sign in to comment.