Skip to content

Commit

Permalink
fix(ci): fix flaky barrier read e2e transaction test (#18346)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenym1 authored Sep 2, 2024
1 parent ef71eef commit e788323
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions e2e_test/batch/transaction/now.slt
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,36 @@ 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,
now() at time zone 'utc' + interval '20' second,
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
Expand All @@ -40,6 +50,7 @@ select * from mv;
## select * from v;
## ----

connection txn
statement ok
commit;

Expand Down
8 changes: 8 additions & 0 deletions e2e_test/batch/transaction/read_only_multi_conn.slt
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -15,6 +17,7 @@ connection txn
statement ok
start transaction read only;

skipif in-memory
connection txn
query I
select count(*) from t;
Expand All @@ -26,6 +29,7 @@ connection other
statement ok
flush;

skipif in-memory
connection other
query I
select count(*) from t;
Expand All @@ -41,13 +45,15 @@ statement ok
flush;

# inserts are visible in the `other` connection,
skipif in-memory
connection other
query I
select count(*) from t;
----
3

# ...but not in the read-only transaction
skipif in-memory
connection txn
query I
select count(*) from t;
Expand All @@ -59,6 +65,7 @@ statement ok
flush;

# still invisible even after flush
skipif in-memory
connection txn
query I
select count(*) from t;
Expand All @@ -70,6 +77,7 @@ statement ok
commit;

# now visible outside the transaction
skipif in-memory
connection txn
query I
select count(*) from t;
Expand Down

0 comments on commit e788323

Please sign in to comment.