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 1kebvr-0003yp-H1 for pgsql-general@arkaria.postgresql.org; Mon, 16 Nov 2020 10:40:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kebvK-0006Xh-E1 for pgsql-general@arkaria.postgresql.org; Mon, 16 Nov 2020 10:39:50 +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 1kebvK-0006Xa-64 for pgsql-general@lists.postgresql.org; Mon, 16 Nov 2020 10:39:50 +0000 Received: from mail3.conversis.de ([213.203.208.210]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kebvF-00019i-1H for pgsql-general@lists.postgresql.org; Mon, 16 Nov 2020 10:39:49 +0000 Received: from localhost.localdomain (ip-37-201-42-0.hsi13.unitymediagroup.de [37.201.42.0]) by mail4.conversis.de (Postfix) with ESMTPSA id 93855E1A97; Mon, 16 Nov 2020 11:39:41 +0100 (CET) Subject: Re: "invalid record length" after restoring pg_basebackup To: Tom Lane Cc: pgsql-general@lists.postgresql.org References: <285451.1605279777@sss.pgh.pa.us> From: Dennis Jacobfeuerborn Message-ID: <5a773ed9-9555-902e-f240-8720d64310ca@conversis.de> Date: Mon, 16 Nov 2020 11:39:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <285451.1605279777@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/13/20 4:02 PM, Tom Lane wrote: > Dennis Jacobfeuerborn writes: >> All of this works fine and the logs report that the db reaches a >> consistent recovery state but as last entry it reports an "invalid >> record length": > > 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? 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. Regards, Dennis