Re: amcheck/verify_heapam doesn't check for interrupts

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: amcheck/verify_heapam doesn't check for interrupts
Date: 2021-08-26 23:24:08
Message-ID: 7433F43F-B8AE-494E-9C4F-7A024265EE36@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 26, 2021, at 2:38 PM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> It looks like we neglect to call CHECK_FOR_INTERRUPTS() anywhere
> inside verify_heapam.c. Is there any reason for this?

Not any good one that I can see.

> Can't we just
> put a CHECK_FOR_INTERRUPTS() at the top of the outermost loop, inside
> verify_heapam()?

I expect we could.

> Not sure if pg_amcheck itself is a factor here too -- didn't get that far.

That runs an event loop in the client over multiple checks (heap and/or btree) running in backends, just as reindexdb and vacuumdb do over parallel reindexes and vacuums running in backends. It should be just as safe to ctrl-c out of pg_amcheck as out of those two. They all three use fe_utils/cancel.h's setup_cancel_handler(), so I would expect modifying verify_heapam would be enough.


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-08-26 23:30:56 Re: [PATCH] Disable bgworkers during servers start in pg_upgrade
Previous Message Jaime Casanova 2021-08-26 23:16:08 CFM for september commitfest