Re: "PANIC: could not open critical system index 2662" - twice - Mailing list pgsql-general

From Thomas Munro
Subject Re: "PANIC: could not open critical system index 2662" - twice
Date
Msg-id CA+hUKGJs6RR6pNGG3-Gd-jKV9Mx=1v7=GXaY6MBas7TEKOO8Dw@mail.gmail.com
Whole thread Raw
In response to Re: "PANIC: could not open critical system index 2662" - twice  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, May 9, 2023 at 10:04 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael@paquier.xyz> writes:
> > One thing I was wondering about to improve the odds of the hits is to
> > be more aggressive with the number of relations created at once, so as
> > we are much more aggressive with the number of pages extended in
> > pg_class from the origin database.
>
> Andres seems to think it's a problem with aborting a DROP DATABASE.
> Adding more data might serve to make the window wider, perhaps.

Here's an easy way:

@@ -1689,6 +1689,14 @@ dropdb(const char *dbname, bool missing_ok, bool force)
        /* Close all smgr fds in all backends. */
        WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));

+/* XXX pretend one of the above steps got interrupted by a statement
timeout or ^C */
+if (random() % 2 == 0)
+{
+QueryCancelPending = true;
+InterruptPending = true;
+CHECK_FOR_INTERRUPTS();
+}

postgres=# create database db2;
CREATE DATABASE
postgres=# drop database db2;
ERROR:  canceling statement due to user request

$ psql db2
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432"
failed: PANIC:  could not open critical system index 2662

$ od -t x1 base/111117/2662
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0100000
$ od -t x1 base/111117/2837
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0040000
$ od -t x1 base/111117/2840
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0100000



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: "PANIC: could not open critical system index 2662" - twice
Next
From: Michael Paquier
Date:
Subject: Re: "PANIC: could not open critical system index 2662" - twice