0004-Removed-worker-name-check-in-lock.c.patch
text/x-patch
Filename: 0004-Removed-worker-name-check-in-lock.c.patch
Type: text/x-patch
Part: 3
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 0004
Subject: Removed worker name check in lock.c
| File | + | − |
|---|---|---|
| contrib/vci/storage/vci_ros_daemon.c | 0 | 2 |
| src/backend/storage/lmgr/lock.c | 2 | 24 |
From 74a968a3a9b52ec061957d00181aaaef1422a5eb Mon Sep 17 00:00:00 2001
From: Timur Magomedov <t.magomedov@postgrespro.ru>
Date: Fri, 15 Aug 2025 16:11:52 +0300
Subject: [PATCH 4/4] Removed worker name check in lock.c
---
contrib/vci/storage/vci_ros_daemon.c | 2 --
src/backend/storage/lmgr/lock.c | 26 ++------------------------
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/contrib/vci/storage/vci_ros_daemon.c b/contrib/vci/storage/vci_ros_daemon.c
index 88526bf75e9..e82bf3950bc 100644
--- a/contrib/vci/storage/vci_ros_daemon.c
+++ b/contrib/vci/storage/vci_ros_daemon.c
@@ -91,8 +91,6 @@ static bool TryToOpenVCIRelations(Oid indexOid, LOCKMODE heapLock, LOCKMODE inde
static void CheckRosControlWorkerCancel(void);
static void callback_on_exit_worker(int code, Datum arg);
-/* BGW_MAXREN = 64 */
-/* If the ROS control worker name is changed then update the bgw_name check in LockAcquire() too.*/
const char VCI_ROS_CONTROL_DAEMON_NAME[BGW_MAXLEN] = "vci:ROS control daemon";
const char VCI_ROS_CONTROL_WORKER_NAME_TEMP[BGW_MAXLEN] = "vci:ROS control worker(slot=%d)";
const char VCI_ROS_CONTROL_WORKER_TYPE[BGW_MAXLEN] = "vci:ROS control worker";
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index c125b8784f4..f8c88147160 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -39,8 +39,6 @@
#include "access/xlogutils.h"
#include "miscadmin.h"
#include "pg_trace.h"
-#include "pgstat.h"
-#include "postmaster/bgworker.h"
#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
@@ -812,18 +810,8 @@ LockAcquire(const LOCKTAG *locktag,
bool sessionLock,
bool dontWait)
{
- /*
- * Don't lock for VCI parallel workers and other type of workers should go
- * in normal flow, In case if there is any change in background worker
- * name for VCI parallel workers, the following code also needs an update.
- * FIXME: Try to use the community parallelism code, so that we don't need
- * our own VCI parallel infrastructure.
- */
- if (AmBackgroundWorkerProcess() && strstr(MyBgworkerEntry->bgw_name, "backend="))
- return LOCKACQUIRE_OK;
- else
- return LockAcquireExtended(locktag, lockmode, sessionLock, dontWait,
- true, NULL, false);
+ return LockAcquireExtended(locktag, lockmode, sessionLock, dontWait,
+ true, NULL, false);
}
/*
@@ -2119,16 +2107,6 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
*/
if (!locallock || locallock->nLocks <= 0)
{
- /*
- * Don't lock for VCI parallel workers and other type of workers
- * should go in normal flow, In case if there is any change in
- * background worker name for VCI parallel workers, the following code
- * also needs an update. FIXME: Try to use the community parallelism
- * code, so that we don't need our own VCI parallel infrastructure.
- */
- if (AmBackgroundWorkerProcess() && strstr(MyBgworkerEntry->bgw_name, "backend="))
- return true;
-
elog(WARNING, "you don't own a lock of type %s",
lockMethodTable->lockModeNames[lockmode]);
return false;
--
2.43.0