diff options
| author | Simon Riggs <simon@2ndQuadrant.com> | 2011-11-02 08:03:21 +0000 |
|---|---|---|
| committer | Simon Riggs <simon@2ndQuadrant.com> | 2011-11-02 08:03:21 +0000 |
| commit | 2f55c535e1f026929cf20855b3790d3632062d42 (patch) | |
| tree | 80069348e7b2a454c08c8fc4ffad7aed84db901d /src/backend/access/transam/clog.c | |
| parent | 7f797d27fe0be5200ad5fd5af6cefcee30c8e24a (diff) | |
Fix timing of Startup CLOG and MultiXact during Hot Standby
Patch by me, bug report by Chris Redekop, analysis by Florian Pflug
Diffstat (limited to 'src/backend/access/transam/clog.c')
| -rw-r--r-- | src/backend/access/transam/clog.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index cb3f91a76b0..e594a55c399 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -490,6 +490,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 |
