pgsql: Fix a rare race condition when commit_siblings > 0 and a - Mailing list pgsql-committers

From heikki@postgresql.org (Heikki Linnakangas)
Subject pgsql: Fix a rare race condition when commit_siblings > 0 and a
Date
Msg-id 20090331051839.C4E65754ADE@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
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.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/storage/ipc:
        procarray.c (r1.40 -> r1.40.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/ipc/procarray.c?r1=1.40&r2=1.40.2.1)

pgsql-committers by date:

Previous
From: heikki@postgresql.org (Heikki Linnakangas)
Date:
Subject: pgsql: Fix a rare race condition when commit_siblings > 0 and a
Next
From: heikki@postgresql.org (Heikki Linnakangas)
Date:
Subject: pgsql: Fix a rare race condition when commit_siblings > 0 and a