Re: Hot Standby and prepared transactions

From: Hiroyuki Yamada <yamada(at)kokolink(dot)net>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hot Standby and prepared transactions
Date: 2009-12-17 10:55:36
Message-ID: 200912171055.AA00174@silver.kokolink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>On Wed, 2009-12-16 at 19:35 +0900, Hiroyuki Yamada wrote:
>
>> * There is a window beween gathering lock information in GetRunningTransactionLocks()
>> and writing WAL in LogAccessExclusiveLocks().
>> * In current lock redo algorithm, locks are released when the transaction holding the lock
>> are commited or aborted.
>>
>> ... then what happens if any transaction holding ACCESS EXCLUSIVE lock commits in the
>> window ?
>
>Yes, was a problem in that code. Fixed in git.
>
>We were doing it for prepared transactions but not for normal xacts.
>I will look again at that code.
>
>Thanks very much for reading the code. Any more?!?
>

Well, I've read some more and have a question.

The implementation assumes that transactions write COMMIT/ABORT WAL at the end
of them, while it does not seem to write ABORT WAL in immediate shutdown. So,

1. acquire ACCESS EXCLUSIVE lock in table A in xact 1
2. execute immediate shutdown of the active node
3. restart it
4. acquire ACCESS EXCLUSIVE lock in table A in xact 2

...then, duplicate lock acquisition by two diffrent transactions can occur in the standby node.

Am I missing something ? Or is this already reported ?

regards,

--
Hiroyuki YAMADA
Kokolink Corporation
yamada(at)kokolink(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-12-17 11:24:52 Re: Hot Standby and prepared transactions
Previous Message David Fetter 2009-12-17 10:51:56 Re: PATCH: Spurious "22" in hstore.sgml