Re: Make autovacuum sort tables in descending order of xid_age

From: David Kimura <david(dot)g(dot)kimura(at)gmail(dot)com>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, Christophe Pettus <xof(at)thebuild(dot)com>
Subject: Re: Make autovacuum sort tables in descending order of xid_age
Date: 2020-01-08 01:40:12
Message-ID: CAHnPFjQ-ewHe9kZ40muZ0OP8Y6YQ=tp9sKZQ5J4VmkfrqzOhFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 7, 2020 at 12:47 PM David Fetter <david(at)fetter(dot)org> wrote:
> Per a suggestion Christophe made, please find attached a patch to
> $Subject:

Curious, what's the benefit of autovacuum handling the oldest tables
first? If there is a related thread with the discussion, I couldn't find
it.

> Apart from carefully fudging with pg_resetwal, and short of running in
> production for a few weeks, what would be some good ways to test this?

Greenplum tests autovacuum using a fault injection framework, which
was once proposed by Asim [1] and a function to consume xids [2].

If that isn't an option, maybe you could acquire a vacuum blocking
lock on a table, for example by creating index on it inside a dangling
transaction. Then after autovacuum worker blocks, in a separate
session you could check that a previously older table is now younger.
Does that suffice?

Thanks,
David

[1] https://www.postgresql.org/message-id/CANXE4TdxdESX1jKw48xet-5GvBFVSq=4cgNeioTQff372KO45A@mail.gmail.com
[2] https://github.com/greenplum-db/gpdb/blob/5feccaae6838e68b1443e46ed39d162613c5ece8/src/test/regress/regress_gp.c#L2003

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2020-01-08 01:49:48 Re: Consolidate 'unique array values' logic into a reusable function?
Previous Message Stephen Frost 2020-01-08 01:33:48 Re: backup manifests