Fix vacuum_cost_delay check for balance calculation.
authorDaniel Gustafsson <[email protected]>
Tue, 25 Apr 2023 11:54:10 +0000 (13:54 +0200)
committerDaniel Gustafsson <[email protected]>
Tue, 25 Apr 2023 11:54:10 +0000 (13:54 +0200)
Commit 1021bd6a89 excluded autovacuum workers from cost-limit balance
calculations when per-relation options were set.  The code checks for
limit and cost_delay being greater than zero, but since cost_delay can
be set to -1 the test needs to check for greater than or zero.

Backpatch to all supported branches since 1021bd6a89 was backpatched
all the way at the time.

Author: Masahiko Sawada <[email protected]>
Reviewed-by: Melanie Plageman <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com
Backpatch-through: v11 (all supported branches)

src/backend/postmaster/autovacuum.c

index 6c73d32ad2eaa01303540f857aaefb1a51979902..13fa79b06b711c976bbfc1bd0b70f49af3c7f103 100644 (file)
@@ -2963,7 +2963,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
         */
        tab->at_dobalance =
            !(avopts && (avopts->vacuum_cost_limit > 0 ||
-                        avopts->vacuum_cost_delay > 0));
+                        avopts->vacuum_cost_delay >= 0));
 
        /*
         * When we decide to do vacuum or analyze, the existing stats cannot