agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Dmitrii Dolgov <9erthalion6@gmail.com>
Subject: [PATCH v5 01/10] Process config reload in AIO workers
Date: Tue, 17 Jun 2025 15:14:33 +0200

Currenly AIO workers process interrupts only via CHECK_FOR_INTERRUPTS,
which does not include ConfigReloadPending. Thus we need to check for it
explicitly.
---
 src/backend/storage/aio/method_worker.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/backend/storage/aio/method_worker.c b/src/backend/storage/aio/method_worker.c
index 36be179678d..b4d5c46fb94 100644
--- a/src/backend/storage/aio/method_worker.c
+++ b/src/backend/storage/aio/method_worker.c
@@ -80,6 +80,7 @@ static void pgaio_worker_shmem_init(bool first_time);
 static bool pgaio_worker_needs_synchronous_execution(PgAioHandle *ioh);
 static int	pgaio_worker_submit(uint16 num_staged_ios, PgAioHandle **staged_ios);
 
+static void pgaio_worker_process_interrupts(void);
 
 const IoMethodOps pgaio_worker_ops = {
 	.shmem_size = pgaio_worker_shmem_size,
@@ -461,6 +462,8 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
 		int			nwakeups = 0;
 		int			worker;
 
+		pgaio_worker_process_interrupts();
+
 		/*
 		 * Try to get a job to do.
 		 *
@@ -584,3 +587,25 @@ pgaio_workers_enabled(void)
 {
 	return io_method == IOMETHOD_WORKER;
 }
+
+/*
+ * Process any new interrupts.
+ */
+static void
+pgaio_worker_process_interrupts(void)
+{
+	/*
+	 * Reloading config can trigger further signals, complicating interrupts
+	 * processing -- so let it run first.
+	 *
+	 * XXX: Is there any need in memory barrier after ProcessConfigFile?
+	 */
+	if (ConfigReloadPending)
+	{
+		ConfigReloadPending = false;
+		ProcessConfigFile(PGC_SIGHUP);
+	}
+
+	if (ProcSignalBarrierPending)
+		ProcessProcSignalBarrier();
+}
-- 
2.49.0


--bwrlgp6w2ubxykjq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="v5-0002-Introduce-pending-flag-for-GUC-assign-hooks.patch"



view thread (180+ messages)  latest in thread

Message-ID: <no-message-id-1396945@localhost>
Permalink:  ../../no-message-id-1396945@localhost/
Also on:    postgresql.org/message-id/no-message-id-1396945@localhost

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: pgsql-hackers@postgresql.org
  Cc: 9erthalion6@gmail.com
  Subject: Re: [PATCH v5 01/10] Process config reload in AIO workers
  In-Reply-To: <no-message-id-1396945@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