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 1oTc7a-0007Nf-2H for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 04:48:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTc7Y-000094-0c for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 04:48:04 +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 1oTc7X-00008u-ET for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 04:48:03 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oTc7P-0004Oh-P5 for pgsql-hackers@postgresql.org; Thu, 01 Sep 2022 04:48:02 +0000 Received: by mail-il1-x12b.google.com with SMTP id a9so6158217ilh.1 for ; Wed, 31 Aug 2022 21:47:55 -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-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date; bh=PpymosGKbsSj6lg8Z2H2h4V/dXpdQ7IUNbZZIDLyrNE=; b=ahGHGpkT2qES1zDvcx70FrSXO2ZhSXt39ZGQbgIXc9xiLO91p6bDB9yd8J31drWSNr oi2pCPu5no8W6P9FfNbzU1tm0mHfVC2mwloeny+M6UO9NmUVnOgzEatqKCo9kKoqH7ZN FK1k7gokZgYjpF4Ffcm6EsJ9jUT7tpCP2vGujO5ZOeykBPtl2iVWuCWnJwfA4fOyYCut IQq+opKsIjn4qNMj5OP59HF98QsFm+uq1y/k3cy7zxdeqDDvwALwXTv7Es+lTidm6c6e XLjzeNStYfiwHnd4Dd92OsabTJWem/gwEEfbhofxleFicpfUwVJeyGeXIWZgV8AtkVN3 pMaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=PpymosGKbsSj6lg8Z2H2h4V/dXpdQ7IUNbZZIDLyrNE=; b=1U6gIlYzJ6qmCIKio8nMYhzrtSQHpLC/0MhP8hx41oZeWgaScXiebR2GQjOQZoDmcp DRaKZYobv69Jt66G6O73Eh6/dxe/L6X2gXV11bA0DZNpAUvT53PRkJgi0XRafzZWc2kv BtbFoTfM62gAzxehw/3rEQHdsm/4wlmMmYtxJiwd+U3ggc2iMNSGDydklU/DBwtOVFBy z1joL3wSSKzxebFYLQqfvwGaD+3UeGRMO23DHLSug/7hd0+zHKbwvStYHRJDaUFTJHr5 MtiN7dzfU82PdiYXsJvJy/rjigTJTT8mG2qvFKE9jZi9+S3qqRYVKrByntrAnjdPtbEK jyMw== X-Gm-Message-State: ACgBeo1P22SDHZkc9FuzDUp5M3xxbSGS40OAfRX2EaDpqJhewYHSm7aq IxgyTAXkbWU692e/YiSnGt+oIw== X-Google-Smtp-Source: AA6agR6DaAlp0g7cZQKzSuR7RlUhyD9qBUzfEI1+HmNe4TgH1F7SjWZiTIiBT/vxwhNgGYue043Pgw== X-Received: by 2002:a05:6e02:667:b0:2e6:9b52:3426 with SMTP id l7-20020a056e02066700b002e69b523426mr16059573ilt.318.1662007674771; Wed, 31 Aug 2022 21:47:54 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id c20-20020a023f54000000b00349deda465asm7455215jaf.39.2022.08.31.21.47.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2022 21:47:54 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 34C8A801058; Wed, 31 Aug 2022 23:47:53 -0500 (CDT) Date: Wed, 31 Aug 2022 23:47:53 -0500 From: Justin Pryzby To: Thomas Munro Cc: Kyotaro Horiguchi , "Shinoda, Noriyoshi (PN Japan FSIP)" , Tomas Vondra , Stephen Frost , Andres Freund , Jakub Wartak , Alvaro Herrera , Tomas Vondra , Dmitry Dolgov <9erthalion6@gmail.com>, David Steele , pgsql-hackers Subject: Re: pg15b3: recovery fails with wal prefetch enabled Message-ID: <20220901044753.GG31833@telsasoft.com> References: <20220831140128.GS31833@telsasoft.com> <20220901.120804.504461198570722498.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Sep 01, 2022 at 04:22:20PM +1200, Thomas Munro wrote: > On Thu, Sep 1, 2022 at 3:08 PM Kyotaro Horiguchi > wrote: > > At Thu, 1 Sep 2022 12:05:36 +1200, Thomas Munro wrote in > > > On Thu, Sep 1, 2022 at 2:01 AM Justin Pryzby wrote: > > > > < 2022-08-31 08:44:10.495 CDT >LOG: checkpoint starting: end-of-recovery immediate wait > > > > < 2022-08-31 08:44:10.609 CDT >LOG: request to flush past end of generated WAL; request 1201/1CAF84F0, current position 1201/1CADB730 > > > > < 2022-08-31 08:44:10.609 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm > > > > < 2022-08-31 08:44:10.609 CDT >ERROR: xlog flush request 1201/1CAF84F0 is not satisfied --- flushed only to 1201/1CADB730 > > > > < 2022-08-31 08:44:10.609 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm > > > > < 2022-08-31 08:44:10.609 CDT >FATAL: checkpoint request failed > > > > > > > > I was able to start it with -c recovery_prefetch=no, so it seems like > > > > prefetch tried to do too much. The VM runs centos7 under qemu. > > > > I'm making a copy of the data dir in cases it's needed. > > > > Just for information, there was a fixed bug about > > overwrite-aborted-contrecord feature, which causes this kind of > > failure (xlog flush request exceeds insertion bleeding edge). If it is > > that, it has been fixed by 6672d79139 two-days ago. > > Hmm. Justin, when you built from source, which commit were you at? > If it's REL_15_BETA3, No - it's: commit a2039b1f8e90d26a7e2a115ad5784476bd6deaa2 (HEAD -> REL_15_STABLE, origin/REL_15_STABLE) > If it's REL_15_BETA3, any chance you could cherry pick that change and > check what happens? And without that, could you show what this logs > And without that, could you show what this logs > for good and bad recovery settings? I wasn't sure what mean by "without that" , so here's a bunch of logs to sift through: At a203, with #define XLOGPREFETCHER_DEBUG_LEVEL NOTICE: [pryzbyj@template0 postgresql]$ sudo -u postgres ./tmp_install/usr/local/pgsql/bin/postgres -D /mnt/tmp/15/data -c logging_collector=no -c port=5678 ... < 2022-08-31 23:31:38.690 CDT >LOG: redo starts at 1201/1B931F50 < 2022-08-31 23:31:40.204 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958212 from block 156 until 1201/1C3965A0 is replayed, which truncates the relation < 2022-08-31 23:31:40.307 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C39CC98 is replayed, which truncates the relation < 2022-08-31 23:31:40.493 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C8643C8 is replayed, because the relation is too small < 2022-08-31 23:31:40.721 CDT >LOG: redo done at 1201/1CADB300 system usage: CPU: user: 0.41 s, system: 0.23 s, elapsed: 2.03 s < 2022-08-31 23:31:41.452 CDT >LOG: checkpoint starting: end-of-recovery immediate wait < 2022-08-31 23:31:41.698 CDT >LOG: request to flush past end of generated WAL; request 1201/1CAF84F0, current position 1201/1CADB730 < 2022-08-31 23:31:41.698 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:31:41.698 CDT >ERROR: xlog flush request 1201/1CAF84F0 is not satisfied --- flushed only to 1201/1CADB730 < 2022-08-31 23:31:41.698 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:31:41.699 CDT >FATAL: checkpoint request failed < 2022-08-31 23:31:41.699 CDT >HINT: Consult recent messages in the server log for details. < 2022-08-31 23:31:41.704 CDT >LOG: startup process (PID 25046) exited with exit code 1 < 2022-08-31 23:31:41.704 CDT >LOG: terminating any other active server processes < 2022-08-31 23:31:41.705 CDT >LOG: shutting down due to startup process failure < 2022-08-31 23:31:41.731 CDT >LOG: database system is shut down With your patch: [pryzbyj@template0 postgresql]$ sudo -u postgres ./tmp_install/usr/local/pgsql/bin/postgres -D /mnt/tmp/15/data -c logging_collector=no -c port=5678 ... < 2022-08-31 23:34:22.897 CDT >LOG: redo starts at 1201/1B931F50 < 2022-08-31 23:34:23.146 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958212 from block 156 until 1201/1C3965A0 is replayed, which truncates the relation < 2022-08-31 23:34:23.147 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C39CC98 is replayed, which truncates the relation < 2022-08-31 23:34:23.268 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C8643C8 is replayed, because the relation is too small < 2022-08-31 23:34:23.323 CDT >LOG: redo done at 1201/1CADB300 system usage: CPU: user: 0.29 s, system: 0.12 s, elapsed: 0.42 s < 2022-08-31 23:34:23.323 CDT >LOG: point 0: lastRec = 12011cadb300 < 2022-08-31 23:34:23.323 CDT >LOG: point 0: endOfLog = 12011cadb730 < 2022-08-31 23:34:23.323 CDT >LOG: XXX point 1: EndOfLog = 12011cadb730 < 2022-08-31 23:34:23.386 CDT >LOG: XXX point 2: EndOfLog = 12011cadb730 < 2022-08-31 23:34:23.387 CDT >LOG: XXX point 3: Insert->CurrBytePos = 11f39ab82310 < 2022-08-31 23:34:23.565 CDT >LOG: XXX point 4: Insert->CurrBytePos = 11f39ab82310 < 2022-08-31 23:34:23.606 CDT >LOG: checkpoint starting: end-of-recovery immediate wait < 2022-08-31 23:34:23.767 CDT >LOG: request to flush past end of generated WAL; request 1201/1CAF84F0, current position 1201/1CADB730 < 2022-08-31 23:34:23.767 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:34:23.767 CDT >ERROR: xlog flush request 1201/1CAF84F0 is not satisfied --- flushed only to 1201/1CADB730 < 2022-08-31 23:34:23.767 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:34:23.768 CDT >FATAL: checkpoint request failed And without prefetch: [pryzbyj@template0 postgresql]$ sudo -u postgres ./tmp_install/usr/local/pgsql/bin/postgres -D /mnt/tmp/15/data -c logging_collector=no -c port=5678 -c recovery_prefetch=no ... < 2022-08-31 23:37:08.792 CDT >LOG: redo starts at 1201/1B931F50 < 2022-08-31 23:37:09.269 CDT >LOG: invalid record length at 1201/1CD91010: wanted 24, got 0 < 2022-08-31 23:37:09.269 CDT >LOG: redo done at 1201/1CD90E48 system usage: CPU: user: 0.35 s, system: 0.11 s, elapsed: 0.47 s < 2022-08-31 23:37:09.269 CDT >LOG: point 0: lastRec = 12011cd90e48 < 2022-08-31 23:37:09.269 CDT >LOG: point 0: endOfLog = 12011cd91010 < 2022-08-31 23:37:09.269 CDT >LOG: XXX point 1: EndOfLog = 12011cd91010 < 2022-08-31 23:37:09.350 CDT >LOG: XXX point 2: EndOfLog = 12011cd91010 < 2022-08-31 23:37:09.350 CDT >LOG: XXX point 3: Insert->CurrBytePos = 11f39ae35b68 < 2022-08-31 23:37:09.420 CDT >LOG: XXX point 4: Insert->CurrBytePos = 11f39ae35b68 < 2022-08-31 23:37:09.552 CDT >LOG: checkpoint starting: end-of-recovery immediate wait < 2022-08-31 23:37:12.987 CDT >LOG: checkpoint complete: wrote 8030 buffers (49.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.403 s, sync=2.841 s, total=3.566 s; sync files=102, longest=2.808 s, average=0.028 s; distance=20860 kB, estimate=20860 kB < 2022-08-31 23:37:13.077 CDT >LOG: database system is ready to accept connections If I revert 6672d79139 (and roll back to the unrecovered state): [pryzbyj@template0 postgresql]$ sudo -u postgres ./tmp_install/usr/local/pgsql/bin/postgres -D /mnt/tmp/15/data -c logging_collector=no -c port=5678 # -c recovery_prefetch=no ... < 2022-08-31 23:42:40.592 CDT >LOG: redo starts at 1201/1B931F50 < 2022-08-31 23:42:42.168 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958212 from block 156 until 1201/1C3965A0 is replayed, which truncates the relation < 2022-08-31 23:42:42.238 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C39CC98 is replayed, which truncates the relation < 2022-08-31 23:42:42.405 CDT >NOTICE: suppressing prefetch in relation 1663/16888/165958523 from block 23 until 1201/1C8643C8 is replayed, because the relation is too small < 2022-08-31 23:42:42.602 CDT >LOG: redo done at 1201/1CADB300 system usage: CPU: user: 0.41 s, system: 0.25 s, elapsed: 2.01 s < 2022-08-31 23:42:42.602 CDT >LOG: point 0: lastRec = 12011cadb300 < 2022-08-31 23:42:42.602 CDT >LOG: point 0: endOfLog = 12011cadb730 < 2022-08-31 23:42:42.602 CDT >LOG: XXX point 1: EndOfLog = 12011cadb730 < 2022-08-31 23:42:42.830 CDT >LOG: XXX point 2: EndOfLog = 12011cadb730 < 2022-08-31 23:42:42.830 CDT >LOG: XXX point 3: Insert->CurrBytePos = 11f39ab82310 < 2022-08-31 23:42:43.194 CDT >LOG: XXX point 4: Insert->CurrBytePos = 11f39ab82310 < 2022-08-31 23:42:43.266 CDT >LOG: checkpoint starting: end-of-recovery immediate wait < 2022-08-31 23:42:43.425 CDT >LOG: request to flush past end of generated WAL; request 1201/1CAF84F0, current position 1201/1CADB730 < 2022-08-31 23:42:43.425 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:42:43.425 CDT >ERROR: xlog flush request 1201/1CAF84F0 is not satisfied --- flushed only to 1201/1CADB730 < 2022-08-31 23:42:43.425 CDT >CONTEXT: writing block 0 of relation base/16881/2840_vm < 2022-08-31 23:42:43.425 CDT >FATAL: checkpoint request failed < 2022-08-31 23:42:43.425 CDT >HINT: Consult recent messages in the server log for details. < 2022-08-31 23:42:43.431 CDT >LOG: startup process (PID 2415) exited with exit code 1 < 2022-08-31 23:42:43.431 CDT >LOG: terminating any other active server processes < 2022-08-31 23:42:43.432 CDT >LOG: shutting down due to startup process failure < 2022-08-31 23:42:43.451 CDT >LOG: database system is shut down If I revert 6672d79139 and disable prefetch: [pryzbyj@template0 postgresql]$ sudo -u postgres ./tmp_install/usr/local/pgsql/bin/postgres -D /mnt/tmp/15/data -c logging_collector=no -c port=5678 -c recovery_prefetch=no ... < 2022-08-31 23:43:25.711 CDT >LOG: redo starts at 1201/1B931F50 < 2022-08-31 23:43:26.178 CDT >LOG: invalid record length at 1201/1CD91010: wanted 24, got 0 < 2022-08-31 23:43:26.178 CDT >LOG: redo done at 1201/1CD90E48 system usage: CPU: user: 0.33 s, system: 0.11 s, elapsed: 0.46 s < 2022-08-31 23:43:26.178 CDT >LOG: point 0: lastRec = 12011cd90e48 < 2022-08-31 23:43:26.178 CDT >LOG: point 0: endOfLog = 12011cd91010 < 2022-08-31 23:43:26.178 CDT >LOG: XXX point 1: EndOfLog = 12011cd91010 < 2022-08-31 23:43:26.369 CDT >LOG: XXX point 2: EndOfLog = 12011cd91010 < 2022-08-31 23:43:26.369 CDT >LOG: XXX point 3: Insert->CurrBytePos = 11f39ae35b68 < 2022-08-31 23:43:26.433 CDT >LOG: XXX point 4: Insert->CurrBytePos = 11f39ae35b68 < 2022-08-31 23:43:26.490 CDT >LOG: checkpoint starting: end-of-recovery immediate wait < 2022-08-31 23:43:29.519 CDT >LOG: checkpoint complete: wrote 8030 buffers (49.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.380 s, sync=2.492 s, total=3.086 s; sync files=102, longest=2.438 s, average=0.025 s; distance=20860 kB, estimate=20860 kB < 2022-08-31 23:43:29.567 CDT >LOG: database system is ready to accept connections