]> granicus.if.org Git - postgresql/commit
Fix leakage of cost_limit when multiple autovacuum workers are active.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Nov 2010 03:28:35 +0000 (22:28 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Nov 2010 03:28:35 +0000 (22:28 -0500)
commit6cb9d51133a2e42f107074f64fee704c90aa9df9
tree5833d1c800fc45597ae768dea7a5623a8977f837
parentf06829992556f54a82edf1372dadc1e2f4b51935
Fix leakage of cost_limit when multiple autovacuum workers are active.

When using default autovacuum_vac_cost_limit, autovac_balance_cost relied
on VacuumCostLimit to contain the correct global value ... but after the
first time through in a particular worker process, it didn't, because we'd
trashed it in previous iterations.  Depending on the state of other autovac
workers, this could result in a steady reduction of the effective
cost_limit setting as a particular worker processed more and more tables,
causing it to go slower and slower.  Spotted by Simon Poole (bug #5759).
Fix by saving and restoring the GUC variables in the loop in do_autovacuum.

In passing, improve a few comments.

Back-patch to 8.3 ... the cost rebalancing code has been buggy since it was
put in.
src/backend/postmaster/autovacuum.c