diff options
author | Daniel Gustafsson <dgustafsson@postgresql.org> | 2023-04-20 15:45:44 +0200 |
---|---|---|
committer | Daniel Gustafsson <dgustafsson@postgresql.org> | 2023-04-20 15:45:44 +0200 |
commit | a9781ae11ba2fdb44a3a72c9a7ebb727140b25c5 (patch) | |
tree | b4118a646f5ece3383e175feae2709300060c9d5 /src/backend | |
parent | 0d0aeb04c1277edb0733cbf5bf4243c47a439015 (diff) | |
download | postgresql-a9781ae11ba2fdb44a3a72c9a7ebb727140b25c5.tar.gz |
Fix autovacuum cost debug logging
Commit 7d71d3dd0 introduced finer grained updates of autovacuum option
changes by increasing the frequency of reading the configuration file.
The debug logging of cost parameter was however changed such that some
initial values weren't logged. Fix by changing logging to use the old
frequency of logging regardless of them changing.
Also avoid taking a log for rendering the log message unless the set
loglevel is such that the log entry will be emitted.
Author: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/postmaster/autovacuum.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 53c8f8d79c..e23ec32e22 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -1785,9 +1785,6 @@ FreeWorkerInfo(int code, Datum arg) void VacuumUpdateCosts(void) { - double original_cost_delay = vacuum_cost_delay; - int original_cost_limit = vacuum_cost_limit; - if (MyWorkerInfo) { if (av_storage_param_cost_delay >= 0) @@ -1821,16 +1818,15 @@ VacuumUpdateCosts(void) VacuumCostBalance = 0; } - if (MyWorkerInfo) + /* + * Since the cost logging requires a lock, avoid rendering the log message + * in case we are using a message level where the log wouldn't be emitted. + */ + if (MyWorkerInfo && message_level_is_interesting(DEBUG2)) { Oid dboid, tableoid; - /* Only log updates to cost-related variables */ - if (vacuum_cost_delay == original_cost_delay && - vacuum_cost_limit == original_cost_limit) - return; - Assert(!LWLockHeldByMe(AutovacuumLock)); LWLockAcquire(AutovacuumLock, LW_SHARED); @@ -1844,7 +1840,6 @@ VacuumUpdateCosts(void) vacuum_cost_limit, vacuum_cost_delay, vacuum_cost_delay > 0 ? "yes" : "no", VacuumFailsafeActive ? "yes" : "no"); - } } |