Re: Too many autovacuum workers spawned during forced auto-vacuum

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Too many autovacuum workers spawned during forced auto-vacuum
Date: 2017-01-19 16:47:53
Message-ID: CA+Tgmob90NPa2H3YBQureZQoL-KZFMjVYwOP3qTs6OrQDPqZCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 17, 2017 at 4:02 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Amit's chosen yet another possible place to insert the guard: teach
> autovacuum that if a worker skips at least one table due to concurrent
> autovacuum activity AND ends up vacuuming no tables, don't call
> vac_update_datfrozenxid(). Since there is or was another worker
> running, vac_update_datfrozenxid() either already has been called or
> will be when that worker finishes. So that seems safe. If his patch
> were changed to skip vac_update_datfrozenxid() in all cases where we
> do nothing rather than only when we skip a table due to concurrent
> activity, we'd reintroduce the dropped-database problem that was fixed
> by 794e3e81a0e8068de2606015352c1254cb071a78.

After sleeping on this, I'm inclined to go with Amit's fix for now.
It seems less likely to break anything in the back-branches than any
other option I can think up.

An updated version of that patch is attached. I changed the "if"
statement to avoid having an empty "if" clause and a non-empty "else"
clause, and I rewrote the comment based on my previous analysis.

Barring objections, I'll commit and back-patch this version.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
prevent-useless-autovac-v2.patch invalid/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-01-19 16:50:19 Re: [PATCH] Fix minor race in commit_ts SLRU truncation vs lookups
Previous Message Tom Lane 2017-01-19 16:41:19 Re: pgsql: Add function to import operating system collations