Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x6YAC-000IiP-2t for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 18:45:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x6YAB-00396S-2s for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 18:45:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x6YAB-00396J-1m for pgsql-hackers@lists.postgresql.org; Tue, 15 Sep 2026 18:45:51 +0000 Received: from toucan.tulip.relay.mailchannels.net ([23.83.218.254]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x6YA9-00000000EaC-28yM for pgsql-hackers@postgresql.org; Tue, 15 Sep 2026 18:45:50 +0000 X-Sender-Id: hostingeremail|x-authuser|david@pgbackrest.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 14EE07E3EB5; Tue, 15 Sep 2026 18:45:48 +0000 (UTC) Received: from fr-int-smtpout24.hostinger.io (100-98-23-230.trex-nlb.outbound.svc.cluster.local [100.98.23.230]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 9C7147E33E4; Tue, 15 Sep 2026 18:45:45 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|david@pgbackrest.org X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|david@pgbackrest.org X-MailChannels-Auth-Id: hostingeremail X-Bottle-Shelf: 1a0fb64903ebc782_1789497947899_2262167514 X-MC-Loop-Signature: 1789497947899:2906713082 X-MC-Ingress-Time: 1789497947898 Received: from fr-int-smtpout24.hostinger.io (fr-int-smtpout24.hostinger.io [148.222.54.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.23.230 (trex/8.0.2); Tue, 15 Sep 2026 18:45:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgbackrest.org; s=hostingermail1; t=1789497943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AhP8TSGbOoQjjOkgka7X9nexiBI+s1jX6lxg5FYvwfM=; b=Vx9Rz7L/6i7bEtR53LEGh8yfKFBmlhcCFqgX+OsNP/LYCuLxj+CfpsUygUzCyHg2l+tQZo p8crhInId+IB8dPscZ063CEucgQi6B4gS3sbrfDWB8socpl1hqwpmOn1gdZTPw9b3FmsS+ CCgAFukZLWJHC6fiFncrUBDI5L1dtMmTBiCKqoJQP/56YmTv9Dn3oBLi6EPgea73pRacv9 YrjBB6eHeAgecKIsNrm2O05YS3JBIF6hJQDDdQB9hXiH9pVvixZe2o1BgTXC7AJU2nSldr WLeqTcW81a2EurlkgGCohpJe0hEJPFA5FhKD/Y/q8Lj5XgNikIka5Utq6kg/Hg== Received: from [10.3.0.2] (unknown [89.187.177.227]) (Authenticated sender: david@pgbackrest.org) by smtp.hostinger.com (smtp.hostinger.com) with ESMTPSA id 4hkrYt5TgWz1xts; Tue, 15 Sep 2026 18:45:38 +0000 (UTC) Message-ID: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Return pg_control from pg_backup_stop(). To: Andrey Borodin Cc: shihao zhong , Andy Pogrebnoi , Michael Paquier , Haibo Yan , Pg Hackers , Heikki Linnakangas , Robert Haas , Andres Freund , Fujii Masao , Shaun Thomas References: <8b8aa673-fcef-4e14-a05d-0885283ef1b8@pgbackrest.org> <17DC1346-0CDE-4E39-B110-3D6FB0797AC6@gmail.com> <7F7B289B-F94F-42C2-9E54-6A689C0D64BB@gmail.com> <1800c83c-264a-4183-9da5-ac78e25849a8@pgbackrest.org> <3b23e3b7-53d2-4784-b482-05cca3327acb@pgbackrest.org> Content-Language: en-US From: David Steele In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 15 Sep 2026 18:45:38 +0000 (UTC) X-CM-Analysis: v=2.4 cv=GMJaEfNK c=1 sm=1 tr=0 ts=6aa99257 a=sYnX046BQ/XLQ/Sf8OcsiQ==:117 a=sYnX046BQ/XLQ/Sf8OcsiQ==:17 a=IkcTkHD0fZMA:10 a=4lnrsqmv5kKsja2ySUkA:9 a=QEXdDO2ut3YA:10 X-CM-Envelope: MS4xfJjMJagbSgZKCqZ7hGPmAafZYxmeQjtNqVxi0dX9USjzXB472mf4j/MD7vdFM1Z2GgS123FySyEq0+JibRiYQL8+VqDhsvx8cC0h21LVxoY+7sKD3pKB 7UMWfze6StlTfOlOnQBwtZW+8FSdvC0+Zod/R2xU//zv48Tl5zCSYYgS/p7uqE+Nd/FkAfm2KLCMWbEZ6RnOdJ9sBxNHoB2Ie/V+qdxkEbydAyC62WtWZdFa FlQR1Y2xRgLQGwpGd1jaDLsBsapZL8bje8aEtRrQNhMDeBoiM56LPZ8YfzU/XKxvsZig2zMQX5TZYEKW9R9lK1c21y5p64cJYOMD2bUcmsBJNnZvlpam2lEQ OMaJlh8eI7CZYPW2wMITzL4nAU/3Ejl1f7QDsnC2LIbvSiyMvNzkV8NZS9EmDH7MVh3z1oRDpwEX5aDS0PJel6M3h1CsVdyp9tzadrHP+hVyGWeJ40cNktym OLDjee877VbnVd9LbngW3kquVTjIpNLk/kPdvujh9iSidWX2hd7+4V8FDCU= X-AuthUser: david@pgbackrest.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Andrey, Thank you for having a look at the patch. On 9/15/26 21:13, Andrey Borodin wrote: > > On 15 Sep 2026, David Steele wrote: >> I left this as is from v11. I think it's a pretty normal thing to do. > > I found a case where the assertion itself does not hold: > >> +Assert(crc_ok && >> + memcmp(dataDisk, &controlData, sizeof(ControlFileData)) == 0); > > During XLOG_CHECKPOINT_ONLINE replay, xlog_redo() updates > ControlFile->checkPointCopy.nextXid under ControlFileLock without > calling UpdateControlFile(). The in-memory copy can therefore differ > from the on-disk file even while we hold the lock. > > I can trigger this with the v13 patch on current master: pause a > standby's base backup at basebackup-before-send-files, allocate an XID > on the primary, run CHECKPOINT and wait for replay. Resuming the backup > hits this assertion in backup_control_file(). > > IIUC, this mismatch does not mean that pg_control is torn. Perhaps we > could drop the whole-struct equality assertion? The mismatch is not an issue as far as I can see. I'll leave that determination up to Michael, though, since he added the assert. > On the motivation, we have had many WAL-G support requests from users > who removed backup_label to get a restored cluster to start. Here is > one example [0], and a pgBackRest case prompted by the startup hint [1]. > I think protecting against this mistake is worthwhile. I've seen this now more times than I can count, even from people that I would expect to know better. The hint from Postgres to delete backup_label certainly does not help the situation, though even with this patch we can't remove it completely. I'm hoping to at least deal with the common case. > One concern about describing pg_resetwal as "the only way to clear it > otherwise", even with the corruption warning: a WAL-G user actually > removed backup_label and ran pg_resetwal, thinking this only meant > giving up PITR [2]. Could we frame this as bypassing the protection, > not as a way to clear the flag? It cannot replace the WAL replay needed > to make a backup consistent. Yeah, I have also seen pg_resetwal abused in various ways. I added that language based on feedback from Shihao and I think it should be documented but perhaps we need more cautionary language there. Let's see what people think. Regards, -David