Skip to content
Merged
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
33 changes: 14 additions & 19 deletions regression-test/suites/rollup_p0/test_rollup_add_column.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// 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_rollup_add_column") {
def tbName = "test_rollup_add_column"
def rollupName = "test_rollup_add_column_index"
Expand Down Expand Up @@ -41,38 +44,30 @@ suite("test_rollup_add_column") {
"""

sql """ALTER TABLE ${tbName} ADD ROLLUP ${rollupName}(k1, v1);"""
int max_try_secs = 60
while (max_try_secs--) {
int max_try_secs = 120
// if timeout testcase will fail same behaviour as old method.
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobRollupState(tbName)
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)

sql "ALTER TABLE ${tbName} ADD COLUMN k3 INT KEY NOT NULL DEFAULT '3' AFTER k1 TO ${rollupName};"
max_try_secs = 60
while (max_try_secs--) {

Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobColumnState(tbName)
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 "insert into ${tbName} values(1, 2, 3, 4, 5);"
Expand Down
32 changes: 14 additions & 18 deletions regression-test/suites/rollup_p0/test_rollup_agg_date.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// 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_rollup_agg_date", "rollup") {
def tbName = "test_rollup_agg_date"

Expand Down Expand Up @@ -41,38 +44,31 @@ suite("test_rollup_agg_date", "rollup") {
DISTRIBUTED BY HASH(datek1) BUCKETS 5 properties("replication_num" = "1");
"""
sql """ALTER TABLE ${tbName} ADD ROLLUP rollup_date(datek1,datetimek2,datetimek1,datetimek3,datev1,datetimev1,datetimev2,datetimev3);"""
int max_try_secs = 60
while (max_try_secs--) {
int max_try_secs = 120
// if timeout testcase will fail same behaviour as old nethod.
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobRollupState(tbName)
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)
sql "ALTER TABLE ${tbName} ADD COLUMN datetimev4 datetimev2(3) MAX NULL;"
max_try_secs = 60
while (max_try_secs--) {
// if timeout testcase will fail same behaviour as old nethod.
Awaitility.await().atMost(max_try_secs, SECONDS).pollInterval(2, SECONDS).until{
String res = getJobColumnState(tbName)
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 "SHOW ALTER TABLE ROLLUP WHERE TableName='${tbName}';"
qt_sql "DESC ${tbName} ALL;"
sql "insert into ${tbName} values('2022-08-22', '2022-08-22 11:11:11.111111', '2022-08-22 11:11:11.111111', '2022-08-22 11:11:11.111111', '2022-08-22', '2022-08-22 11:11:11.111111', '2022-08-22 11:11:11.111111', '2022-08-22 11:11:11.111111', '2022-08-22 11:11:11.111111');"
Expand Down
48 changes: 23 additions & 25 deletions regression-test/suites/statistics/test_partition_stats.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// 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_partition_stats") {

Expand All @@ -36,33 +38,29 @@ suite("test_partition_stats") {
sql """use ${db}"""
result = sql """show frontends;"""
logger.info("show frontends result master: " + result)
for (int i = 0; i < 120; i++) {
Thread.sleep(5000)
// in 300 sec its not matching, then timeout raised by awaited.
Awaitility.await().atMost(300, SECONDS).pollInterval(5, SECONDS).until{
result = sql """SHOW DATA FROM ${table};"""
logger.info("result " + result)
if (result[row][column] == expected) {
return;
return true;
}
return false;
}
throw new Exception("Row count report timeout.")
}

}

def wait_mv_finish = { db, table ->
for (int loop = 0; loop < 300; loop++) {
Thread.sleep(1000)
boolean finished = true;
// in 300 sec its not matching, then timeout raised by awaited.
Awaitility.await().atMost(300, SECONDS).pollInterval(1, SECONDS).until{
def result = sql """SHOW ALTER TABLE MATERIALIZED VIEW FROM ${db} WHERE tableName="${table}";"""
for (int i = 0; i < result.size(); i++) {
if (result[i][8] != 'FINISHED') {
finished = false;
break;
return false;
}
}
if (finished) {
return;
}
return true;
}
throw new Exception("Wait mv finish timeout.")
}
Expand Down Expand Up @@ -116,15 +114,17 @@ suite("test_partition_stats") {

// Test show cached partition stats.
sql """analyze table part with sync;"""
for (int i = 0; i < 20; i++) {
// in 20 sec its not matching, then timeout raised by awaited.
Awaitility.await().atMost(20, SECONDS).pollInterval(1, SECONDS).until{
result = sql """show column cached stats part partition(*)"""
if (result.size() == 27) {
logger.info("cache is ready.")
break;
return true;
}
logger.info("cache is not ready yet.")
Thread.sleep(1000)
return false;
}

result = sql """show column cached stats part(id) partition(p1)"""
assertEquals("id", result[0][0])
assertEquals("p1", result[0][1])
Expand Down Expand Up @@ -479,13 +479,12 @@ suite("test_partition_stats") {
result = sql """show auto analyze part4"""
assertTrue(result.size() > 0)
def index = result.size() - 1;
def finished = false;
for (int i = 0; i < 20; i++) {
// in 30 sec its not matching, then timeout raised by awaited.
Awaitility.await().atMost(30, SECONDS).pollInterval(1, SECONDS).until{
if (result[index][9].equals("FINISHED")) {
finished = true;
break;
return true;
}
Thread.sleep(1000)
return false;
}
if (finished) {
result = sql """show column stats part4"""
Expand Down Expand Up @@ -667,13 +666,12 @@ suite("test_partition_stats") {
sql """analyze table part7 properties("use.auto.analyzer"="true")"""
result = sql """show auto analyze part7"""
assertEquals(1, result.size())
def finished = false;
for (int i = 0; i < 20; i++) {
// in 20 sec its not matching, then timeout raised by awaited.
Awaitility.await().atMost(20, SECONDS).pollInterval(1, SECONDS).until{
if (result[0][9].equals("FINISHED")) {
finished = true;
break;
return true;
}
Thread.sleep(1000)
return false;
}
if (finished) {
result = sql """show column stats part7"""
Expand Down