]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix a thinko introduced into CountActiveBackends by a recent patch:
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 29 Jul 2009 15:57:39 +0000 (15:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 29 Jul 2009 15:57:39 +0000 (15:57 +0000)
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.

src/backend/storage/ipc/procarray.c

index dd2b4b05f82f90aa1388d579445120bc32566ab7..555e465a82569789c1bcd31976b466b6db2d5325 100644 (file)
@@ -23,7 +23,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.7.2.2 2009/03/31 05:18:47 heikki Exp $
+ *       $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.7.2.3 2009/07/29 15:57:39 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -768,7 +768,7 @@ CountActiveBackends(void)
                 * the free list and are recycled. Its contents are nonsense in that
                 * case, but that's acceptable for this function.
                 */
-               if (proc != NULL)
+               if (proc == NULL)
                        continue;
 
                if (proc == MyProc)