forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0a7d771
committed
Make nbtree split REDO locking match original execution.
Make the nbtree page split REDO routine consistent with originalexecution in its approach to acquiring and releasing buffer locks (atleast for pages on the tree level of the page being split). This bringsbtree_xlog_split() in line with btree_xlog_unlink_page(), which wastaught to couple buffer locks by commit9a9db08.Note that the precise order in which we both acquire and release siblingbuffer locks in btree_xlog_split() now matches original executionexactly (the precise order in which the locks are released probablydoesn't matter much, but we might as well be consistent about it).The rule for nbtree REDO routines from here on is that same-level locksshould be acquired in an order that's consistent with originalexecution. It's not practical to have a similar rule for cross-levelpage locks, since for the most part original execution holds those locksfor a period that spans multiple atomic actions/WAL records. It's alsonot necessary, because clearly the cross-level lock coupling is onlytruly needed during original execution because of the presence ofconcurrent inserters.This is not a bug fix (unlike the similar aforementioned commit, commit9a9db08). The immediate reason to tighten things up in this area is toenable an upcoming enhancement to contrib/amcheck that allows it toverify that sibling links are in agreement with only an AccessShareLock(this check produced false positives when run on a replica server onaccount of the inconsistency fixed by this commit). But that's not theonly reason to be stricter here.It is generally useful to make locking on replicas be as close to whathappens during original execution as practically possible. It makes itless likely that hard to catch bugs will slip in in the future. Theprevious state of affairs seems to be a holdover from before theintroduction of Hot Standby, when buffer lock acquisitions duringrecovery were totally unnecessary. See also: commit3bbf668, whichtightened things up in this area a few years after the introduction ofHot Standby.Discussion:https://postgr.es/m/CAH2-Wz=465cJj11YXD9RKH8z=nhQa2dofOZ_23h67EXUGOJ00Q@mail.gmail.com1 parentcea3d55 commit0a7d771
2 files changed
+35
-46
lines changedLines changed: 6 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
572 | 572 |
| |
573 | 573 |
| |
574 | 574 |
| |
575 |
| - | |
576 |
| - | |
577 |
| - | |
578 |
| - | |
579 |
| - | |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
590 |
| - | |
591 |
| - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
592 | 581 |
| |
593 | 582 |
| |
594 | 583 |
| |
|
Lines changed: 29 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
172 | 172 |
| |
173 | 173 |
| |
174 | 174 |
| |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
| |||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
275 |
| - | |
276 |
| - | |
277 |
| - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
278 | 286 |
| |
279 | 287 |
| |
280 | 288 |
| |
| |||
427 | 435 |
| |
428 | 436 |
| |
429 | 437 |
| |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
434 |
| - | |
435 |
| - | |
436 |
| - | |
437 |
| - | |
438 |
| - | |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 |
| - | |
| 438 | + | |
446 | 439 |
| |
447 | 440 |
| |
448 | 441 |
| |
| |||
460 | 453 |
| |
461 | 454 |
| |
462 | 455 |
| |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
463 | 464 |
| |
464 | 465 |
| |
465 | 466 |
| |
| |||
733 | 734 |
| |
734 | 735 |
| |
735 | 736 |
| |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
736 | 742 |
| |
737 | 743 |
| |
738 | 744 |
| |
| |||
789 | 795 |
| |
790 | 796 |
| |
791 | 797 |
| |
792 |
| - | |
793 |
| - | |
794 |
| - | |
795 |
| - | |
796 |
| - | |
797 |
| - | |
798 | 798 |
| |
799 | 799 |
| |
800 | 800 |
| |
|
0 commit comments
Comments
(0)