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 1keg2s-0004dq-Mo for pgsql-general@arkaria.postgresql.org; Mon, 16 Nov 2020 15:03:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1keg2q-00026J-Pr for pgsql-general@arkaria.postgresql.org; Mon, 16 Nov 2020 15:03:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1keg2q-00026C-IJ for pgsql-general@lists.postgresql.org; Mon, 16 Nov 2020 15:03:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1keg2n-0007kT-Ir for pgsql-general@lists.postgresql.org; Mon, 16 Nov 2020 15:03:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0AGF3f6D756952; Mon, 16 Nov 2020 10:03:42 -0500 From: Tom Lane To: Dennis Jacobfeuerborn cc: pgsql-general@lists.postgresql.org Subject: Re: "invalid record length" after restoring pg_basebackup In-reply-to: <5a773ed9-9555-902e-f240-8720d64310ca@conversis.de> References: <285451.1605279777@sss.pgh.pa.us> <5a773ed9-9555-902e-f240-8720d64310ca@conversis.de> Comments: In-reply-to Dennis Jacobfeuerborn message dated "Mon, 16 Nov 2020 11:39:41 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <756950.1605539021.1@sss.pgh.pa.us> Date: Mon, 16 Nov 2020 10:03:41 -0500 Message-ID: <756951.1605539021@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dennis Jacobfeuerborn writes: > On 11/13/20 4:02 PM, Tom Lane wrote: >> This looks quite normal to me. If you'd pulled the power plug on the >> primary system at the time you made this backup, you would likely see >> the same message at the end of its crash recovery. Some sort of >> corrupt-WAL-entry report is expected at the end of WAL replay anytime >> you didn't have a clean shutdown. > But the system the backup was pulled from kept running fine. Also > wouldn't that make re-attaching the system to the primary impossible > since replication cannot be continued due to the broken WAL record? There is no "broken WAL record". There is only junk following the primary's current WAL write point. > What I would expect is that pg_basebackup only transfer healthy WAL > entries so that a restored system can pick up right after that with > streaming replication. You need to adjust your expectations. pg_basebackup doesn't parse the WAL data, because it has no need to. It just copies whole WAL segment files. regards, tom lane