diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2011-11-02 08:07:44 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2011-11-02 08:07:44 +0000 |
commit | f8409b39d1dae28f063b378b9edee1a657845503 (patch) | |
tree | 1a74543e730865be28c65edd2c49760269d02502 /src/backend/access/transam/clog.c | |
parent | c2891b46a4b04b80e1fe28ad0bfd75b40e97ea3e (diff) | |
download | postgresql-f8409b39d1dae28f063b378b9edee1a657845503.tar.gz postgresql-f8409b39d1dae28f063b378b9edee1a657845503.zip |
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 ee645f7bd47..6a2bf83362f 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -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 |