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 1jnKOV-0001Jm-Oj for pgsql-general@arkaria.postgresql.org; Mon, 22 Jun 2020 11:13:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jnKOU-0006ix-Nn for pgsql-general@arkaria.postgresql.org; Mon, 22 Jun 2020 11:13:42 +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 1jnKOU-0006fw-FZ for pgsql-general@lists.postgresql.org; Mon, 22 Jun 2020 11:13:42 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnKOO-0006dA-N2 for pgsql-general@lists.postgresql.org; Mon, 22 Jun 2020 11:13:41 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id DF21532DF; Mon, 22 Jun 2020 13:13:34 +0200 (CEST) Date: Mon, 22 Jun 2020 13:13:34 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: The backup API and general purpose backup software Message-ID: <20200622111334.GB5340@hjp.at> References: <20200621132843.GB21591@hjp.at> <20200621154520.GC21591@hjp.at> <2b29404d-1c74-35ec-1495-5f689611e5b5@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JYK4vJDZwFMowpUq" Content-Disposition: inline In-Reply-To: <2b29404d-1c74-35ec-1495-5f689611e5b5@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --JYK4vJDZwFMowpUq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-06-21 17:35:41 -0500, Ron wrote: > On 6/21/20 10:45 AM, Peter J. Holzer wrote: > > On 2020-06-21 10:32:16 -0500, Ron wrote: > > > On 6/21/20 8:28 AM, Peter J. Holzer wrote: > > > > To make a full backup with the "new" (non-exclusive) API, a software > > > > must do the following > > > >=20 > > > > 1. open a connection to the database > > > >=20 > > > > 2. invoke pg_start_backup('label', false, false) in the connection = =66rom > > > > step 1. > > > >=20 > > > > 3. copy the contents of the data directory to the backup medium > > > >=20 > > > > 4. invoke pg_stop_backup(false, true) in the connection from step 1. > > > >=20 > > > > 5. copy the result from the previous step to the backup medium. > > > I don't understand that last step "5. copy the result from the previo= us step > > > to the backup medium."=C2=A0 It seems to be a duplication of "3. copy= the > > > contents of the data directory to the backup medium". > > Step three copies all the files from the data directory. However, there > > is an additional piece of information you you need to recover the > > database, and that is only returned by the call to pg_stop_backup: > >=20 > > postgres=3D# select * from pg_stop_backup(false, true); > > =E2=95=94=E2=95=90[ RECORD 1 ]=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=97 [...] > > =E2=95=9A=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=A7=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=9D > >=20 > > Without this information the backup is useless, so it must be backed > > up, too. Obviously you can do that only after you got it. >=20 > Thanks.=C2=A0 A clearer instruction for step 4, I'd have said something l= ike > "invoke pg_stop_backup(false, true)in the connection from step 1, piping = the > output to a file on the backup medium." I could have phrased it that way but I wanted to set the stage for the second half of the posting, where I was contrasting that to the work flow of a typical general purpose backup program.=20 There "piping the output to a file on the backup medium" isn't possible because the backup is already finished. So it made sense for me to present invoking pg_stop_backup and writing the result of pg_stop_backup to the backup medium as two distinct steps. I think this also makes the solution much more natural (some might even say obvious) than if those had been presented as a single step. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --JYK4vJDZwFMowpUq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl7wkloACgkQ8g5IURL+ KF0yRw/+KzJFiSGd7NC3fGaA/r199W0RbiCNtCnKYvOwxu2UCAGqu0ZRyWcsfJs+ S5tVdHUR2cF+4UyBIdGBwYTpDlxQtktPqYonzgNTyhzXfzQlcekr2uvFBaozKLOV W5PrKe2/7wYNxjT3nemzx5Ny+zjJSRh09TiOymDv9hMdMrpd0ba57dQihniTjAVk NolhU69uk69KfKW8U9ui8Zg5jh4AgZCgzq8n+nmwOzpHHQ7aRu/9PTwsVbphbE3d aSg+HlY455NSc3XUdWaBMHrvHdTysuMLtM85/tR9cuqECBso0DQhbrgolYNo9UZN VWLQ3l1srphVhfoQBSREtL1EV5BfON1y0TUDdKNWNiD0eAc3hVo0xIKbuY0ImL+q /8nOGy4hokLIiy1kX3eFYX09gQ3p8ECGprHMDg+/QIVWMrxzn7IkbtEK6VxesEWM PSmDEGMQFK4kqDYpsPNc2VhYXYhLnfi9l+3UPp8ajTL38EHWDQkL4DqcBXIuqT7X ZRQm3vZyRfZH3FR9s1NHkbhnHwEYNt+AYMGCpuqIyNmsPblsyHs7AsSdpZ9K9DDy dLl699zdPCSuq6q2YpL3ri9f1DzX6OEutag/sELmcxTGC/i+Bo/NtamV5gr4dEgO wdrF7xKFSng6/PuhqvezethgnGWVwKv5V7x8w/eVdNT7qaKsQR0= =d6He -----END PGP SIGNATURE----- --JYK4vJDZwFMowpUq--