Re: pgsql: Fix incorrect initialization of ProcGlobal->startupBufferPinWait

Lists: pgsql-committers
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix incorrect initialization of ProcGlobal->startupBufferPinWait
Date: 2011-08-02 17:24:23
Message-ID: E1QoIhb-0007Ux-Qt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.

It was initialized in the wrong place and to the wrong value. With bad
luck this could result in incorrect query-cancellation failures in hot
standby sessions, should a HS backend be holding pin on buffer number 1
while trying to acquire a lock.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2e53bd5517431637e495c7614761e5aae46b4eba

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 3 ++-
src/backend/storage/lmgr/proc.c | 10 ++++------
src/include/storage/proc.h | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix incorrect initialization of ProcGlobal->startupBufferPinWait
Date: 2011-08-02 19:16:06
Message-ID: CA+U5nM+k_eEB8QO60QuPxWhyjPLzhTGVVsjapvA8a0Ow6JLJjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Tue, Aug 2, 2011 at 6:24 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
>
> It was initialized in the wrong place and to the wrong value.  With bad
> luck this could result in incorrect query-cancellation failures in hot
> standby sessions, should a HS backend be holding pin on buffer number 1
> while trying to acquire a lock.

Did I miss a bug report?

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix incorrect initialization of ProcGlobal->startupBufferPinWait
Date: 2011-08-02 19:23:15
Message-ID: 27843.1312312995@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> On Tue, Aug 2, 2011 at 6:24 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
>>
>> It was initialized in the wrong place and to the wrong value. With bad
>> luck this could result in incorrect query-cancellation failures in hot
>> standby sessions, should a HS backend be holding pin on buffer number 1
>> while trying to acquire a lock.

> Did I miss a bug report?

No, this was something I happened across in code-reading a few weeks ago
and had a note to myself to fix. While looking at it today I found more
problems ... see second commit.

regards, tom lane


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix incorrect initialization of ProcGlobal->startupBufferPinWait
Date: 2011-08-02 20:13:56
Message-ID: CA+U5nM+RHC=4nvqK3mpjoH_tk2MFoQV9XKdp=PgaO6JggsDn+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

On Tue, Aug 2, 2011 at 8:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
>> On Tue, Aug 2, 2011 at 6:24 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
>>>
>>> It was initialized in the wrong place and to the wrong value.  With bad
>>> luck this could result in incorrect query-cancellation failures in hot
>>> standby sessions, should a HS backend be holding pin on buffer number 1
>>> while trying to acquire a lock.
>
>> Did I miss a bug report?
>
> No, this was something I happened across in code-reading a few weeks ago
> and had a note to myself to fix.  While looking at it today I found more
> problems ... see second commit.

I'm happy to fix problems I've caused that are reported to me.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services