forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8f0de71
committed
Don't ignore locktable-full failures in StandbyAcquireAccessExclusiveLock.
Commit37c5486 removed the code in StandbyAcquireAccessExclusiveLockthat checked the return value of LockAcquireExtended. That created abug, because it's still passing reportMemoryError = false toLockAcquireExtended, meaning that LOCKACQUIRE_NOT_AVAIL will be returnedif we're out of shared memory for the lock table.In such a situation, the startup process would believe it had acquired anexclusive lock even though it hadn't, with potentially dire consequences.To fix, just drop the use of reportMemoryError = false, which allows usto simplify the call into a plain LockAcquire(). It's unclear that thelocktable-full situation arises often enough that it's worth having abetter recovery method than crash-and-restart. (I strongly suspect thatthe only reason the code path existed at all was that it was relativelysimple to do in the pre-37c54863c implementation. But now it's not.)LockAcquireExtended's reportMemoryError parameter is now dead code andcould be removed. I refrained from doing so, however, because therewas some interest in resurrecting the behavior if we do get reports oflocktable-full failures in the field. Also, it seems unwise to removethe parameter concurrently with shipping commitf868a81, which added aparameter; if there are any third-party callers of LockAcquireExtended,we want them to get a wrong-number-of-parameters compile error ratherthan a possibly-silent misinterpretation of its last parameter.Back-patch to 9.6 where the bug was introduced.Discussion:https://postgr.es/m/6202.1536359835@sss.pgh.pa.us1 parent2a63683 commit8f0de71
2 files changed
+8
-7
lines changedLines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
661 | 661 |
| |
662 | 662 |
| |
663 | 663 |
| |
664 |
| - | |
665 |
| - | |
| 664 | + | |
666 | 665 |
| |
667 | 666 |
| |
668 | 667 |
| |
|
Lines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
693 | 693 |
| |
694 | 694 |
| |
695 | 695 |
| |
696 |
| - | |
697 |
| - | |
698 |
| - | |
699 |
| - | |
700 |
| - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
701 | 703 |
| |
702 | 704 |
| |
703 | 705 |
| |
|
0 commit comments
Comments
(0)