aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2012-11-29 22:17:15 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2012-11-29 22:17:15 +0000
commitedfc84b878d667bb074048cccb5f363ea66a82c8 (patch)
tree9cbf14f20ef5516faac950acd585b30dc9e4b683
parentfdac4e2ba2ae75080d9e8c6e34934c9d32fe26ee (diff)
downloadpostgresql-edfc84b878d667bb074048cccb5f363ea66a82c8.tar.gz
postgresql-edfc84b878d667bb074048cccb5f363ea66a82c8.zip
Cleanup VirtualXact at end of Hot Standby
Resolves bug 7572 reported by Daniele Varrazzo
-rw-r--r--src/backend/storage/ipc/standby.c3
-rw-r--r--src/backend/storage/lmgr/lock.c3
-rw-r--r--src/include/storage/lock.h1
3 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 8205b4135e4..0658feb076c 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -103,6 +103,9 @@ ShutdownRecoveryTransactionEnvironment(void)
/* Release all locks the tracked transactions were holding */
StandbyReleaseAllLocks();
+
+ /* Cleanup our VirtualTransaction */
+ VirtualXactLockTableCleanup();
}
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index cfe3954637d..c76699dfeb8 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -209,7 +209,6 @@ static bool FastPathUnGrantRelationLock(Oid relid, LOCKMODE lockmode);
static bool FastPathTransferRelationLocks(LockMethod lockMethodTable,
const LOCKTAG *locktag, uint32 hashcode);
static PROCLOCK *FastPathGetRelationLockEntry(LOCALLOCK *locallock);
-static void VirtualXactLockTableCleanup(void);
/*
* To make the fast-path lock mechanism work, we must have some way of
@@ -3734,7 +3733,7 @@ VirtualXactLockTableInsert(VirtualTransactionId vxid)
* Check whether a VXID lock has been materialized; if so, release it,
* unblocking waiters.
*/
-static void
+void
VirtualXactLockTableCleanup()
{
bool fastpath;
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index d629ac2ad2e..2d487fffe3a 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -544,6 +544,7 @@ extern void DumpAllLocks(void);
/* Lock a VXID (used to wait for a transaction to finish) */
extern void VirtualXactLockTableInsert(VirtualTransactionId vxid);
+extern void VirtualXactLockTableCleanup(void);
extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait);
#endif /* LOCK_H */