This is an automated email from the ASF dual-hosted git repository.
gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new bff12318af0 [test](regression) Strengthen streaming job recovery and
CDC consistency checks (#70651)
bff12318af0 is described below
commit bff12318af0c80482217790adbadd98074c29330
Author: wudi <[email protected]>
AuthorDate: Tue Nov 24 16:18:39 2026 +0800
[test](regression) Strengthen streaming job recovery and CDC consistency
checks (#70651)
### Background
Doris streaming jobs consume source changes and recover from persisted
offsets. These regression suites cover CDC ingestion, S3 task retries,
and FE restart recovery.
### What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Test
Problem Summary:
The auto-resume suite reads the wrong failure-counter row and can
swallow a failed check, while the FE restart suite references an
undefined status variable and does not verify newly arriving data after
recovery. Existing CDC checks also lack explicit rollback and successive
committed changes to the same key. Strengthen these seven suites with
bounded waits, committed markers, and complete expected-output
comparisons; no production behavior changes.
---
.../streaming_job/cdc/test_streaming_mysql_job.out | 6 ++
.../cdc/test_streaming_mysql_job_composite_pk.out | 11 ++++
.../cdc/test_streaming_oceanbase_job.out | 9 +++
.../cdc/test_streaming_postgres_job.out | 6 ++
.../test_streaming_postgres_job_composite_pk.out | 11 ++++
.../test_streaming_job_auto_resume.out | 22 +++++++
.../test_streaming_job_restart_fe.out | 67 ++++++++++++++++++++++
.../cdc/test_streaming_mysql_job.groovy | 18 ++++++
.../test_streaming_mysql_job_composite_pk.groovy | 24 ++++++++
.../cdc/test_streaming_oceanbase_job.groovy | 40 +++++++++++++
.../cdc/test_streaming_postgres_job.groovy | 30 +++++++++-
...test_streaming_postgres_job_composite_pk.groovy | 25 ++++++++
.../test_streaming_job_auto_resume.groovy | 16 ++++--
.../test_streaming_job_restart_fe.groovy | 52 ++++++++++++-----
14 files changed, 315 insertions(+), 22 deletions(-)
diff --git
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job.out
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job.out
index f5e148123ae..e7e90ec3bd9 100644
--- a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job.out
+++ b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job.out
@@ -18,3 +18,9 @@ Apache 40
B1 10
Doris 18
+-- !after_rollback --
+AfterRollback 50
+Apache 40
+B1 10
+Doris 18
+
diff --git
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.out
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.out
index 27c1b7a6357..3a26446f2f4 100644
---
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.out
+++
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.out
@@ -45,3 +45,14 @@ amount decimal(10,2) Yes false \N NONE
20 201
30 300
+-- !after_resume --
+1 1002 A_002 20.00
+1 1003 reinserted 123.45
+1 1004 A_004 40.00
+1 1005 A_005 50.00
+1 1006 A_006 60.00
+2 2001 B_001 100.00
+2 2003 B_003 300.00
+2 2004 B_004 400.00
+2 2006 B_006 600.00
+
diff --git
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.out
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.out
index 26ee9fd67b5..897051effce 100644
---
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.out
+++
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.out
@@ -15,3 +15,12 @@
-- !oceanbase_incremental_orders --
10 snapshot_order
11 incremental_order
+
+-- !oceanbase_after_rollback --
+2 Bob 21
+3 Carol 30
+5 after_rollback 50
+
+-- !oceanbase_after_resume --
+2 Bob_reinserted 42
+5 after_rollback 50
diff --git
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job.out
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job.out
index aebbb6815e3..54274e8d79f 100644
---
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job.out
+++
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job.out
@@ -16,3 +16,9 @@ Apache 40
B1 10
Doris 18
+-- !after_rollback --
+AfterRollback 50
+Apache 40
+B1 10
+Doris 18
+
diff --git
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.out
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.out
index bb05bc4cd26..5e4226789a9 100644
---
a/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.out
+++
b/regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.out
@@ -45,3 +45,14 @@ qty int Yes false \N NONE
20 201
30 300
+-- !after_resume --
+1 1002 A_002 20
+1 1003 reinserted 123
+1 1004 A_004 40
+1 1005 A_005 50
+1 1006 A_006 60
+2 2001 B_001 100
+2 2003 B_003 300
+2 2004 B_004 400
+2 2006 B_006 600
+
diff --git
a/regression-test/data/job_p0/streaming_job/test_streaming_job_auto_resume.out
b/regression-test/data/job_p0/streaming_job/test_streaming_job_auto_resume.out
new file mode 100644
index 00000000000..6038c581e7c
--- /dev/null
+++
b/regression-test/data/job_p0/streaming_job/test_streaming_job_auto_resume.out
@@ -0,0 +1,22 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !recovered_data --
+1 Emily 25
+10 Liam 64
+11 Alexander 34
+12 Isabella 43
+13 Benjamin 56
+14 Sophia 12
+15 Christopher 33
+16 Emma 23
+17 Michael 11
+18 Olivia 38
+19 Daniel 19
+2 Benjamin 35
+20 Ava 28
+3 Olivia 28
+4 Alexander 60
+5 Ava 17
+6 William 69
+7 Sophia 32
+8 James 64
+9 Emma 37
diff --git
a/regression-test/data/job_p0/streaming_job/test_streaming_job_restart_fe.out
b/regression-test/data/job_p0/streaming_job/test_streaming_job_restart_fe.out
new file mode 100644
index 00000000000..bcfc49eadcf
--- /dev/null
+++
b/regression-test/data/job_p0/streaming_job/test_streaming_job_restart_fe.out
@@ -0,0 +1,67 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !before_restart --
+1 Emily 25
+10 Liam 64
+11 Alexander 34
+12 Isabella 43
+13 Benjamin 56
+14 Sophia 12
+15 Christopher 33
+16 Emma 23
+17 Michael 11
+18 Olivia 38
+19 Daniel 19
+2 Benjamin 35
+20 Ava 28
+3 Olivia 28
+4 Alexander 60
+5 Ava 17
+6 William 69
+7 Sophia 32
+8 James 64
+9 Emma 37
+
+-- !after_restart --
+1 Emily 25
+10 Liam 64
+11 Alexander 34
+12 Isabella 43
+13 Benjamin 56
+14 Sophia 12
+15 Christopher 33
+16 Emma 23
+17 Michael 11
+18 Olivia 38
+19 Daniel 19
+2 Benjamin 35
+20 Ava 28
+3 Olivia 28
+4 Alexander 60
+5 Ava 17
+6 William 69
+7 Sophia 32
+8 James 64
+9 Emma 37
+
+-- !new_data --
+1 Emily 25
+10 Liam 64
+10001 after_restart 10001
+11 Alexander 34
+12 Isabella 43
+13 Benjamin 56
+14 Sophia 12
+15 Christopher 33
+16 Emma 23
+17 Michael 11
+18 Olivia 38
+19 Daniel 19
+2 Benjamin 35
+20 Ava 28
+3 Olivia 28
+4 Alexander 60
+5 Ava 17
+6 William 69
+7 Sophia 32
+8 James 64
+9 Emma 37
diff --git
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job.groovy
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job.groovy
index e899bbf96c3..efcb7151618 100644
---
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job.groovy
+++
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job.groovy
@@ -169,6 +169,24 @@ suite("test_streaming_mysql_job",
"p0,external,mysql,external_docker,external_do
// check incremental data
qt_select_next_binlog_table1 """ SELECT * FROM ${table1} order by name
asc """
+ // A later committed marker proves the reader has passed the
rolled-back transaction.
+ def expectedAfterRollback = connect("root", "123456",
"jdbc:mysql://${externalEnvIp}:${mysql_port}") {
+ sql "BEGIN"
+ try {
+ sql """INSERT INTO ${mysqlDb}.${table1} VALUES ('rolled_back',
99)"""
+ sql """UPDATE ${mysqlDb}.${table1} SET age=99 WHERE
name='B1'"""
+ sql """DELETE FROM ${mysqlDb}.${table1} WHERE name='Doris'"""
+ } finally {
+ sql "ROLLBACK"
+ }
+ sql """INSERT INTO ${mysqlDb}.${table1} VALUES ('AfterRollback',
50)"""
+ sql """SELECT name, age FROM ${mysqlDb}.${table1} ORDER BY name"""
+ }
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("SELECT name, age FROM ${currentDb}.${table1} ORDER BY name")
== expectedAfterRollback
+ }
+ order_qt_after_rollback "SELECT name, age FROM ${currentDb}.${table1}
ORDER BY name"
+
sql """
DROP JOB IF EXISTS where jobname = '${jobName}'
"""
diff --git
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.groovy
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.groovy
index 9cdd43adfa2..f92466685e1 100644
---
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.groovy
+++
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_mysql_job_composite_pk.groovy
@@ -190,6 +190,30 @@ suite("test_streaming_mysql_job_composite_pk",
"p0,external,mysql,external_docke
qt_select_after_incr """select tenant_id, order_id, order_no, amount
from ${currentDb}.${table1} order by tenant_id, order_id;"""
qt_select_after_incr_map """select user_id, role_id from
${currentDb}.${table2} order by user_id, role_id;"""
+ sql """PAUSE JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(120,
SECONDS).pollInterval(1, SECONDS).until {
+ def job = sql """SELECT Status FROM jobs("type"="insert") WHERE
Name='${jobName}'"""
+ def tasks = sql """SELECT COUNT(*) FROM tasks("type"="insert")
+ WHERE JobName='${jobName}' AND
Status='RUNNING'"""
+ job.size() == 1 && job[0][0] == "PAUSED" && tasks[0][0] == 0
+ }
+ def expectedAfterResume = connect("root", "123456",
"jdbc:mysql://${externalEnvIp}:${mysql_port}") {
+ // Autocommit preserves three distinct committed changes to the
same complete key.
+ sql """UPDATE ${mysqlDb}.${table1} SET amount=111.11 WHERE
tenant_id=1 AND order_id=1003"""
+ sql """DELETE FROM ${mysqlDb}.${table1} WHERE tenant_id=1 AND
order_id=1003"""
+ sql """INSERT INTO ${mysqlDb}.${table1} VALUES (1, 1003,
'reinserted', 123.45)"""
+ sql """DELETE FROM ${mysqlDb}.${table1} WHERE tenant_id=2 AND
order_id=2002"""
+ sql """SELECT tenant_id, order_id, order_no, amount FROM
${mysqlDb}.${table1}
+ ORDER BY tenant_id, order_id"""
+ }
+ sql """RESUME JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(180,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("""SELECT tenant_id, order_id, order_no, amount FROM
${currentDb}.${table1}
+ ORDER BY tenant_id, order_id""") == expectedAfterResume
+ }
+ order_qt_after_resume """SELECT tenant_id, order_id, order_no, amount
FROM ${currentDb}.${table1}
+ ORDER BY tenant_id, order_id"""
+
sql """DROP JOB IF EXISTS where jobname = '${jobName}'"""
def jobCountRsp = sql """select count(1) from jobs("type"="insert")
where Name ='${jobName}'"""
diff --git
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.groovy
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.groovy
index ea492cbc91e..86ac44b9c13 100644
---
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.groovy
+++
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_oceanbase_job.groovy
@@ -150,6 +150,46 @@ suite("test_streaming_oceanbase_job",
&& lagValue.isLong() && Long.parseLong(lagValue) >= 0
})
+ def expectedAfterRollback = connect("root@test", "123456",
+ "jdbc:mysql://${externalEnvIp}:${oceanbaseCdcPort}") {
+ sql "BEGIN"
+ try {
+ sql """INSERT INTO ${sourceDb}.${table1} VALUES (4,
'rolled_back', 99)"""
+ sql """UPDATE ${sourceDb}.${table1} SET age=99 WHERE id=2"""
+ sql """DELETE FROM ${sourceDb}.${table1} WHERE id=3"""
+ } finally {
+ sql "ROLLBACK"
+ }
+ sql """INSERT INTO ${sourceDb}.${table1} VALUES (5,
'after_rollback', 50)"""
+ sql """SELECT id, name, age FROM ${sourceDb}.${table1} ORDER BY
id"""
+ }
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("SELECT id, name, age FROM ${currentDb}.${table1} ORDER BY
id") == expectedAfterRollback
+ }
+ order_qt_oceanbase_after_rollback "SELECT id, name, age FROM
${currentDb}.${table1} ORDER BY id"
+
+ sql """PAUSE JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(120,
SECONDS).pollInterval(1, SECONDS).until {
+ def job = sql """SELECT Status FROM jobs("type"="insert") WHERE
Name='${jobName}'"""
+ def tasks = sql """SELECT COUNT(*) FROM tasks("type"="insert")
+ WHERE JobName='${jobName}' AND
Status='RUNNING'"""
+ job.size() == 1 && job[0][0] == "PAUSED" && tasks[0][0] == 0
+ }
+ def expectedAfterResume = connect("root@test", "123456",
+ "jdbc:mysql://${externalEnvIp}:${oceanbaseCdcPort}") {
+ // Each statement commits separately while the reader is paused.
+ sql """UPDATE ${sourceDb}.${table1} SET age=22 WHERE id=2"""
+ sql """DELETE FROM ${sourceDb}.${table1} WHERE id=2"""
+ sql """INSERT INTO ${sourceDb}.${table1} VALUES (2,
'Bob_reinserted', 42)"""
+ sql """DELETE FROM ${sourceDb}.${table1} WHERE id=3"""
+ sql """SELECT id, name, age FROM ${sourceDb}.${table1} ORDER BY
id"""
+ }
+ sql """RESUME JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("SELECT id, name, age FROM ${currentDb}.${table1} ORDER BY
id") == expectedAfterResume
+ }
+ order_qt_oceanbase_after_resume "SELECT id, name, age FROM
${currentDb}.${table1} ORDER BY id"
+
sql """DROP JOB IF EXISTS WHERE jobname='${jobName}'"""
}
}
diff --git
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job.groovy
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job.groovy
index b16e13a74cd..ec424a8fa67 100644
---
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job.groovy
+++
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job.groovy
@@ -54,6 +54,13 @@ suite("test_streaming_postgres_job",
"p0,external,pg,external_docker,external_do
String bucket = getS3BucketName()
String driver_url =
"https://${bucket}.${s3_endpoint}/regression/jdbc_driver/postgresql-42.5.0.jar"
+ def waitForScannedRows = { long expected ->
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ def rows = sql """SELECT LoadStatistic, Status FROM
jobs("type"="insert") WHERE Name='${jobName}'"""
+ rows.size() == 1 && rows[0][1] == "RUNNING" &&
parseJson(rows[0][0]).scannedRows >= expected
+ }
+ }
+
// create test
connect("${pgUser}", "${pgPassword}",
"jdbc:postgresql://${externalEnvIp}:${pg_port}/${pgDB}") {
// sql """CREATE SCHEMA IF NOT EXISTS ${pgSchema}"""
@@ -168,7 +175,7 @@ suite("test_streaming_postgres_job",
"p0,external,pg,external_docker,external_do
sql """DELETE FROM ${pgDB}.${pgSchema}.${table1} WHERE name =
'A1';"""
}
- sleep(60000); // wait for cdc incremental data
+ waitForScannedRows(7)
// check incremental data
qt_select_binlog_table1 """ SELECT * FROM ${table1} order by name asc
"""
@@ -189,11 +196,30 @@ suite("test_streaming_postgres_job",
"p0,external,pg,external_docker,external_do
log.info("xminResult1: " + xminResult1)
}
- sleep(60000); // wait for cdc incremental data
+ waitForScannedRows(8)
// check incremental data
qt_select_next_binlog_table1 """ SELECT * FROM ${table1} order by name
asc """
+ // Keep the rollback and its committed marker on the same source
connection.
+ def expectedAfterRollback = connect("${pgUser}", "${pgPassword}",
+ "jdbc:postgresql://${externalEnvIp}:${pg_port}/${pgDB}") {
+ sql "BEGIN"
+ try {
+ sql """INSERT INTO ${pgSchema}.${table1} VALUES
('rolled_back', 99)"""
+ sql """UPDATE ${pgSchema}.${table1} SET age=99 WHERE
name='B1'"""
+ sql """DELETE FROM ${pgSchema}.${table1} WHERE name='Doris'"""
+ } finally {
+ sql "ROLLBACK"
+ }
+ sql """INSERT INTO ${pgSchema}.${table1} VALUES ('AfterRollback',
50)"""
+ sql """SELECT name, age FROM ${pgSchema}.${table1} ORDER BY name"""
+ }
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("SELECT name, age FROM ${currentDb}.${table1} ORDER BY name")
== expectedAfterRollback
+ }
+ order_qt_after_rollback "SELECT name, age FROM ${currentDb}.${table1}
ORDER BY name"
+
sql """
DROP JOB IF EXISTS where jobname = '${jobName}'
"""
diff --git
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.groovy
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.groovy
index 80e580e91b8..adea885c4e1 100644
---
a/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.groovy
+++
b/regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job_composite_pk.groovy
@@ -190,6 +190,31 @@ suite("test_streaming_postgres_job_composite_pk",
"p0,external,pg,external_docke
qt_select_after_incr """select org_id, item_id, item_no, qty from
${currentDb}.${table1} order by org_id, item_id;"""
qt_select_after_incr_map """select user_id, role_id from
${currentDb}.${table2} order by user_id, role_id;"""
+ sql """PAUSE JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(120,
SECONDS).pollInterval(1, SECONDS).until {
+ def job = sql """SELECT Status FROM jobs("type"="insert") WHERE
Name='${jobName}'"""
+ def tasks = sql """SELECT COUNT(*) FROM tasks("type"="insert")
+ WHERE JobName='${jobName}' AND
Status='RUNNING'"""
+ job.size() == 1 && job[0][0] == "PAUSED" && tasks[0][0] == 0
+ }
+ def expectedAfterResume = connect("${pgUser}", "${pgPassword}",
+ "jdbc:postgresql://${externalEnvIp}:${pg_port}/${pgDB}") {
+ // Autocommit preserves three distinct committed changes to the
same complete key.
+ sql """UPDATE ${pgSchema}.${table1} SET qty=111 WHERE org_id=1 AND
item_id=1003"""
+ sql """DELETE FROM ${pgSchema}.${table1} WHERE org_id=1 AND
item_id=1003"""
+ sql """INSERT INTO ${pgSchema}.${table1} VALUES (1, 1003,
'reinserted', 123)"""
+ sql """DELETE FROM ${pgSchema}.${table1} WHERE org_id=2 AND
item_id=2002"""
+ sql """SELECT org_id, item_id, item_no, qty FROM
${pgSchema}.${table1}
+ ORDER BY org_id, item_id"""
+ }
+ sql """RESUME JOB WHERE jobname='${jobName}'"""
+ Awaitility.await().pollInSameThread().atMost(180,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("""SELECT org_id, item_id, item_no, qty FROM
${currentDb}.${table1}
+ ORDER BY org_id, item_id""") == expectedAfterResume
+ }
+ order_qt_after_resume """SELECT org_id, item_id, item_no, qty FROM
${currentDb}.${table1}
+ ORDER BY org_id, item_id"""
+
sql """DROP JOB IF EXISTS where jobname = '${jobName}'"""
def jobCountRsp = sql """select count(1) from jobs("type"="insert")
where Name ='${jobName}'"""
diff --git
a/regression-test/suites/job_p0/streaming_job/test_streaming_job_auto_resume.groovy
b/regression-test/suites/job_p0/streaming_job/test_streaming_job_auto_resume.groovy
index 8506d08f17b..b4f187ed1c9 100644
---
a/regression-test/suites/job_p0/streaming_job/test_streaming_job_auto_resume.groovy
+++
b/regression-test/suites/job_p0/streaming_job/test_streaming_job_auto_resume.groovy
@@ -63,9 +63,9 @@ suite("test_streaming_job_auto_resume", "nonConcurrent") {
Awaitility.await().atMost(100, SECONDS)
.pollInterval(1, SECONDS).until(
{
- def count = sql """ select status, FailedTaskCount
from jobs("type"="insert") where Name like '%${jobName}%' and
ExecuteType='STREAMING' """
+ def count = sql """ select status, FailedTaskCount
from jobs("type"="insert") where Name='${jobName}' and ExecuteType='STREAMING'
"""
log.info("FailedTaskCount: " + count)
- count.size() == 1 && '0' < count.get(1).get(0)
+ count.size() == 1 && (count[0][1] as long) > 0
}
)
} catch (Exception ex){
@@ -73,6 +73,7 @@ suite("test_streaming_job_auto_resume", "nonConcurrent") {
def showtask = sql """select * from tasks("type"="insert") where
JobName='${jobName}'"""
log.info("show job: " + showjob)
log.info("show task: " + showtask)
+ throw ex
}
} finally {
GetDebugPoint().disableDebugPointForAllBEs("FlushToken.submit_flush_error")
@@ -83,10 +84,10 @@ suite("test_streaming_job_auto_resume", "nonConcurrent") {
Awaitility.await().atMost(100, SECONDS)
.pollInterval(1, SECONDS).until(
{
- def jobSuccendCount = sql """ select SucceedTaskCount from
jobs("type"="insert") where Name like '%${jobName}%' and
ExecuteType='STREAMING' """
+ def jobSuccendCount = sql """ select SucceedTaskCount from
jobs("type"="insert") where Name='${jobName}' and ExecuteType='STREAMING' """
log.info("jobSuccendCount: " + jobSuccendCount)
// check job status and succeed task count larger than 2
- jobSuccendCount.size() == 1 && '2' <=
jobSuccendCount.get(0).get(0)
+ jobSuccendCount.size() == 1 && (jobSuccendCount[0][0] as
long) >= 2
}
)
} catch (Exception ex){
@@ -97,6 +98,11 @@ suite("test_streaming_job_auto_resume", "nonConcurrent") {
throw ex;
}
+ Awaitility.await().pollInSameThread().atMost(100, SECONDS).pollInterval(1,
SECONDS).until {
+ sql("SELECT COUNT(*) FROM ${tableName}")[0][0] == 20
+ }
+ order_qt_recovered_data "SELECT * FROM ${tableName} ORDER BY c1, c2, c3"
+
// case2: test user pause will not auto resume
sql """
PAUSE JOB where jobname = '${jobName}'
@@ -110,4 +116,4 @@ suite("test_streaming_job_auto_resume", "nonConcurrent") {
sleep(1000)
count++
}
-}
\ No newline at end of file
+}
diff --git
a/regression-test/suites/job_p0/streaming_job/test_streaming_job_restart_fe.groovy
b/regression-test/suites/job_p0/streaming_job/test_streaming_job_restart_fe.groovy
index 73fa04be2da..5058409c80f 100644
---
a/regression-test/suites/job_p0/streaming_job/test_streaming_job_restart_fe.groovy
+++
b/regression-test/suites/job_p0/streaming_job/test_streaming_job_restart_fe.groovy
@@ -30,6 +30,13 @@ suite("test_streaming_job_restart_fe", "docker") {
options.cloudMode = null
docker(options) {
+ def bucket = getS3BucketName()
+ def prefix =
"regression/load/streaming_job/${jobName}/${UUID.randomUUID()}"
+ def s3Client = getS3Client()
+ (0..1).each { index ->
+ s3Client.copyObject(bucket,
"regression/load/data/example_${index}.csv",
+ bucket, "${prefix}/example_${index}.csv")
+ }
sql """drop table if exists `${tableName}` force"""
sql """
DROP JOB IF EXISTS where jobname = '${jobName}'
@@ -56,7 +63,7 @@ suite("test_streaming_job_restart_fe", "docker") {
ON STREAMING DO INSERT INTO ${tableName}
SELECT * FROM S3
(
- "uri" =
"s3://${s3BucketName}/regression/load/data/example_[0-1].csv",
+ "uri" = "s3://${bucket}/${prefix}/example_*.csv",
"format" = "csv",
"provider" = "${getS3Provider()}",
"column_separator" = ",",
@@ -72,10 +79,9 @@ suite("test_streaming_job_restart_fe", "docker") {
Awaitility.await().atMost(300, SECONDS)
.pollInterval(1, SECONDS).until(
{
- def jobSuccendCount = sql """ select SucceedTaskCount
from jobs("type"="insert") where Name like '%${jobName}%' and
ExecuteType='STREAMING' """
+ def jobSuccendCount = sql """ select SucceedTaskCount
from jobs("type"="insert") where Name='${jobName}' and ExecuteType='STREAMING'
"""
log.info("jobSuccendCount: " + jobSuccendCount)
- // check job status and succeed task count larger than
1
- jobSuccendCount.size() == 1 && '1' <=
jobSuccendCount.get(0).get(0)
+ jobSuccendCount.size() == 1 && (jobSuccendCount[0][0]
as long) >= 2
}
)
} catch (Exception ex){
@@ -103,28 +109,35 @@ suite("test_streaming_job_restart_fe", "docker") {
select currentOffset, endoffset, loadStatistic from
jobs("type"="insert") where Name='${jobName}'
"""
log.info("jobInfo: " + jobInfo)
- assert jobInfo.get(0).get(0) ==
"{\"fileName\":\"regression/load/data/example_1.csv\"}";
+ assert parseJson(jobInfo[0][0]).fileName == "${prefix}/example_1.csv"
def loadStat = parseJson(jobInfo.get(0).get(2))
assert loadStat.scannedRows == 20
assert loadStat.loadBytes == 425
assert loadStat.fileNumber == 2
assert loadStat.fileSize == 256
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ sql("SELECT COUNT(*) FROM ${tableName}")[0][0] == 20
+ }
+ order_qt_before_restart "SELECT * FROM ${tableName} ORDER BY c1, c2,
c3"
+
// Restart FE
cluster.restartFrontends()
- sleep(30000)
- context.reconnectFe()
+ Awaitility.await().pollInSameThread().atMost(120, SECONDS)
+ .pollInterval(1, SECONDS).ignoreExceptions().until {
+ context.reconnectFe()
+ sql("SELECT 1")[0][0] == 1
+ }
- def jobStatus = sql """
- select status from jobs("type"="insert") where Name='${jobName}'
- """
- log.info("jobstatus: " + jobStatus)
- assert jobStatus.get(0).get(0) == "RUNNING" ||
resumeJobStatus.get(0).get(0) == "PENDING"
+ Awaitility.await().pollInSameThread().atMost(120,
SECONDS).pollInterval(1, SECONDS).until {
+ def jobStatus = sql """SELECT Status FROM jobs("type"="insert")
WHERE Name='${jobName}'"""
+ jobStatus.size() == 1 && jobStatus[0][0] in ["RUNNING", "PENDING"]
+ }
jobInfo = sql """
select currentOffset, endoffset, loadStatistic from
jobs("type"="insert") where Name='${jobName}'
"""
log.info("jobInfo: " + jobInfo)
- assert jobInfo.get(0).get(0) ==
"{\"fileName\":\"regression/load/data/example_1.csv\"}";
+ assert parseJson(jobInfo[0][0]).fileName == "${prefix}/example_1.csv"
def loadStatAfter = parseJson(jobInfo.get(0).get(2))
assert loadStatAfter.scannedRows == 20
assert loadStatAfter.loadBytes == 425
@@ -138,7 +151,16 @@ suite("test_streaming_job_restart_fe", "docker") {
assert lastSuccessAfter.get(0).get(0) != null &&
lastSuccessAfter.get(0).get(0) != "",
"LastTaskSuccessTime should survive FE restart, got: " +
lastSuccessAfter.get(0).get(0)
+ order_qt_after_restart "SELECT * FROM ${tableName} ORDER BY c1, c2, c3"
+
+ s3Client.putObject(bucket, "${prefix}/example_2.csv",
"10001,after_restart,10001\n")
+ Awaitility.await().pollInSameThread().atMost(300,
SECONDS).pollInterval(1, SECONDS).until {
+ def job = sql """SELECT CurrentOffset FROM jobs("type"="insert")
WHERE Name='${jobName}'"""
+ job.size() == 1 && parseJson(job[0][0]).fileName ==
"${prefix}/example_2.csv" &&
+ sql("SELECT COUNT(*) FROM ${tableName}")[0][0] == 21
+ }
+ order_qt_new_data "SELECT * FROM ${tableName} ORDER BY c1, c2, c3"
+
sql """ DROP JOB IF EXISTS where jobname = '${jobName}' """
- sql """drop table if exists `${tableName}` force"""
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]