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 1nO5Co-0001fu-0q for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Feb 2022 22:06:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nO5Cm-0002O2-Sy for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Feb 2022 22:06:20 +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 1nO5Cm-0002Nt-I2 for pgsql-hackers@lists.postgresql.org; Sat, 26 Feb 2022 22:06:20 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nO5Ck-00021x-1i for pgsql-hackers@lists.postgresql.org; Sat, 26 Feb 2022 22:06:19 +0000 Received: by mail-pg1-x536.google.com with SMTP id o8so8061863pgf.9 for ; Sat, 26 Feb 2022 14:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sh1MxW2hsD4Q142sMcuR/dk239gbTaq9Xo/KnlkyUSI=; b=YvBNtXvOL2iZ/nRrb8stqtbiLUGs4Xi3fxE4Aqh/qgK4jfxKSTEG3gDy3GrWoIYZhQ /oR+IbsTIcgjSYDX2Phac23SX/gPG8Z7vq4Po26pCDfI1Fy6L0rM1pNEeoih4xKJHSDD YbNoyfvxciDhT5JTneAMBeRnWAaDw3NnMhnjx2zM2qpDuJTvAx3zDO8kELnSu6hnNVer rM/nzT0+RvbOKBxXR0xekYxKJggXkhIcwIQshUbyUbLbrEh888BKXKaE+4sxVph4Le4W 7e9R+IGSd8f4Vm0YEpsO0NfWu9K5jdyC4AU5LQYTKGC6kGd59VI2j9n2bm//RxR57uC2 zOwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sh1MxW2hsD4Q142sMcuR/dk239gbTaq9Xo/KnlkyUSI=; b=jtbsdZhAFNVAIFFWAEKpp0MmeumJw4Uq4cePDOvFjVDjAtOAfnVXB2qfJ97BpBNAwJ jY+WBCi/Ovsmm8aSo1NBNN4+cETznawe6XbJDFVvalcMIjTPtobQ3TicT/g3Do/3Nehn cBNfwcTgegZz54DAss+z2FQaC5CMQgr7kUHnGA8Usla/exB1gQVqC1KKumvTfOkN4Pmv 6mkkd85dBy6ItDoguNSBvHQkrsIA96hpU+9hlq/NwHStuG/9S6dmh93sCI47BBha1lBE g5lKTqUeVW/gmceqvHSqWTaN8PIJLN16rkfPbZRDRvrqDSKnAi7s1s67F5NdsNEaF905 C/FA== X-Gm-Message-State: AOAM5333I1EU8TB/JcwJCYCeCnrDOlFxPsPBPBjHtN1kfle//+bPmPUQ pBQ1Vvbe2fioBu38+i3K/yk= X-Google-Smtp-Source: ABdhPJy6keu2JctgbYqjq8J+MDyFmXs1ypvVB1NnO33wZjKzhY0EvafH+gldx3enzODdd7HtbzNulg== X-Received: by 2002:a63:5c51:0:b0:373:c36b:2d0c with SMTP id n17-20020a635c51000000b00373c36b2d0cmr11645673pgm.209.1645913176813; Sat, 26 Feb 2022 14:06:16 -0800 (PST) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id w14-20020a63af0e000000b003732348b995sm6112548pge.12.2022.02.26.14.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 14:06:16 -0800 (PST) Date: Sat, 26 Feb 2022 14:06:14 -0800 From: Nathan Bossart To: Chapman Flack Cc: pgsql-hackers@lists.postgresql.org, David Steele Subject: Re: Postgres restart in the middle of exclusive backup and the presence of backup_label file Message-ID: <20220226220614.GA673898@nathanxps13> References: <20220221172306.GA3698472@nathanxps13> <164589413251.1035.2695761148079719188.pgcf@coridan.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164589413251.1035.2695761148079719188.pgcf@coridan.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Feb 26, 2022 at 04:48:52PM +0000, Chapman Flack wrote: > My biggest concerns are the changes to the SQL-visible pg_start_backup > and pg_stop_backup functions. When the non-exclusive API was implemented > (in 7117685), that was done with care (with a new optional argument to > pg_start_backup, and a new overload of pg_stop_backup) to avoid immediate > breakage of working backup scripts. > > With this patch, even scripts that were dutifully migrated to that new API and > now invoke pg_start_backup(label, false) or (label, exclusive => false) will > immediately and unnecessarily break. What I would suggest for this patch > would be to change the exclusive default from true to false, and have the > function report an ERROR if true is passed. > > Otherwise, for sites using a third-party backup solution, there will be an > unnecessary requirement to synchronize a PostgreSQL upgrade with an > upgrade of the backup solution that won't be broken by the change. For > a site with their backup procedures scripted in-house, there will be an > unnecessarily urgent need for the current admin team to study and patch > the currently-working scripts. > > That can be avoided by just changing the default to false and rejecting calls > where true is passed. That will break only scripts that never got the memo > about moving to non-exclusive backup, available for six years now. > > Assuming the value is false, so no error is thrown, is it practical to determine > from flinfo->fn_expr whether the value was defaulted or supplied? If so, I would > further suggest reporting a deprecation WARNING if it was explicitly supplied, > with a HINT that the argument can simply be removed at the call site, and will > become unrecognized in some future release. This is a good point. I think I agree with your proposed changes. I believe it is possible to add a deprecation warning only when 'exclusive' is specified. If anything, we can create a separate function that accepts the 'exclusive' parameter and that always emits a NOTICE or WARNING. > pg_stop_backup needs thought, because 7117685 added a new overload for that > function, rather than just an optional argument. This patch removes the old > niladic version that returned pg_lsn, leaving just one version, with an optional > argument, that returns a record. > > Here again, the old niladic one was only suitable for exclusive backups, so there > can't be any script existing in 2022 that still calls that unless it has never been > updated in six years to nonexclusive backups, and that breakage can't be > helped. > > Any scripts that did get dutifully updated over the last six years will be calling the > record-returning version, passing false, or exclusive => false. This patch as it > stands will unnecessarily break those, but here again I think that can be avoided > just by making the exclusive parameter optional with default false, and reporting > an error if true is passed. > > Here again, I would consider also issuing a deprecation warning if the argument > is explicitly supplied, if it is practical to determine that from fn_expr. (I haven't > looked yet to see how practical that is.) Agreed. I will look into updating this one, too. I think the 'exclusive' parameter should remain documented for now for both pg_start_backup() and pg_stop_backup(), but this documentation will just note that it is there for backward compatibility and must be set to false. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com