- Notifications
You must be signed in to change notification settings - Fork28
Commit941188a
committed
Fix ordering of operations in SyncRepWakeQueue to avoid assertion failure.
Commit14e8803 removed the locking in SyncRepWaitForLSN, but thatintroduced a race condition, where SyncRepWaitForLSN might seesyncRepState already set to SYNC_REP_WAIT_COMPLETE, but the process wasnot yet removed from the queue. That tripped the assertion, that theprocess should no longer be in the uqeue. Reorder the operations inSyncRepWakeQueue to remove the process from the queue first, and updatesyncRepState only after that, and add a memory barrier in between to makesure the operations are made visible to other processes in that order.Fixes bug #14721 reported by Const Zhang. Analysis and fix by Thomas Munro.Backpatch down to 9.5, where the locking was removed.Discussion:https://www.postgresql.org/message-id/20170629023623.1480.26508%40wrigleys.postgresql.org1 parentf1edf84 commit941188a
1 file changed
+16
-6
lines changedLines changed: 16 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
268 |
| - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
269 | 271 |
| |
| 272 | + | |
270 | 273 |
| |
271 | 274 |
| |
272 | 275 |
| |
| |||
791 | 794 |
| |
792 | 795 |
| |
793 | 796 |
| |
794 |
| - | |
795 |
| - | |
| 797 | + | |
796 | 798 |
| |
797 |
| - | |
| 799 | + | |
798 | 800 |
| |
799 | 801 |
| |
800 |
| - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
801 | 805 |
| |
802 |
| - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
803 | 813 |
| |
804 | 814 |
| |
805 | 815 |
| |
|
0 commit comments
Comments
(0)