Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a9781ae

Browse files
Fix autovacuum cost debug logging
Commit 7d71d3d 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
1 parent 0d0aeb0 commit a9781ae

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/backend/postmaster/autovacuum.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,9 +1785,6 @@ FreeWorkerInfo(int code, Datum arg)
17851785
void
17861786
VacuumUpdateCosts(void)
17871787
{
1788-
double original_cost_delay = vacuum_cost_delay;
1789-
int original_cost_limit = vacuum_cost_limit;
1790-
17911788
if (MyWorkerInfo)
17921789
{
17931790
if (av_storage_param_cost_delay >= 0)
@@ -1821,16 +1818,15 @@ VacuumUpdateCosts(void)
18211818
VacuumCostBalance = 0;
18221819
}
18231820

1824-
if (MyWorkerInfo)
1821+
/*
1822+
* Since the cost logging requires a lock, avoid rendering the log message
1823+
* in case we are using a message level where the log wouldn't be emitted.
1824+
*/
1825+
if (MyWorkerInfo && message_level_is_interesting(DEBUG2))
18251826
{
18261827
Oid dboid,
18271828
tableoid;
18281829

1829-
/* Only log updates to cost-related variables */
1830-
if (vacuum_cost_delay == original_cost_delay &&
1831-
vacuum_cost_limit == original_cost_limit)
1832-
return;
1833-
18341830
Assert(!LWLockHeldByMe(AutovacuumLock));
18351831

18361832
LWLockAcquire(AutovacuumLock, LW_SHARED);
@@ -1844,7 +1840,6 @@ VacuumUpdateCosts(void)
18441840
vacuum_cost_limit, vacuum_cost_delay,
18451841
vacuum_cost_delay > 0 ? "yes" : "no",
18461842
VacuumFailsafeActive ? "yes" : "no");
1847-
18481843
}
18491844
}
18501845

0 commit comments

Comments
 (0)