postgres.git / summary / log / commit / refs

commit    c686ed67e5f08c6a6b6f31e2b15d828d44ae1de5
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 80c1a49ae10..61468f7dfd9 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -3841,9 +3841,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 d355b9954fc..909f2a73572 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; [parent: ec41a0cf8891]