Skip to content

Commit c04c767

Browse files
committed
Rethink blocking annotations in detach-partition-concurrently-[34].
In 741d7f1, I tried to make the reports from canceled steps come out after the pg_cancel_backend() steps, since that was the most common ordering before. However, that doesn't ensure that a canceled step doesn't report even later, as shown in a recent failure on buildfarm member idiacanthus. Rather than complicating things even more with additional annotations, let's just force the cancel's effect to be reported first. It's not *that* unnatural-looking. Back-patch to v14 where these test cases appeared. Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=idiacanthus&dt=2021-07-02%2001%3A40%3A04
1 parent f025f23 commit c04c767

4 files changed

+143
-117
lines changed

src/test/isolation/expected/detach-partition-concurrently-3.out

+72-54
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ a
1010
(1 row)
1111

1212
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
13-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
13+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
14+
step s2detach: <... completed>
15+
ERROR: canceling statement due to user request
16+
step s1cancel: <... completed>
1417
pg_cancel_backend
1518
-----------------
1619
t
1720
(1 row)
1821

19-
step s2detach: <... completed>
20-
ERROR: canceling statement due to user request
2122
step s1c: COMMIT;
2223
step s1describe: SELECT 'd3_listp' AS root, * FROM pg_partition_tree('d3_listp')
2324
UNION ALL SELECT 'd3_listp1', * FROM pg_partition_tree('d3_listp1');
@@ -41,14 +42,15 @@ a
4142
(1 row)
4243

4344
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
44-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
45+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
46+
step s2detach: <... completed>
47+
ERROR: canceling statement due to user request
48+
step s1cancel: <... completed>
4549
pg_cancel_backend
4650
-----------------
4751
t
4852
(1 row)
4953

50-
step s2detach: <... completed>
51-
ERROR: canceling statement due to user request
5254
step s1insert: INSERT INTO d3_listp VALUES (1);
5355
ERROR: no partition of relation "d3_listp" found for row
5456
step s1c: COMMIT;
@@ -63,14 +65,15 @@ a
6365
(1 row)
6466

6567
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
66-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
68+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
69+
step s2detach: <... completed>
70+
ERROR: canceling statement due to user request
71+
step s1cancel: <... completed>
6772
pg_cancel_backend
6873
-----------------
6974
t
7075
(1 row)
7176

72-
step s2detach: <... completed>
73-
ERROR: canceling statement due to user request
7477
step s1insert: INSERT INTO d3_listp VALUES (1);
7578
step s1c: COMMIT;
7679
step s1spart: SELECT * FROM d3_listp1;
@@ -91,14 +94,15 @@ a
9194
(1 row)
9295

9396
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
94-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
97+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
98+
step s2detach: <... completed>
99+
ERROR: canceling statement due to user request
100+
step s1cancel: <... completed>
95101
pg_cancel_backend
96102
-----------------
97103
t
98104
(1 row)
99105

100-
step s2detach: <... completed>
101-
ERROR: canceling statement due to user request
102106
step s1c: COMMIT;
103107
step s1insertpart: INSERT INTO d3_listp1 VALUES (1);
104108

@@ -112,14 +116,15 @@ a
112116
(1 row)
113117

114118
step s2detach2: ALTER TABLE d3_listp DETACH PARTITION d3_listp2 CONCURRENTLY; <waiting ...>
115-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
119+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
120+
step s2detach2: <... completed>
121+
ERROR: canceling statement due to user request
122+
step s1cancel: <... completed>
116123
pg_cancel_backend
117124
-----------------
118125
t
119126
(1 row)
120127

121-
step s2detach2: <... completed>
122-
ERROR: canceling statement due to user request
123128
step s1c: COMMIT;
124129
step s1brr: BEGIN ISOLATION LEVEL REPEATABLE READ;
125130
step s1insert: INSERT INTO d3_listp VALUES (1);
@@ -143,14 +148,15 @@ a
143148
(1 row)
144149

