Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]use awaitility.await() #41514

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -14,6 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.awaitility.Awaitility
import static java.util.concurrent.TimeUnit.SECONDS

suite("test_materialized_view_bitmap", "rollup") {

def tbName1 = "test_materialized_view_bitmap"
Expand All @@ -34,19 +38,14 @@ suite("test_materialized_view_bitmap", "rollup") {

sql "CREATE MATERIALIZED VIEW test_neg as select k1,bitmap_union(to_bitmap(k2)), bitmap_union(to_bitmap(k3)) FROM ${tbName1} GROUP BY k1;"
max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}

explain {
Expand Down
48 changes: 16 additions & 32 deletions regression-test/suites/rollup/test_materialized_view_date.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.awaitility.Awaitility
import static java.util.concurrent.TimeUnit.SECONDS

suite("test_materialized_view_date", "rollup") {

def tbName1 = "test_materialized_view_date"
Expand All @@ -40,70 +44,50 @@ suite("test_materialized_view_date", "rollup") {

int max_try_secs = 120
sql "CREATE materialized VIEW amt_max1 AS SELECT store_id, max(sale_date1) FROM ${tbName1} GROUP BY store_id;"
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}
Thread.sleep(2000)
max_try_secs = 120
sql "CREATE materialized VIEW amt_max2 AS SELECT store_id, max(sale_datetime1) FROM ${tbName1} GROUP BY store_id;"
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}
Thread.sleep(2000)
max_try_secs = 120
sql "CREATE materialized VIEW amt_max3 AS SELECT store_id, max(sale_datetime2) FROM ${tbName1} GROUP BY store_id;"
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}
Thread.sleep(2000)
max_try_secs = 120
sql "CREATE materialized VIEW amt_max4 AS SELECT store_id, max(sale_datetime3) FROM ${tbName1} GROUP BY store_id;"
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}


Expand Down
15 changes: 7 additions & 8 deletions regression-test/suites/rollup/test_materialized_view_hll.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.awaitility.Awaitility
import static java.util.concurrent.TimeUnit.SECONDS

suite("test_materialized_view_hll", "rollup") {

def tbName1 = "test_materialized_view_hll"
Expand All @@ -36,19 +40,14 @@ suite("test_materialized_view_hll", "rollup") {

sql "CREATE materialized VIEW amt_count AS SELECT store_id, hll_union(hll_hash(sale_amt)) FROM ${tbName1} GROUP BY store_id;"
max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}

qt_sql "DESC ${tbName1} ALL;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.awaitility.Awaitility
import static java.util.concurrent.TimeUnit.SECONDS

suite("test_materialized_view_hll_with_light_sc", "rollup") {

def tbName1 = "test_materialized_view_hll_with_light_sc"
Expand All @@ -36,19 +40,14 @@ suite("test_materialized_view_hll_with_light_sc", "rollup") {

sql "CREATE materialized VIEW amt_count1 AS SELECT store_id, hll_union(hll_hash(sale_amt)) FROM ${tbName1} GROUP BY store_id;"
max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
sleep(3000);
return true;
}
return false;
}

qt_sql "DESC ${tbName1} ALL;"
Expand Down
35 changes: 13 additions & 22 deletions regression-test/suites/rollup_p0/test_materialized_view.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import org.awaitility.Awaitility
import static java.util.concurrent.TimeUnit.SECONDS

suite("test_materialized_view") {

def tbName1 = "test_materialized_view1"
Expand Down Expand Up @@ -47,34 +51,26 @@ suite("test_materialized_view") {
"""
sql "CREATE materialized VIEW amt_sum AS SELECT store_id, sum(sale_amt) FROM ${tbName1} GROUP BY store_id;"
int max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
return true;
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return false;
}
}
sql "CREATE materialized VIEW seller_id_order AS SELECT store_id,seller_id, sale_amt FROM ${tbName2} ORDER BY store_id,seller_id;"
max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName2)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
return true;
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return false;
}
}
sql "SHOW ALTER TABLE MATERIALIZED VIEW WHERE TableName='${tbName1}';"
Expand All @@ -97,19 +93,14 @@ suite("test_materialized_view") {

sql "CREATE materialized VIEW amt_count AS SELECT store_id, count(sale_amt) FROM ${tbName1} GROUP BY store_id;"
max_try_secs = 60
while (max_try_secs--) {
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobState(tbName1)
if (res == "FINISHED" || res == "CANCELLED") {
assertEquals("FINISHED", res)
sleep(3000)
break
} else {
Thread.sleep(2000)
if (max_try_secs < 1) {
println "test timeout," + "state:" + res
assertEquals("FINISHED",res)
}
return true;
}
return false;
}
sql "SELECT store_id, count(sale_amt) FROM ${tbName1} GROUP BY store_id;"
order_qt_sql "DESC ${tbName1} ALL;"
Expand Down
Loading