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 1pmoEj-00089T-KN for pgsql-general@arkaria.postgresql.org; Thu, 13 Apr 2023 04:07:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pmoEh-0005pf-7w for pgsql-general@arkaria.postgresql.org; Thu, 13 Apr 2023 04:07:03 +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 1pmoEg-0005pV-SC for pgsql-general@lists.postgresql.org; Thu, 13 Apr 2023 04:07:02 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pmoEZ-0000Fc-SE for pgsql-general@lists.postgresql.org; Thu, 13 Apr 2023 04:07:01 +0000 Message-ID: <2042b36e-264c-8d54-615b-b3c00c1a042e@cloud.gatewaynet.com> Date: Thu, 13 Apr 2023 07:06:50 +0300 MIME-Version: 1.0 Subject: Re: pg_basebackup / recovery Content-Language: en-US To: Michael Paquier Cc: pgsql-general@lists.postgresql.org References: <9f9aaa96-cd32-bbb9-ba15-d8685c9aeb08@cloud.gatewaynet.com> From: Achilleas Mantzios In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Στις 13/4/23 01:31, ο/η Michael Paquier έγραψε: > On Wed, Apr 12, 2023 at 01:45:56PM +0300, Achilleas Mantzios - cloud wrote: >> On 4/12/23 12:32, Fabrice Chapuis wrote: >>> During recovery process of a self contained backup, how postgres know to >>> stop reading wal when consistency is reached? >> Because it knows the full packup info. It will observe the >> >> STOP WAL LOCATION: 3BC7/4B000130 (file 0000000200003BC70000004B) >> >> inside the backup file > There is a bit more to that in the recovery logic, depending mostly > on the presence of backup_ label file in the data folder when recovery > begins. Once the backup_label is found at the beginning of recovery, > its information is stored in the control file and the file is renamed > to backup_label.old hence stopping the server when recovery has not > reached its expected point would rely on the control file contents > later on. Then, the startup process and its WAL redo makes sure that > WAL replays until it finds the WAL record marking the end of the > backup. Grepping for XLOG_BACKUP_END (WAL record type in this case) > shows all the areas that rely on that, and xlogrecovery.c covers the > most relevant bits. Thank you for the info! Sorry about my stupid typo "packup" :( > -- > Michael -- Achilleas Mantzios IT DEV - HEAD IT DEPT Dynacom Tankers Mgmt