Commit 85049057 authored by Tom Lane's avatar Tom Lane

Fix a thinko introduced into CountActiveBackends by a recent patch:

we should ignore NULL array entries, not non-NULL ones.  This had the
effect of disabling commit_delay, and could have caused a crash in the
rare race condition the patch was intended to fix.

Bug report and diagnosis by Jeff Janes, in bug #4952.
parent 49475aab
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.50 2009/06/11 14:49:02 momjian Exp $ * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.51 2009/07/29 15:57:11 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1137,7 +1137,7 @@ CountActiveBackends(void) ...@@ -1137,7 +1137,7 @@ CountActiveBackends(void)
* free list and are recycled. Its contents are nonsense in that case, * free list and are recycled. Its contents are nonsense in that case,
* but that's acceptable for this function. * but that's acceptable for this function.
*/ */
if (proc != NULL) if (proc == NULL)
continue; continue;
if (proc == MyProc) if (proc == MyProc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment