Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Wildpaner <mike(at)rainbow(dot)studorg(dot)tuwien(dot)ac(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout
Date: 2005-01-03 18:55:18
Message-ID: 8532.1104778518@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2005-01-03 19:10:52 Re: TSearch still in contrib?
Previous Message Bruce Momjian 2005-01-03 17:36:19 Re: PostgreSQL 8.0.0 Release Candidate 3