1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Fix timing of Startup CLOG and MultiXact during Hot Standby

Patch by me, bug report by Chris Redekop, analysis by Florian Pflug
This commit is contained in:
Simon Riggs
2011-11-02 08:07:44 +00:00
parent c2891b46a4
commit f8409b39d1
5 changed files with 34 additions and 6 deletions

View File

@ -489,6 +489,25 @@ StartupCLOG(void)
*/
ClogCtl->shared->latest_page_number = pageno;
LWLockRelease(CLogControlLock);
}
/*
* This must be called ONCE at the end of startup/recovery.
*/
void
TrimCLOG(void)
{
TransactionId xid = ShmemVariableCache->nextXid;
int pageno = TransactionIdToPage(xid);
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/*
* Re-Initialize our idea of the latest page number.
*/
ClogCtl->shared->latest_page_number = pageno;
/*
* Zero out the remainder of the current clog page. Under normal
* circumstances it should be zeroes already, but it seems at least