aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-07-12 15:30:52 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-07-12 15:30:52 +0300
commit49a3360209ba07d385f1a9e619854bbbe1b7005f (patch)
treee69052f7fa969f987c3abcdd2325f19beb846d3e /src/backend/utils/adt/ruleutils.c
parent09ed6c7e6765ac4638d1aad2d0babaeaecda5594 (diff)
downloadpostgresql-49a3360209ba07d385f1a9e619854bbbe1b7005f.tar.gz
postgresql-49a3360209ba07d385f1a9e619854bbbe1b7005f.zip
Fix ordering of operations in SyncRepWakeQueue to avoid assertion failure.
Commit 14e8803f1 removed the locking in SyncRepWaitForLSN, but that introduced a race condition, where SyncRepWaitForLSN might see syncRepState already set to SYNC_REP_WAIT_COMPLETE, but the process was not yet removed from the queue. That tripped the assertion, that the process should no longer be in the uqeue. Reorder the operations in SyncRepWakeQueue to remove the process from the queue first, and update syncRepState only after that, and add a memory barrier in between to make sure 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.org
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
0 files changed, 0 insertions, 0 deletions