Re: Add missing CHECK_FOR_INTERRUPTS in autovacuum catalog scan loops

From: Dapeng Wang <wangdp20191008(at)gmail(dot)com>
To: Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add missing CHECK_FOR_INTERRUPTS in autovacuum catalog scan loops
Date: 2026-04-10 11:57:22
Message-ID: CAKx0YhxRYuWCSC3mCTJ0VRn0iM8v0G=7vku=3Wg7pyi+rN-=Jw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lakshmi N <lakshmin(dot)jhs(at)gmail(dot)com> 于2026年4月10日周五 16:39写道:

> Hi hackers,
>
> I noticed CFI is missing while scanning pg_class for RELKIND_RELATION and
> RELKIND_TOASTVALUE. On a database with several thousands of tables, these
> scans can take a noticeable amount of time. Attached a patch to address
> this.
>
> Regards,
> Lakshmi
>
Hi Lakshmi,

The patch applies cleanly to HEAD and compiles without warnings.
make check passes (one unrelated ICU collation diff).

The two CHECK_FOR_INTERRUPTS() additions in do_autovacuum() look
correct and are well-placed at the top of each loop iteration,
before any resources are acquired.

I noticed there are other similar catalog scan loops in
autovacuum.c that also lack CHECK_FOR_INTERRUPTS():

- The pg_database scan loop around line 1854
- The pg_class scan loop around line 3664

Should those be covered as well?

Regards,
Dapeng Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2026-04-10 12:23:16 Re: Heads Up: cirrus-ci is shutting down June 1st
Previous Message Nazir Bilal Yavuz 2026-04-10 11:51:24 Re: Heads Up: cirrus-ci is shutting down June 1st