Skip to content

Commit 8504905

Browse files
committed
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.
1 parent 49475aa commit 8504905

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*
2525
* IDENTIFICATION
26-
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.50 2009/06/11 14:49:02 momjian Exp $
26+
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.51 2009/07/29 15:57:11 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -1137,7 +1137,7 @@ CountActiveBackends(void)
11371137
* free list and are recycled. Its contents are nonsense in that case,
11381138
* but that's acceptable for this function.
11391139
*/
1140-
if (proc != NULL)
1140+
if (proc == NULL)
11411141
continue;
11421142

11431143
if (proc == MyProc)

0 commit comments

Comments
 (0)