postgres.git / summary / log / commit / refs
commit a9cb202e9e09fe1031e5dd03408668bebe6f98a2
Author: Álvaro Herrera <alvherre@kurilemu.de>
Date: Wed Nov 11 16:18:39 2026 +0000
First released in: 19.0
Have the REPACK decoding worker use temp_file_limit from the steering backend
Expand the a62ff0829d6b shenanigans to temp_file_limit, to override any
role- or database-specific configured value with the value from the
current session.
Author: Shihao Zhong <zhong950419@gmail.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/CAGRkXqTYaBjFvjtjPb1+=sZWvt93=2c472bmM+xdG7w9ZvAydA@mail.gmail.com
src/backend/commands/repack.c | 6 +++++-
src/backend/commands/repack_worker.c | 4 +++-
src/include/commands/repack_internal.h | 3 ++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c
index 478287c717d..8cf339a9cc7 100644
--- a/src/backend/commands/repack.c
+++ b/src/backend/commands/repack.c
@@ -3882,9 +3882,13 @@ start_repack_decoding_worker(Oid relid)
shared->backend_pid = MyProcPid;
shared->backend_proc_number = MyProcNumber;
- /* Transmit our timeouts to the worker too */
+ /*
+ * Transmit any relevant settings to the worker too. These would override
+ * any role- or database-level configuration with that from this session.
+ */
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 e443abf5ea1..f9f8c71ceb4 100644
--- a/src/backend/commands/repack_worker.c
+++ b/src/backend/commands/repack_worker.c
@@ -115,11 +115,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 c14107b663f..8bc0181d782 100644
--- a/src/include/commands/repack_internal.h
+++ b/src/include/commands/repack_internal.h
@@ -102,9 +102,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;
[parent: 44cf2892bbfa]