145150
step s2detach2: ALTER TABLE d3_listp DETACH PARTITION d3_listp2 CONCURRENTLY; <waiting ...>
146-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
151+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
152+
step s2detach2: <... completed>
153+
ERROR: canceling statement due to user request
154+
step s1cancel: <... completed>
147155
pg_cancel_backend
148156
-----------------
149157
t
150158
(1 row)
151159

152-
step s2detach2: <... completed>
153-
ERROR: canceling statement due to user request
154160
step s1c: COMMIT;
155161
step s1brr: BEGIN ISOLATION LEVEL REPEATABLE READ;
156162
step s1s: SELECT * FROM d3_listp;
@@ -179,14 +185,15 @@ a
179185
(1 row)
180186

181187
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
182-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
188+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
189+
step s2detach: <... completed>
190+
ERROR: canceling statement due to user request
191+
step s1cancel: <... completed>
183192
pg_cancel_backend
184193
-----------------
185194
t
186195
(1 row)
187196

188-
step s2detach: <... completed>
189-
ERROR: canceling statement due to user request
190197
step s1c: COMMIT;
191198
step s1drop: DROP TABLE d3_listp;
192199
step s1list: SELECT relname FROM pg_catalog.pg_class
@@ -206,14 +213,15 @@ a
206213
(1 row)
207214

208215
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
209-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
216+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
217+
step s2detach: <... completed>
218+
ERROR: canceling statement due to user request
219+
step s1cancel: <... completed>
210220
pg_cancel_backend
211221
-----------------
212222
t
213223
(1 row)
214224

215-
step s2detach: <... completed>
216-
ERROR: canceling statement due to user request
217225
step s1c: COMMIT;
218226
step s1trunc: TRUNCATE TABLE d3_listp;
219227
step s1spart: SELECT * FROM d3_listp1;
@@ -233,14 +241,15 @@ a
233241
(1 row)
234242

235243
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
236-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
244+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
245+
step s2detach: <... completed>
246+
ERROR: canceling statement due to user request
247+
step s1cancel: <... completed>
237248
pg_cancel_backend
238249
-----------------
239250
t
240251
(1 row)
241252

242-
step s2detach: <... completed>
243-
ERROR: canceling statement due to user request
244253
step s1noop:
245254
step s2detach2: ALTER TABLE d3_listp DETACH PARTITION d3_listp2 CONCURRENTLY;
246255
ERROR: partition "d3_listp1" already pending detach in partitioned table "public.d3_listp"
@@ -256,14 +265,15 @@ a
256265
(1 row)
257266

258267
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
259-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
268+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
269+
step s2detach: <... completed>
270+
ERROR: canceling statement due to user request
271+
step s1cancel: <... completed>
260272
pg_cancel_backend
261273
-----------------
262274
t
263275
(1 row)
264276

265-
step s2detach: <... completed>
266-
ERROR: canceling statement due to user request
267277
step s1noop:
268278
step s2detachfinal: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 FINALIZE; <waiting ...>
269279
step s1c: COMMIT;
@@ -280,14 +290,15 @@ a
280290
(1 row)
281291

282292
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
283-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
293+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
294+
step s2detach: <... completed>
295+
ERROR: canceling statement due to user request
296+
step s1cancel: <... completed>
284297
pg_cancel_backend
285298
-----------------
286299
t
287300
(1 row)
288301

289-
step s2detach: <... completed>
290-
ERROR: canceling statement due to user request
291302
step s1c: COMMIT;
292303
step s1droppart: DROP TABLE d3_listp1;
293304
step s2detach2: ALTER TABLE d3_listp DETACH PARTITION d3_listp2 CONCURRENTLY;
@@ -302,14 +313,15 @@ a
302313
(1 row)
303314

