public inbox for [email protected]  
help / color / mirror / Atom feed
From: Antonin Houska <[email protected]>
Subject: [PATCH 2/2] Remove dsm_seg from DecodingWorkerShared.
Date: Mon, 13 Apr 2026 11:36:41 +0200

The value is only needed by te worker, so there is no need to store it in
shared memory.
---
 src/backend/commands/repack_worker.c   | 5 +++--
 src/include/commands/repack_internal.h | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/commands/repack_worker.c b/src/backend/commands/repack_worker.c
index 5bd020e0184..a594d6db25f 100644
--- a/src/backend/commands/repack_worker.c
+++ b/src/backend/commands/repack_worker.c
@@ -51,6 +51,7 @@ static XLogSegNo repack_current_segment = 0;
 static RelFileLocator repacked_rel_locator = {.relNumber = InvalidOid};
 static RelFileLocator repacked_rel_toast_locator = {.relNumber = InvalidOid};
 
+static dsm_segment	*worker_dsm_segment = NULL;
 
 /* REPACK decoding worker entry point */
 void
@@ -78,9 +79,9 @@ RepackWorkerMain(Datum main_arg)
 		ereport(ERROR,
 				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				errmsg("could not map dynamic shared memory segment"));
+	worker_dsm_segment = seg;
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
-	shared->dsm_seg = seg;
 
 	/* Arrange to signal the leader if we exit. */
 	before_shmem_exit(RepackWorkerShutdown, PointerGetDatum(shared));
@@ -176,7 +177,7 @@ RepackWorkerShutdown(int code, Datum arg)
 				   PROCSIG_REPACK_MESSAGE,
 				   shared->backend_proc_number);
 
-	dsm_detach(shared->dsm_seg);
+	dsm_detach(worker_dsm_segment);
 }
 
 bool
diff --git a/src/include/commands/repack_internal.h b/src/include/commands/repack_internal.h
index 3ff64444351..6a85cee8910 100644
--- a/src/include/commands/repack_internal.h
+++ b/src/include/commands/repack_internal.h
@@ -107,7 +107,6 @@ typedef struct DecodingWorkerShared
 	PGPROC	   *backend_proc;
 	pid_t		backend_pid;
 	ProcNumber	backend_proc_number;
-	dsm_segment *dsm_seg;
 
 	/*
 	 * Memory the queue is located in.
-- 
2.47.3


--=-=-=--





view thread (590+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH 2/2] Remove dsm_seg from DecodingWorkerShared.
  In-Reply-To: <no-message-id-196244@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox