0001-Use-correct-locking-at-two-functions-used-by-Hot-Sta.patch

text/x-patch

Filename: 0001-Use-correct-locking-at-two-functions-used-by-Hot-Sta.patch
Type: text/x-patch
Part: 0
Message: Small locking bugs in hs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0001
Subject: Use correct locking at two functions used by Hot Standby - while not likely to cause issues in reality its better to be correct.
File+
src/backend/storage/ipc/procarray.c 2 2
From e70524baa7399972e51345d81b50377d7f15196d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 27 Dec 2009 17:28:39 +0100
Subject: [PATCH 1/2] Use correct locking at two functions used by Hot Standby - while not
 likely to cause issues in reality its better to be correct.

---
 src/backend/storage/ipc/procarray.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 85f14f6..8e2de35 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1648,7 +1648,7 @@ GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid,
 					 errmsg("out of memory")));
 	}
 
-	LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
+	LWLockAcquire(ProcArrayLock, LW_SHARED);
 
 	/*
 	 * If we don't know the TransactionId that created the conflict, set
@@ -1710,7 +1710,7 @@ CancelVirtualTransaction(VirtualTransactionId vxid, int cancel_mode)
 	int			index;
 	pid_t		pid = 0;
 
-	LWLockAcquire(ProcArrayLock, LW_SHARED);
+	LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
 
 	for (index = 0; index < arrayP->numProcs; index++)
 	{
-- 
1.6.5.12.gd65df24