Commit 4974d7f
committed
Handle parallel index builds on mapped relations.
Commit 9da0cc3, which introduced parallel CREATE INDEX, failed to
propagate relmapper.c backend local cache state to parallel worker
processes. This could result in parallel index builds against mapped
catalog relations where the leader process (participating as a worker)
scans the new, pristine relfilenode, while worker processes scan the
obsolescent relfilenode. When this happened, the final index structure
was typically not consistent with the owning table's structure. The
final index structure could contain entries formed from both heap
relfilenodes. Only rebuilds on mapped catalog relations that occur as
part of a VACUUM FULL or CLUSTER could become corrupt in practice, since
their mapped relation relfilenode swap is what allows the inconsistency
to arise.
On master, fix the problem by propagating the required relmapper.c
backend state as part of standard parallel initialization (Cf. commit
29d58fd). On v11, simply disallow builds against mapped catalog
relations by deeming them parallel unsafe.
Author: Peter Geoghegan
Reported-By: "death lock"
Reviewed-By: Tom Lane, Amit Kapila
Bug: #15309
Discussion: https://postgr.es/m/153329671686.1405.18298309097348420351@wrigleys.postgresql.org
Backpatch: 11-, where parallel CREATE INDEX was introduced.1 parent d4a9004 commit 4974d7f
File tree
5 files changed
+107
-10
lines changed- src
- backend
- access/transam
- utils/cache
- include/utils
5 files changed
+107
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
| |||
256 | 259 | | |
257 | 260 | | |
258 | 261 | | |
| 262 | + | |
| 263 | + | |
259 | 264 | | |
260 | | - | |
| 265 | + | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
| |||
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
| 335 | + | |
330 | 336 | | |
331 | 337 | | |
332 | 338 | | |
| |||
373 | 379 | | |
374 | 380 | | |
375 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
376 | 388 | | |
377 | 389 | | |
378 | 390 | | |
| |||
1205 | 1217 | | |
1206 | 1218 | | |
1207 | 1219 | | |
| 1220 | + | |
1208 | 1221 | | |
1209 | 1222 | | |
1210 | 1223 | | |
| |||
1380 | 1393 | | |
1381 | 1394 | | |
1382 | 1395 | | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1383 | 1400 | | |
1384 | 1401 | | |
1385 | 1402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2018 | 2018 | | |
2019 | 2019 | | |
2020 | 2020 | | |
2021 | | - | |
| 2021 | + | |
2022 | 2022 | | |
2023 | 2023 | | |
2024 | 2024 | | |
| |||
2539 | 2539 | | |
2540 | 2540 | | |
2541 | 2541 | | |
2542 | | - | |
| 2542 | + | |
2543 | 2543 | | |
2544 | 2544 | | |
2545 | 2545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
| |||
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
114 | 127 | | |
115 | 128 | | |
116 | 129 | | |
| |||
263 | 276 | | |
264 | 277 | | |
265 | 278 | | |
266 | | - | |
267 | | - | |
268 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
269 | 282 | | |
270 | 283 | | |
271 | 284 | | |
272 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
273 | 289 | | |
274 | 290 | | |
275 | 291 | | |
| |||
452 | 468 | | |
453 | 469 | | |
454 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
455 | 474 | | |
456 | 475 | | |
457 | | - | |
| 476 | + | |
458 | 477 | | |
459 | | - | |
| 478 | + | |
460 | 479 | | |
461 | 480 | | |
462 | 481 | | |
| |||
482 | 501 | | |
483 | 502 | | |
484 | 503 | | |
485 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
486 | 508 | | |
487 | 509 | | |
488 | 510 | | |
| |||
614 | 636 | | |
615 | 637 | | |
616 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
617 | 689 | | |
618 | 690 | | |
619 | 691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
0 commit comments