1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

Resolve timing issue with logging locks for Hot Standby.

We log AccessExclusiveLocks for replay onto standby nodes,
but because of timing issues on ProcArray it is possible to
log a lock that is still held by a just committed transaction
that is very soon to be removed. To avoid any timing issue we
avoid applying locks made by transactions with InvalidXid.

Simon Riggs, bug report Tom Lane, diagnosis Pavan Deolasee
This commit is contained in:
Simon Riggs
2012-01-23 23:37:32 +00:00
parent b8a91d9d1c
commit c172b7b02e
4 changed files with 88 additions and 44 deletions

View File

@@ -499,7 +499,7 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
* Remove stale transactions, if any.
*/
ExpireOldKnownAssignedTransactionIds(running->oldestRunningXid);
StandbyReleaseOldLocks(running->oldestRunningXid);
StandbyReleaseOldLocks(running->xcnt, running->xids);
/*
* If our snapshot is already valid, nothing else to do...
@@ -553,12 +553,6 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
* OK, we need to initialise from the RunningTransactionsData record
*/
/*
* Release any locks belonging to old transactions that are not running
* according to the running-xacts record.
*/
StandbyReleaseOldLocks(running->nextXid);
/*
* Nobody else is running yet, but take locks anyhow
*/