From e78832351945c171f5e10f895932463b6f3c4664 Mon Sep 17 00:00:00 2001 From: William Wen <44139337+wenym1@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:50:31 +0800 Subject: [PATCH] fix(ci): fix flaky barrier read e2e transaction test (#18346) --- e2e_test/batch/transaction/now.slt | 11 +++++++++++ e2e_test/batch/transaction/read_only_multi_conn.slt | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/e2e_test/batch/transaction/now.slt b/e2e_test/batch/transaction/now.slt index bb717dfc6ed1e..5e68f5b5f8f28 100644 --- a/e2e_test/batch/transaction/now.slt +++ b/e2e_test/batch/transaction/now.slt @@ -7,6 +7,11 @@ create view v as select * from t where ts at time zone 'utc' >= now(); statement ok create materialized view mv as select * from v; +connection txn +statement ok +SET VISIBILITY_MODE TO checkpoint; + +connection txn statement ok insert into t select * from generate_series( now() at time zone 'utc' - interval '10' second, @@ -14,19 +19,24 @@ insert into t select * from generate_series( interval '1' second / 20 ); +connection txn statement ok flush; +connection txn statement ok start transaction read only; # the view should not be empty, so that the following check is meaningful +connection txn query T select count(*) > 0 from mv; ---- t # the result from batch query and materialized view should be the same +skipif in-memory +connection txn query T select * from v except @@ -40,6 +50,7 @@ select * from mv; ## select * from v; ## ---- +connection txn statement ok commit; diff --git a/e2e_test/batch/transaction/read_only_multi_conn.slt b/e2e_test/batch/transaction/read_only_multi_conn.slt index 2e51c2d4e8fce..983c06e6b71c2 100644 --- a/e2e_test/batch/transaction/read_only_multi_conn.slt +++ b/e2e_test/batch/transaction/read_only_multi_conn.slt @@ -1,9 +1,11 @@ statement ok create table t (v int); +connection txn statement ok insert into t values (1), (2); +connection txn statement ok flush; @@ -15,6 +17,7 @@ connection txn statement ok start transaction read only; +skipif in-memory connection txn query I select count(*) from t; @@ -26,6 +29,7 @@ connection other statement ok flush; +skipif in-memory connection other query I select count(*) from t; @@ -41,6 +45,7 @@ statement ok flush; # inserts are visible in the `other` connection, +skipif in-memory connection other query I select count(*) from t; @@ -48,6 +53,7 @@ select count(*) from t; 3 # ...but not in the read-only transaction +skipif in-memory connection txn query I select count(*) from t; @@ -59,6 +65,7 @@ statement ok flush; # still invisible even after flush +skipif in-memory connection txn query I select count(*) from t; @@ -70,6 +77,7 @@ statement ok commit; # now visible outside the transaction +skipif in-memory connection txn query I select count(*) from t;