Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout
Date
Msg-id 8532.1104778518@sss.pgh.pa.us
Whole thread Raw
In response to Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> I think that it would work for BufferAlloc to share-lock the victim
> buffer before calling FlushBuffer; we'd have to add a bool parameter to
> FlushBuffer telling it the lock was already acquired.

I've applied a patch for this.

> BTW, it looks to me like this deadlock potential has existed at least
> since 7.0.  I seem to recall one or two reports of unexplainable
> apparent deadlocks, which perhaps are now explained.

On closer investigation the deadlock does not seem to exist in 7.4 and
before, because BufferReplace didn't acquire the buffer sharelock.
(There is a comment in the 7.4 code claiming that we didn't need to,
but I'm unconvinced that it's correct...)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Roland Volkmann
Date:
Subject: Re: PostgreSQL 8.0.0 Release Candidate 3
Next
From: "Joshua D. Drake"
Date:
Subject: Re: TSearch still in contrib?