304315
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
305-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
316+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
317+
step s2detach: <... completed>
318+
ERROR: canceling statement due to user request
319+
step s1cancel: <... completed>
306320
pg_cancel_backend
307321
-----------------
308322
t
309323
(1 row)
310324

311-
step s2detach: <... completed>
312-
ERROR: canceling statement due to user request
313325
step s1c: COMMIT;
314326
step s2begin: BEGIN;
315327
step s2drop: DROP TABLE d3_listp1;
@@ -331,14 +343,15 @@ a
331343
(1 row)
332344

333345
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
334-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
346+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
347+
step s2detach: <... completed>
348+
ERROR: canceling statement due to user request
349+
step s1cancel: <... completed>
335350
pg_cancel_backend
336351
-----------------
337352
t
338353
(1 row)
339354

340-
step s2detach: <... completed>
341-
ERROR: canceling statement due to user request
342355
step s1c: COMMIT;
343356
step s1b: BEGIN;
344357
step s1spart: SELECT * FROM d3_listp1;
@@ -361,14 +374,15 @@ a
361374
(1 row)
362375

363376
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
364-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
377+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
378+
step s2detach: <... completed>
379+
ERROR: canceling statement due to user request
380+
step s1cancel: <... completed>
365381
pg_cancel_backend
366382
-----------------
367383
t
368384
(1 row)
369385

370-
step s2detach: <... completed>
371-
ERROR: canceling statement due to user request
372386
step s1c: COMMIT;
373387
step s1b: BEGIN;
374388
step s1s: SELECT * FROM d3_listp;
@@ -389,14 +403,15 @@ a
389403
(1 row)
390404

391405
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
392-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
406+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
407+
step s2detach: <... completed>
408+
ERROR: canceling statement due to user request
409+
step s1cancel: <... completed>
393410
pg_cancel_backend
394411
-----------------
395412
t
396413
(1 row)
397414

398-
step s2detach: <... completed>
399-
ERROR: canceling statement due to user request
400415
step s1c: COMMIT;
401416
step s1b: BEGIN;
402417
step s1spart: SELECT * FROM d3_listp1;
@@ -419,14 +434,15 @@ a
419434
(1 row)
420435

421436
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
422-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
437+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
438+
step s2detach: <... completed>
439+
ERROR: canceling statement due to user request
440+
step s1cancel: <... completed>
423441
pg_cancel_backend
424442
-----------------
425443
t
426444
(1 row)
427445

428-
step s2detach: <... completed>
429-
ERROR: canceling statement due to user request
430446
step s1c: COMMIT;
431447
step s2begin: BEGIN;
432448
step s2detachfinal: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 FINALIZE;
@@ -442,14 +458,15 @@ a
442458
(1 row)
443459

444460
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
445-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
461+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
462+
step s2detach: <... completed>
463+
ERROR: canceling statement due to user request
464+
step s1cancel: <... completed>
446465
pg_cancel_backend
447466
-----------------
448467
t
449468
(1 row)
450469

451-
step s2detach: <... completed>
452-
ERROR: canceling statement due to user request
453470
step s1c: COMMIT;
454471
step s2begin: BEGIN;
455472
step s2detachfinal: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 FINALIZE;
@@ -472,14 +489,15 @@ a
472489
(1 row)
473490

474491
step s2detach: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 CONCURRENTLY; <waiting ...>
475-
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid;
492+
step s1cancel: SELECT pg_cancel_backend(pid) FROM d3_pid; <waiting ...>
493+
step s2detach: <... completed>
494+
ERROR: canceling statement due to user request
495+
step s1cancel: <... completed>
476496
pg_cancel_backend
477497
-----------------
478498
t
479499
(1 row)
480500

481-
step s2detach: <... completed>
482-
ERROR: canceling statement due to user request
483501
step s1c: COMMIT;
484502
step s2begin: BEGIN;
485503
step s2detachfinal: ALTER TABLE d3_listp DETACH PARTITION d3_listp1 FINALIZE;

0 commit comments

Comments
 (0)