From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | DROP DATABASE is interruptible |
Date: | 2023-03-14 17:45:21 |
Message-ID: | 20230314174521.74jl6ffqsee5mtug@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Unfortunately DROP DATABASE does not hold interrupt over its crucial steps. If
you e.g. set a breakpoint on DropDatabaseBuffers() and then do a signal
SIGINT, we'll process that interrupt before the transaction commits.
A later connect to that database ends with:
2023-03-14 10:22:24.443 PDT [3439153][client backend][3/2:0][[unknown]] PANIC: could not open critical system index 2662
It's not entirely obvious how to fix this. We can't just hold interrupts for
the whole transaction - for one, we hang if we do so, because it prevents
ourselves from absorbing our own barrier:
/* Close all smgr fds in all backends. */
WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));
ISTM that at the very least dropdb() needs to internally commit *before*
dropping buffers - after that point the database is corrupt.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark (as CFM) | 2023-03-14 17:46:07 | Re: [EXTERNAL] Re: Add non-blocking version of PQcancel |
Previous Message | Tom Lane | 2023-03-14 17:40:25 | Re: [PATCH] Add pretty-printed XML output option |