From e62cc373ce6b7f93018b7dd541b89fae0dafb332 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 5 May 2026 15:00:24 +0200 Subject: [PATCH 2/3] Apply data-checksum worker throttling parameters The DataChecksumsWorker accepts cost_delay and cost_limit parameters from pg_enable_data_checksums() so users can throttle the I/O caused by enabling checksums. Due to the API for setting the cost parameters changing between when the code was written, and when it was committed the new cost update function call was omitted and thus the parameters were silently ignored. Fix by calling VacuumUpdateCosts() after assigning the parameters (both during worker startup and on the runtime cost-update path), and by leaving the page-cost weights at their GUC-controlled defaults. Author: SATYANARAYANA NARLAPURAM Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CAHg+QDeevH6aTyWdXYBJW0wOmfoZy66gDi5TfinK_dXeCrHQLg@mail.gmail.com --- src/backend/postmaster/datachecksum_state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/postmaster/datachecksum_state.c b/src/backend/postmaster/datachecksum_state.c index 535da8b0c4a..7cdc662c7a6 100644 --- a/src/backend/postmaster/datachecksum_state.c +++ b/src/backend/postmaster/datachecksum_state.c @@ -1543,14 +1543,14 @@ DataChecksumsWorkerMain(Datum arg) * provides rather than inventing something bespoke. This is an internal * implementation detail and care should be taken to avoid it bleeding * through to the user to avoid confusion. + * + * VacuumUpdateCosts() propagates the values to the variables actually + * read by vacuum_delay_point(). */ VacuumCostDelay = DataChecksumState->cost_delay; VacuumCostLimit = DataChecksumState->cost_limit; - VacuumCostActive = (VacuumCostDelay > 0); + VacuumUpdateCosts(); VacuumCostBalance = 0; - VacuumCostPageHit = 0; - VacuumCostPageMiss = 0; - VacuumCostPageDirty = 0; /* * Create and set the vacuum strategy as our buffer strategy. @@ -1607,7 +1607,7 @@ DataChecksumsWorkerMain(Datum arg) costs_updated = true; VacuumCostDelay = DataChecksumState->launch_cost_delay; VacuumCostLimit = DataChecksumState->launch_cost_limit; - VacuumCostActive = (VacuumCostDelay > 0); + VacuumUpdateCosts(); DataChecksumState->cost_delay = DataChecksumState->launch_cost_delay; DataChecksumState->cost_limit = DataChecksumState->launch_cost_limit; -- 2.39.3 (Apple Git-146)