Re: BUG #13657: Some kind of undetected deadlock between query and "startup process" on replica. - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #13657: Some kind of undetected deadlock between query and "startup process" on replica.
Date
Msg-id CAB7nPqSvo9zyab3UWPgabSSAhRYHjLPSCqmnZk_6ROiQGANj8A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13657: Some kind of undetected deadlock between query and "startup process" on replica.  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-bugs
On Sun, Oct 25, 2015 at 2:28 AM, Jeff Janes wrote:
> On Sat, Oct 24, 2015 at 4:08 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Sat, Oct 24, 2015 at 4:16 PM, Maxim Boguk wrote:
>>> I suppose deadlock had been happened when replay process replaying
>>> truncation to zero pages after vacuum on the master db (but it's mostly
>>> theory with no good evidence).
>>
>> By what was AccessExclusiveLock created on master? Did you run
>> TRUNCATE on those two relations from time to time?
>
> AccessExclusiveLock is automatically taken by vacuum when it thinks it
> can truncate pages off the end of the relation.

Thanks, I didn't know this one, that's in lazy_truncate_heap. Still I
don't think that this would normally deadlock except if the order of
the records was somewhat swapped: if the truncation actually happens
what is generated is XLOG_SMGR_TRUNCATE and this code path does not
perform recovery conflict checks. A XLOG_HEAP2_CLEAN record is
generated before the exclusive lock is taken for truncation.
--
Michael

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently
Next
From: zkronion@gmail.com
Date:
Subject: BUG #13727: pg_dump with a connection string fails when performing parallel backup