forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9e149c8
committed
Fix and document lock handling for in-memory replication slot data
While debugging issues on HEAD for the new slot forwarding feature ofPostgres 11, some monitoring of the code surrounding in-memory slot datahas proved that the lock handling may cause inconsistent data to be readby read-only callers of slot functions, particularlypg_get_replication_slots() which fetches data for the system viewpg_replication_slots, or modules looking directly at slot information.The code paths involved in those problems concern logical decodinginitialization (down to 9.4) and WAL reservation for slots (new as of10).A set of comments documenting all the lock handlings, particularly thedependency with LW locks for slots and the in_use flag as well as theinternal mutex lock is added, based on a suggested by Simon Riggs.Some of the fixed code exists down to 9.4 where WAL decoding has beenintroduced, but as those race conditions are really unlikely going tohappen as those concern code paths for slot and decoding creation, justfix the problem on HEAD.Author: Michael PaquierDiscussion:https://postgr.es/m/20180528085747.GA27845@paquier.xyz1 parent86a2218 commit9e149c8
3 files changed
+26
-4
lines changedLines changed: 9 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
297 | 297 |
| |
298 | 298 |
| |
299 | 299 |
| |
| 300 | + | |
300 | 301 |
| |
301 | 302 |
| |
302 | 303 |
| |
303 | 304 |
| |
| 305 | + | |
304 | 306 |
| |
305 | 307 |
| |
306 | 308 |
| |
| |||
445 | 447 |
| |
446 | 448 |
| |
447 | 449 |
| |
| 450 | + | |
448 | 451 |
| |
449 | 452 |
| |
450 |
| - | |
| 453 | + | |
451 | 454 |
| |
452 | 455 |
| |
453 |
| - | |
454 |
| - | |
| 456 | + | |
| 457 | + | |
455 | 458 |
| |
456 | 459 |
| |
457 | 460 |
| |
| |||
477 | 480 |
| |
478 | 481 |
| |
479 | 482 |
| |
480 |
| - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
481 | 486 |
| |
482 | 487 |
| |
483 | 488 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1016 | 1016 |
| |
1017 | 1017 |
| |
1018 | 1018 |
| |
| 1019 | + | |
1019 | 1020 |
| |
| 1021 | + | |
1020 | 1022 |
| |
1021 | 1023 |
| |
1022 | 1024 |
| |
| |||
1026 | 1028 |
| |
1027 | 1029 |
| |
1028 | 1030 |
| |
| 1031 | + | |
1029 | 1032 |
| |
| 1033 | + | |
1030 | 1034 |
| |
1031 | 1035 |
| |
1032 | 1036 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
89 | 102 |
| |
90 | 103 |
| |
91 | 104 |
| |
|
0 commit comments
Comments
(0)