pgsql: Move call to GetTopTransactionId() earlier in LockAcquire(),

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Move call to GetTopTransactionId() earlier in LockAcquire(),
Date: 2010-11-29 01:10:05
Message-ID: E1PMsFp-00032p-BX@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Move call to GetTopTransactionId() earlier in LockAcquire(),
removing an infrequently occurring race condition in Hot Standby.
An xid must be assigned before a lock appears in shared memory,
rather than immediately after, else GetRunningTransactionLocks()
may see InvalidTransactionId, causing assertion failures during
lock processing on standby.

Bug report and diagnosis by Fujii Masao, fix by me.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=ed78384acd691e3336e170aa18af69d15d088027

Modified Files
--------------
src/backend/storage/ipc/standby.c | 29 +++++++++++++++++++++--------
src/backend/storage/lmgr/lock.c | 29 +++++++++++++++++++++--------
src/include/storage/standby.h | 1 +
3 files changed, 43 insertions(+), 16 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2010-11-29 01:11:23 pgsql: Move call to GetTopTransactionId() earlier in LockAcquire(),
Previous Message Thom Brown 2010-11-28 23:59:55 Re: pgsql: Add index entries for more functions