Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJHlQ-0003iG-6H for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Aug 2022 17:02:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJHkP-0003Wa-8J for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Aug 2022 17:01:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJHkO-0003Ug-Mt for pgsql-hackers@lists.postgresql.org; Wed, 03 Aug 2022 17:01:28 +0000 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oJHkH-0002Zi-Bi for pgsql-hackers@lists.postgresql.org; Wed, 03 Aug 2022 17:01:27 +0000 Received: by mail-qk1-x729.google.com with SMTP id c24so13224876qkm.4 for ; Wed, 03 Aug 2022 10:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc; bh=jccOu50wqnlPiz4Qnb0hOT27ZmOuOJQoqP7UN3r9Wg0=; b=CC30LS7xIjZi9vAOZfzMJdjZkiMg0rEH2MxSgrsZuM+RQfBblNHTLv28xr3vnK+pYp o8sFrzCopTn88n87PJqCIag//YyLntlIbLzDuNkLE/JkVIT214ETyfCsnfRWF37I2rjq 49CiVHXng0SFm/A7KshKsjgwqCTtOxf98SQAAqT3OzcxvaFjc75J1TYxDoSqKM8UT6nD q1p1WDzkDC+jJa2kixfnxNieNRN5UReLIPSY8/+h+VRb/md2/HQYqU7E2OkD8tZCinaC ujDI20obVGWiF4gFjjpqCpmmnmovZoo+dugIRnJFgwkLgrvo2cav19Pkb6DPv7gv0/j5 iAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc; bh=jccOu50wqnlPiz4Qnb0hOT27ZmOuOJQoqP7UN3r9Wg0=; b=0YS9eDXdhZAUt/mbHs8pwWbB78oaj0P5NhG3kSEQ1LjSWkcK71bRmMM7ExJrBFATD4 naDFZgM/T5BdK2QmHJGj8bC1hM/PRdRhBPpNoiGURLkdfQVBIZpKQksgxvTOfwRKP0ea AcfHxt9qOFHtYIX3vrf2dRbU3MEUSMwo+QN1G3npNE3lA7LgJVRGTiPZ7Af/zXfZtZm5 xEEYqWLKPfyJAGPUAuo3s0f9HtUx9aIH6RW1mPXGJLjiWH1pvbYYB/83rqfc3FXG8OEC VMwmJqEB0MX5TTHNg+V3vtJHIj9s5ZxwtgpfhauZJKiHvse3TO/tGp0X7jKtdxEoZ5+P Mb6A== X-Gm-Message-State: AJIora9y8BuJoyDvDHqnYcL03ZWt6rhVCFtWQspLBQAWHotAvpTUtBJO ORpvfw/xUTJnJJ/nxg9pKgE33A== X-Google-Smtp-Source: AGRyM1sbKEEjvR4U8qehzurkpRLKxZMFpaCABFbyL7LV9zRLgDCF/aOHGaYsOIBXLHeFFvqS/7iDmg== X-Received: by 2002:a05:620a:1929:b0:6b6:19c9:462f with SMTP id bj41-20020a05620a192900b006b619c9462fmr18101605qkb.688.1659546080182; Wed, 03 Aug 2022 10:01:20 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n4-20020a05622a11c400b0031f229d4427sm1873847qtk.96.2022.08.03.10.01.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Aug 2022 10:01:19 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 0420680079B; Wed, 3 Aug 2022 12:01:18 -0500 (CDT) Date: Wed, 3 Aug 2022 12:01:18 -0500 From: Justin Pryzby To: Dilip Kumar Cc: Andres Freund , Tom Lane , Robert Haas , Ashutosh Sharma , Maciek Sakrejda , Bruce Momjian , Alvaro Herrera , Andrew Dunstan , Heikki Linnakangas , pgsql-hackers@lists.postgresql.org Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints Message-ID: <20220803170118.GG19644@telsasoft.com> References: <20220802175043.GA13682@telsasoft.com> <2767668.1659476794@sss.pgh.pa.us> <20220802220416.GC13682@telsasoft.com> <20220802222334.umf5wsa2r63koppn@awork3.anarazel.de> <20220803160200.GD19644@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220803160200.GD19644@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Aug 03, 2022 at 11:02:00AM -0500, Justin Pryzby wrote: > But I reproduced the first problem with a handful of tries interrupting the > while loop: > > 2022-08-03 10:39:50.129 CDT client backend[5530] [unknown] PANIC: could not open critical system index 2662 ... > So far, I haven't succeeded in eliciting anything useful from valgrind. Now, I've reproduced the problem under valgrind, but it doesn't show anything useful: pryzbyj@pryzbyj:~$ while :; do psql -h /tmp template1 -c "DROP DATABASE a" -c "CREATE DATABASE a TEMPLATE postgres STRATEGY wal_log"; done ERROR: database "a" does not exist CREATE DATABASE ^CCancel request sent ERROR: canceling statement due to user request ERROR: database "a" already exists ^C pryzbyj@pryzbyj:~$ ^C pryzbyj@pryzbyj:~$ ^C pryzbyj@pryzbyj:~$ ^C pryzbyj@pryzbyj:~$ psql -h /tmp a -c '' 2022-08-03 11:57:39.178 CDT client backend[31321] [unknown] PANIC: could not open critical system index 2662 psql: error: falló la conexión al servidor en el socket «/tmp/.s.PGSQL.5432»: PANIC: could not open critical system index 2662 On the server process, nothing interesting but the backtrace (the error was before this, while writing the relation file, but there's nothing suspicious). 2022-08-03 11:08:06.628 CDT client backend[2841] [unknown] PANIC: could not open critical system index 2662 ==2841== ==2841== Process terminating with default action of signal 6 (SIGABRT) ==2841== at 0x5FBBE97: raise (raise.c:51) ==2841== by 0x5FBD800: abort (abort.c:79) ==2841== by 0x2118DEF: errfinish (elog.c:675) ==2841== by 0x20F6002: load_critical_index (relcache.c:4328) ==2841== by 0x20F727A: RelationCacheInitializePhase3 (relcache.c:4103) ==2841== by 0x213DFA5: InitPostgres (postinit.c:1087) ==2841== by 0x1D20D72: PostgresMain (postgres.c:4081) ==2841== by 0x1B15CFD: BackendRun (postmaster.c:4490) ==2841== by 0x1B1D6E1: BackendStartup (postmaster.c:4218) ==2841== by 0x1B1DD59: ServerLoop (postmaster.c:1808) ==2841== by 0x1B1F86D: PostmasterMain (postmaster.c:1480) ==2841== by 0x17B7150: main (main.c:197) Below, I reproduced it without valgrind (and without LANG): pryzbyj@pryzbyj:~/src/postgres$ while :; do psql -qh /tmp template1 -c "DROP DATABASE a" -c "CREATE DATABASE a TEMPLATE postgres STRATEGY wal_log"; done 2022-08-03 11:59:52.675 CDT checkpointer[1881] LOG: checkpoint starting: immediate force wait 2022-08-03 11:59:52.862 CDT checkpointer[1881] LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.045 s, sync=0.038 s, total=0.188 s; sync files=3, longest=0.019 s, average=0.013 s; distance=3 kB, estimate=3 kB; lsn=0/24862508, redo lsn=0/248624D0 2022-08-03 11:59:53.213 CDT checkpointer[1881] LOG: checkpoint starting: immediate force wait 2022-08-03 11:59:53.409 CDT checkpointer[1881] LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.030 s, sync=0.054 s, total=0.196 s; sync files=4, longest=0.029 s, average=0.014 s; distance=4042 kB, estimate=4042 kB; lsn=0/24C54D88, redo lsn=0/24C54D50 ^CCancel request sent 2022-08-03 11:59:53.750 CDT checkpointer[1881] LOG: checkpoint starting: immediate force wait 2022-08-03 11:59:53.930 CDT checkpointer[1881] LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.029 s, sync=0.027 s, total=0.181 s; sync files=4, longest=0.022 s, average=0.007 s; distance=4042 kB, estimate=4042 kB; lsn=0/250476D0, redo lsn=0/25047698 2022-08-03 11:59:54.270 CDT checkpointer[1881] LOG: checkpoint starting: immediate force wait ^C2022-08-03 11:59:54.294 CDT client backend[1903] psql ERROR: canceling statement due to user request 2022-08-03 11:59:54.294 CDT client backend[1903] psql STATEMENT: DROP DATABASE a Cancel request sent ERROR: canceling statement due to user request 2022-08-03 11:59:54.296 CDT client backend[1903] psql ERROR: database "a" already exists 2022-08-03 11:59:54.296 CDT client backend[1903] psql STATEMENT: CREATE DATABASE a TEMPLATE postgres STRATEGY wal_log ERROR: database "a" already exists ^C pryzbyj@pryzbyj:~/src/postgres$ ^C pryzbyj@pryzbyj:~/src/postgres$ ^C pryzbyj@pryzbyj:~/src/postgres$ 2022-08-03 11:59:54.427 CDT checkpointer[1881] LOG: checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.024 s, sync=0.036 s, total=0.158 s; sync files=4, longest=0.027 s, average=0.009 s; distance=4042 kB, estimate=4042 kB; lsn=0/2543A108, redo lsn=0/2543A0A8 ^C pryzbyj@pryzbyj:~/src/postgres$ ^C pryzbyj@pryzbyj:~/src/postgres$ ^C pryzbyj@pryzbyj:~/src/postgres$ psql -h /tmp a -c '' 2022-08-03 11:59:56.617 CDT client backend[1914] [unknown] PANIC: could not open critical system index 2662