From 1a20eb5ef04e4368d1a5acfc6642accfea2f5945 Mon Sep 17 00:00:00 2001 From: Shihao Date: Thu, 17 Sep 2026 20:44:18 -0400 Subject: [PATCH v1] Have the REPACK decoding worker use temp_file_limit from the steering backend The worker runs as the table owner, so a role or database level temp_file_limit of the owner applies to its decoding files. Pass the value from the steering backend, as a62ff0829d6 did for the timeouts. Author: Shihao Zhong Discussion: https://postgr.es/m/CAGRkXqTYaBjFvjtjPb1+=sZWvt93=2c472bmM+xdG7w9ZvAydA@mail.gmail.com --- src/backend/commands/repack.c | 4 +++- src/backend/commands/repack_worker.c | 4 +++- src/include/commands/repack_internal.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c index 759be53d6b8..82f8fc201e0 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -67,6 +67,7 @@ #include "pgstat.h" #include "replication/logicalrelation.h" #include "storage/bufmgr.h" +#include "storage/fd.h" #include "storage/ipc.h" #include "storage/lmgr.h" #include "storage/predicate.h" @@ -3772,9 +3773,10 @@ start_repack_decoding_worker(Oid relid) shared->backend_pid = MyProcPid; shared->backend_proc_number = MyProcNumber; - /* Transmit our timeouts to the worker too */ + /* Transmit our relevant settings to the worker too */ shared->lock_timeout = LockTimeout; shared->transaction_timeout = TransactionTimeout; + shared->temp_file_limit = temp_file_limit; mq = shm_mq_create((char *) BUFFERALIGN(shared->error_queue), REPACK_ERROR_QUEUE_SIZE); diff --git a/src/backend/commands/repack_worker.c b/src/backend/commands/repack_worker.c index 690863c6411..b206522da6d 100644 --- a/src/backend/commands/repack_worker.c +++ b/src/backend/commands/repack_worker.c @@ -111,11 +111,13 @@ RepackWorkerMain(Datum main_arg) BGWORKER_BYPASS_ALLOWCONN | BGWORKER_BYPASS_ROLELOGINCHECK); - /* Adopt the steering backend's relevant timeouts. */ + /* Adopt the steering backend's relevant settings. */ snprintf(buf, sizeof(buf), "%d", shared->lock_timeout); SetConfigOption("lock_timeout", buf, PGC_SUSET, PGC_S_OVERRIDE); snprintf(buf, sizeof(buf), "%d", shared->transaction_timeout); SetConfigOption("transaction_timeout", buf, PGC_SUSET, PGC_S_OVERRIDE); + snprintf(buf, sizeof(buf), "%d", shared->temp_file_limit); + SetConfigOption("temp_file_limit", buf, PGC_SUSET, PGC_S_OVERRIDE); /* * Transaction is needed to open relation, and it also provides us with a diff --git a/src/include/commands/repack_internal.h b/src/include/commands/repack_internal.h index ec6e31d77f2..9592b80f68e 100644 --- a/src/include/commands/repack_internal.h +++ b/src/include/commands/repack_internal.h @@ -95,9 +95,10 @@ typedef struct DecodingWorkerShared /* Role to connect as. */ Oid roleid; - /* Timeouts to use in the worker */ + /* Settings to use in the worker */ int lock_timeout; int transaction_timeout; + int temp_file_limit; /* Relation from which data changes to decode. */ Oid relid; -- 2.37.1 (Apple Git-137.1)