diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2012-11-29 23:52:17 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2012-11-29 23:52:17 +0000 |
commit | 6f9a9da85c9015e773d12e8571c469e5a2a6b3fb (patch) | |
tree | a1fe8668551aef6305df94cf3b5acbd32e2eb9c1 /src/backend/storage/lmgr/lmgr.c | |
parent | 1da5bef3174170a6768bea6621afcbf72dd02a87 (diff) |
Correctly init/deinit recovery xact environment.
Previously we performed VirtualXactLockTableInsert
but didn't set MyProc->lxid for Startup process.
pg_locks now correctly shows "1/1" for vxid
of Startup process during Hot Standby.
At end of Hot Standby the Virtual Transaction
was not deleted, leading to problems after
promoting to normal running for some commands,
such as CREATE INDEX CONCURRENTLY.
Diffstat (limited to 'src/backend/storage/lmgr/lmgr.c')
-rw-r--r-- | src/backend/storage/lmgr/lmgr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index 859b3852dbd..f49222e69d9 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -535,6 +535,24 @@ VirtualXactLockTableInsert(VirtualTransactionId vxid) } /* + * VirtualXactLockTableDelete + * + * Release a Virtual Transaction lock. Only called by Startup process + * at end of Hot Standby. + */ +void +VirtualXactLockTableDelete(VirtualTransactionId vxid) +{ + LOCKTAG tag; + + Assert(VirtualTransactionIdIsValid(vxid)); + + SET_LOCKTAG_VIRTUALTRANSACTION(tag, vxid); + + (void) LockRelease(&tag, ExclusiveLock, false); +} + +/* * VirtualXactLockTableWait * * Waits until the lock on the given VXID is released, which shows that |