Re: amcheck/verify_heapam doesn't check for interrupts

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
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:39:18
Message-ID: CAH2-WzksH1i_wLQaj-aqfSEKA_UvVz1vtWN9R13AwE4Wk5z6YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 26, 2021 at 4:24 PM Mark Dilger
<mark(dot)dilger(at)enterprisedb(dot)com> wrote:
> > 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.

Seems that way. Want to post a patch?

> > 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.

Right. I checked that out myself, after sending my email from earlier.
We don't have any problems when pg_amcheck happens to be verifying a
B-Tree index -- verify_nbtree.c already has CHECK_FOR_INTERRUPTS() at
a few key points.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-08-26 23:41:07 Re: amcheck/verify_heapam doesn't check for interrupts
Previous Message Peter Geoghegan 2021-08-26 23:37:08 Re: The Free Space Map: Problems and Opportunities