Skip to content

Commit e0bc803

Browse files
craig[bot]mw5h
andcommitted
Merge #150742
150742: opt: deflake fk_read_committed r=mw5h a=mw5h Previously the async portion of the fk_cascade_race subtest had ... a race. Usually the test would follow the intended route where the async statements are executed in the same session as the previous statements, but this was not guaranteed by logictest. By moving the racing statement to the testuser, we force this serialization so that we don't get periodic test failures. Fixes: #150466 Release note: None Co-authored-by: Matt White <[email protected]>
2 parents 953ea0f + 8a95e17 commit e0bc803

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/ccl/logictestccl/testdata/logic_test/fk_read_committed

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,17 @@ CREATE TABLE child_150282 (
117117
INDEX (p)
118118
);
119119

120+
statement ok
121+
GRANT ALL ON TABLE parent_150282 TO testuser;
122+
123+
statement ok
124+
GRANT ALL ON TABLE child_150282 TO testuser;
125+
120126
statement ok
121127
INSERT INTO parent_150282 VALUES (1, 2, 3);
122128

129+
user root
130+
123131
statement ok
124132
BEGIN ISOLATION LEVEL READ COMMITTED;
125133

@@ -129,14 +137,20 @@ SELECT 1;
129137
statement async fk_delete
130138
WITH sleep AS (SELECT pg_sleep(1)) DELETE FROM parent_150282@parent_150282_i_idx WHERE i = 2;
131139

140+
user testuser
141+
132142
statement ok
133143
INSERT INTO child_150282 VALUES (4, 1);
134144

145+
user root
146+
135147
awaitstatement fk_delete
136148

137149
statement ok
138150
COMMIT;
139151

152+
user testuser
153+
140154
query III
141155
SELECT * FROM parent_150282;
142156
----
@@ -148,6 +162,8 @@ SELECT * FROM child_150282;
148162
statement ok
149163
INSERT INTO parent_150282 VALUES (1, 2, 3);
150164

165+
user root
166+
151167
statement ok
152168
BEGIN ISOLATION LEVEL READ COMMITTED;
153169

@@ -157,9 +173,13 @@ SELECT 1;
157173
statement async fk_update
158174
WITH sleep AS (SELECT pg_sleep(1)) UPDATE parent_150282 SET p = 4 WHERE i = 2;
159175

176+
user testuser
177+
160178
statement ok
161179
INSERT INTO child_150282 VALUES (4, 1);
162180

181+
user root
182+
163183
awaitstatement fk_update
164184

165185
statement ok

0 commit comments

Comments
 (0)