Re: Assertion failure on hot standby - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Assertion failure on hot standby
Date
Msg-id 6794.1290817629@sss.pgh.pa.us
Whole thread Raw
In response to Re: Assertion failure on hot standby  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Assertion failure on hot standby
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Nov 26, 2010 at 6:35 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think it's not only useless from a performance standpoint, but
>> probably actually dangerous, to not take AccessExclusiveLock on the
>> standby when it's taken on the master.

> As far as I can see, that's complete nonsense.  Deadlocks between what
> and what?

master locks table A, then table B.  Some transaction on the standby
locks table A, then table B (perhaps only with AccessShareLock).
This will work reliably only as long as we don't change the order in
which replay acquires locks.

Now, if the standby process takes its locks in the other order, then
it's at risk anyway.  But coding that works reliably against the master
should not randomly fail on the slave.

> In fact, now that I think about it, what I'm proposing would actually
> substantially REDUCE the risk of deadlock on the standby, because the
> master would only ever need to lock a backing file long enough to drop
> or truncate it, whereas under the present system the startup process
> might need to hold many locks at once.

Now you're the one spouting nonsense.  Consider a master transaction
that does
begin;lock table foo;alter table foo --- some rewriting table operation;alter table foo --- some rewriting table
operation;altertable foo --- some rewriting table operation;alter table foo --- some rewriting table operation;alter
tablefoo --- some rewriting table operation;alter table foo --- some rewriting table operation;alter table foo --- some
rewritingtable operation;commit;
 

On the master, no other transaction can see the intermediate states.
We don't want that property to disappear on the slave.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: duplicate connection failure messages
Next
From: Bruce Momjian
Date:
Subject: Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running