]> granicus.if.org Git - postgresql/commit
Fix a rare race condition when commit_siblings > 0 and a transaction commits
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 31 Mar 2009 05:18:39 +0000 (05:18 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 31 Mar 2009 05:18:39 +0000 (05:18 +0000)
commit6bd988355758569e4bce8b600d8175c94fa8d78a
treedb3becbc7192e0663a2b3a58d5916f11f26576e5
parent781e1557e10532969a74deaca0736cc1ef1b5e41
Fix a rare race condition when commit_siblings > 0 and a transaction commits
at the same instant as a new backend is spawned. Since CountActiveBackends()
doesn't hold ProcArrayLock, it needs to be prepared for the case that a
pointer at the end of the proc array is still NULL even though numProcs says
it should be valid, since it doesn't hold ProcArrayLock. Backpatch to 8.1.
8.0 and earlier had this right, but it was broken in the split of PGPROC and
sinval shared memory arrays.

Per report and proposal by Marko Kreen.
src/backend/storage/ipc/procarray.c