-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add e2e tests for read-only transaction in multiple sessions (#…
…10902) Signed-off-by: Bugen Zhao <i@bugenzhao.com>
- Loading branch information
Showing
10 changed files
with
153 additions
and
66 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
statement ok | ||
create table t (v int); | ||
|
||
statement ok | ||
insert into t values (1), (2); | ||
|
||
statement ok | ||
flush; | ||
|
||
statement ok | ||
start transaction read only; | ||
|
||
query I | ||
select count(*) from t; | ||
---- | ||
2 | ||
|
||
connection other | ||
query I | ||
select count(*) from t; | ||
---- | ||
2 | ||
|
||
connection other | ||
statement ok | ||
insert into t values (3); | ||
|
||
connection other | ||
statement ok | ||
flush; | ||
|
||
# inserts are visible in the `other` connection, | ||
connection other | ||
query I | ||
select count(*) from t; | ||
---- | ||
3 | ||
|
||
# ...but not in the read-only transaction | ||
query I | ||
select count(*) from t; | ||
---- | ||
2 | ||
|
||
statement ok | ||
flush; | ||
|
||
# still invisible even after flush | ||
query I | ||
select count(*) from t; | ||
---- | ||
2 | ||
|
||
statement ok | ||
commit; | ||
|
||
# now visible outside the transaction | ||
query I | ||
select count(*) from t; | ||
---- | ||
3 | ||
|
||
statement ok | ||
drop table t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters