pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix issues around the "variable" support in the lwlock infrastru 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix issues around the "variable" support in the lwlock infrastru @ 2015-08-02 16:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2015-08-02 16:51 UTC (permalink / raw) To: pgsql-committers Fix issues around the "variable" support in the lwlock infrastructure. The lwlock scalability work introduced two race conditions into the lwlock variable support provided for xlog.c. First, and harmlessly on most platforms, it set/read the variable without the spinlock in some places. Secondly, due to the removal of the spinlock, it was possible that a backend missed changes to the variable's state if it changed in the wrong moment because checking the lock's state, the variable's state and the queuing are not protected by a single spinlock acquisition anymore. To fix first move resetting the variable's from LWLockAcquireWithVar to WALInsertLockRelease, via a new function LWLockReleaseClearVar. That prevents issues around waiting for a variable's value to change when a new locker has acquired the lock, but not yet set the value. Secondly re-check that the variable hasn't changed after enqueing, that prevents the issue that the lock has been released and already re-acquired by the time the woken up backend checks for the lock's state. Reported-By: Jeff Janes Analyzed-By: Heikki Linnakangas Reviewed-By: Heikki Linnakangas Discussion: 5592DB35.2060401@iki.fi Backpatch: 9.5, where the lwlock scalability went in Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/7039760114da45552043f8fa229928e071650173 Modified Files -------------- src/backend/access/transam/xlog.c | 34 ++++--- src/backend/storage/lmgr/lwlock.c | 193 +++++++++++++++++++++---------------- src/include/storage/lwlock.h | 2 +- 3 files changed, 129 insertions(+), 100 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix issues around the "variable" support in the lwlock infrastru @ 2015-08-02 16:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2015-08-02 16:51 UTC (permalink / raw) To: pgsql-committers Fix issues around the "variable" support in the lwlock infrastructure. The lwlock scalability work introduced two race conditions into the lwlock variable support provided for xlog.c. First, and harmlessly on most platforms, it set/read the variable without the spinlock in some places. Secondly, due to the removal of the spinlock, it was possible that a backend missed changes to the variable's state if it changed in the wrong moment because checking the lock's state, the variable's state and the queuing are not protected by a single spinlock acquisition anymore. To fix first move resetting the variable's from LWLockAcquireWithVar to WALInsertLockRelease, via a new function LWLockReleaseClearVar. That prevents issues around waiting for a variable's value to change when a new locker has acquired the lock, but not yet set the value. Secondly re-check that the variable hasn't changed after enqueing, that prevents the issue that the lock has been released and already re-acquired by the time the woken up backend checks for the lock's state. Reported-By: Jeff Janes Analyzed-By: Heikki Linnakangas Reviewed-By: Heikki Linnakangas Discussion: 5592DB35.2060401@iki.fi Backpatch: 9.5, where the lwlock scalability went in Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/27b719173516b54df63a1bba4266798e9f77bbb9 Modified Files -------------- src/backend/access/transam/xlog.c | 34 ++++--- src/backend/storage/lmgr/lwlock.c | 193 +++++++++++++++++++++---------------- src/include/storage/lwlock.h | 2 +- 3 files changed, 129 insertions(+), 100 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2015-08-02 16:51 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-02 16:51 pgsql: Fix issues around the "variable" support in the lwlock infrastru Andres Freund <andres@anarazel.de> 2015-08-02 16:51 pgsql: Fix issues around the "variable" support in the lwlock infrastru Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox