- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit272c2ab
committed
Change some bogus PageGetLSN calls to BufferGetLSNAtomic
As src/backend/access/transam/README says, PageGetLSN may only be calledby processes holding either exclusive lock on buffer, or a shared lockon buffer plus buffer header lock. Therefore any place that only holdsa shared buffer lock must use BufferGetLSNAtomic instead of PageGetLSN,which internally obtains buffer header lock prior to reading the LSN.A few callsites failed to comply with this rule. This was detected byrunning all tests under a new (not committed) assertion that verifiesPageGetLSN locking contract. All but one of the callsites that failedthe assertion are fixed by this patch. Remaining callsites wereinspected manually and determined not to need any change.The exception (unfixed callsite) is in TestForOldSnapshot, which onlyhas a Page argument, making it impossible to access the correspondingBuffer from it. Fixing that seems a much larger patch that will have tobe done separately; and that's just as well, since it was onlyintroduced in 9.6 and other bugs are much older.Some of these bugs are ancient; backpatch all the way back to 9.3.Authors: Jacob Champion, Asim Praveen, Ashwin AgrawalReviewed-by: Michaël PaquierDiscussion:https://postgr.es/m/CABAq_6GXgQDVu3u12mK9O5Xt5abBZWQ0V40LZCE+oUf95XyNFg@mail.gmail.com1 parent11b623d commit272c2ab
File tree
5 files changed
+8
-7
lines changed- src/backend/access
- gist
- nbtree
5 files changed
+8
-7
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
640 | 640 |
| |
641 | 641 |
| |
642 | 642 |
| |
643 |
| - | |
| 643 | + | |
| 644 | + | |
644 | 645 |
| |
645 | 646 |
| |
646 | 647 |
| |
| |||
890 | 891 |
| |
891 | 892 |
| |
892 | 893 |
| |
893 |
| - | |
| 894 | + | |
894 | 895 |
| |
895 | 896 |
| |
896 | 897 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
| 64 | + | |
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| |||
384 | 384 |
| |
385 | 385 |
| |
386 | 386 |
| |
387 |
| - | |
| 387 | + | |
388 | 388 |
| |
389 | 389 |
| |
390 | 390 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
249 | 249 |
| |
250 | 250 |
| |
251 | 251 |
| |
252 |
| - | |
| 252 | + | |
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1224 | 1224 |
| |
1225 | 1225 |
| |
1226 | 1226 |
| |
1227 |
| - | |
| 1227 | + | |
1228 | 1228 |
| |
1229 | 1229 |
| |
1230 | 1230 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1772 | 1772 |
| |
1773 | 1773 |
| |
1774 | 1774 |
| |
1775 |
| - | |
| 1775 | + | |
1776 | 1776 |
| |
1777 | 1777 |
| |
1778 | 1778 |
| |
|
0 commit comments
Comments
(0)