1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Derive oldestActiveXid at correct time for Hot Standby.

There was a timing window between when oldestActiveXid was derived
and when it should have been derived that only shows itself under
heavy load. Move code around to ensure correct timing of derivation.
No change to StartupSUBTRANS() code, which is where this failed.

Bug report by Chris Redekop
This commit is contained in:
Simon Riggs
2011-11-02 08:54:56 +00:00
parent 10b7c686e5
commit 86e3364899
5 changed files with 71 additions and 6 deletions

View File

@ -815,7 +815,7 @@ standby_desc(StringInfo buf, uint8 xl_info, char *rec)
* making WAL entries.
*/
void
LogStandbySnapshot(TransactionId *oldestActiveXid, TransactionId *nextXid)
LogStandbySnapshot(TransactionId *nextXid)
{
RunningTransactions running;
xl_standby_lock *locks;
@ -845,7 +845,6 @@ LogStandbySnapshot(TransactionId *oldestActiveXid, TransactionId *nextXid)
/* GetRunningTransactionData() acquired XidGenLock, we must release it */
LWLockRelease(XidGenLock);
*oldestActiveXid = running->oldestRunningXid;
*nextXid = running->nextXid;
}