Re: fix oversight converting buf_id to Buffer - Mailing list pgsql-hackers

From Andres Freund
Subject Re: fix oversight converting buf_id to Buffer
Date
Msg-id 20150810231537.GA22153@awork2.anarazel.de
Whole thread Raw
In response to fix oversight converting buf_id to Buffer  (Qingqing Zhou <zhouqq.postgres@gmail.com>)
Responses Re: fix oversight converting buf_id to Buffer  (Qingqing Zhou <zhouqq.postgres@gmail.com>)
Re: fix oversight converting buf_id to Buffer  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

That's a very nice catch! Did you trigger the error or just found it
when reading the code?

On 2015-08-10 12:12:01 -0700, Qingqing Zhou wrote:
> Attached patch fixes oversights converting buf_id to Buffer in
> PrintBufferDescs() and InvalidateBuffer(). Especially for the latter,
> the reason we haven't seen any reports of the issue might be that it
> needs certain concurrent conditions to be true.

PrintBufferDescs() is dead code, so bit is not surprising. I'm also not
surprised that the wrong buffer in InvalidateBuffer()'s check doesn't
trigger. You'd have to have a cursor open in the current backend that
currently pins the off-by-one buffer.

I'm too tired right now to look at this, but it generally looked sane.

Regards,

Andres



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [patch] A \pivot command for psql
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Fix pg_dump to dump shell types.