forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit49a3360
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 parent09ed6c7 commit49a3360
1 file changed
+16
-6
lines changedLines changed: 16 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
293 | 293 |
| |
294 | 294 |
| |
295 | 295 |
| |
296 |
| - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
297 | 299 |
| |
| 300 | + | |
298 | 301 |
| |
299 | 302 |
| |
300 | 303 |
| |
| |||
1022 | 1025 |
| |
1023 | 1026 |
| |
1024 | 1027 |
| |
1025 |
| - | |
1026 |
| - | |
| 1028 | + | |
1027 | 1029 |
| |
1028 |
| - | |
| 1030 | + | |
1029 | 1031 |
| |
1030 | 1032 |
| |
1031 |
| - | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
1032 | 1036 |
| |
1033 |
| - | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1034 | 1044 |
| |
1035 | 1045 |
| |
1036 | 1046 |
| |
|
0 commit comments
Comments
(0)