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 1jn8Z3-0001RD-Kv for pgsql-general@arkaria.postgresql.org; Sun, 21 Jun 2020 22:35:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jn8Z1-0006BN-Kk for pgsql-general@arkaria.postgresql.org; Sun, 21 Jun 2020 22:35:47 +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 1jn8Z1-00069D-At for pgsql-general@lists.postgresql.org; Sun, 21 Jun 2020 22:35:47 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jn8Yy-0000Ak-VY for pgsql-general@lists.postgresql.org; Sun, 21 Jun 2020 22:35:46 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id i4so2976084ooj.10 for ; Sun, 21 Jun 2020 15:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=f6H1Lb2VZKBBrSE7BqPSgocOyfeGKhTxBky1w63gz1g=; b=rtdn7CCfhIRGZhVKxHxey8C/cK5aXhKqESy1ozl4uXROJlXh+E2RXMGGffYsipA9UW UlceB0gwpfrx3HxlhBGGQygPOD8NeotVlpQfKo5Gyaf2/KgDfJYJNzxE8fTXPBS2MhEi QFD8wdFyVyMzzaB1ApwlQzjSRtbRMdGuUoH2Vl9e1IRDz2rYzv5Sbjk9s5xPZrB4PSNd eoYGjk5mrO04bGUIlt3/XK9ZAXtwy8z+mlgScFKHbbX4IAXIDgo0BtRFTVzGRjPknKt+ gUhWSBxBjJ0gPV6qFYt04sUwPeZmiWWTjSBbsktjavLRagtf3Tulz2uRFZDoTm+gDnC/ gokA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=f6H1Lb2VZKBBrSE7BqPSgocOyfeGKhTxBky1w63gz1g=; b=CXKxJIR5N8yKg8dPfn2sDFu+nmoZhz5LIp1t0nwg1SV0uAoIzNJVb2Defaj4rBWIn+ umMhLe7fWkLDhhwJgZRaUzHzsC6nYLiFlLYfy/vlhy38GAJ4tywMm3u7h+7i8S9fYLUO XFo4UlzwNYFY4isMUElMrA7LTLc5kamIKOOVHChNkAqXDA0EuwpZfs3rhyZQVaCylKpg 42R8k0WKJtNJ86vW1WP8rJd0tFdWw/SiFlFppKFJKyMmr3JEzeZtA3aXvb/In7ZmcknR 3rO37mdHwsVlRc79qohvTIKbAACamhnDEXHYk/7mZt7bsQYGEkncpiaK8kL2dmYuU6AG WAjA== X-Gm-Message-State: AOAM532b/jlTrDoL0HfLx3Gil6APESA6OpfAvBk7018FgSPVZxBgFtq6 53O3thEyvjRNjuC0qitFsB9r9T48XqojlQ== X-Google-Smtp-Source: ABdhPJzYGq4YhRDwOlIyAtK8Oosrkr5j2C1tUA7iiUTfNJIl8UvcdbNVy1yGCmsMQBDveT+BM90R0Q== X-Received: by 2002:a4a:d113:: with SMTP id k19mr11786553oor.37.1592778943614; Sun, 21 Jun 2020 15:35:43 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id k7sm2935688oon.29.2020.06.21.15.35.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jun 2020 15:35:42 -0700 (PDT) Subject: Re: The backup API and general purpose backup software To: pgsql-general@lists.postgresql.org References: <20200621132843.GB21591@hjp.at> <20200621154520.GC21591@hjp.at> From: Ron Message-ID: <2b29404d-1c74-35ec-1495-5f689611e5b5@gmail.com> Date: Sun, 21 Jun 2020 17:35:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200621154520.GC21591@hjp.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 >>> >>> 1. open a connection to the database >>> >>> 2. invoke pg_start_backup('label', false, false) in the connection from >>> step 1. >>> >>> 3. copy the contents of the data directory to the backup medium >>> >>> 4. invoke pg_stop_backup(false, true) in the connection from step 1. >>> >>> 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 previous step >> to the backup medium."  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: > > postgres=# select * from pg_stop_backup(false, true); > ╔═[ RECORD 1 ]═════════════════════════════════════════════════════════════════╗ > ║ lsn │ A9/2F000130 ║ > ║ labelfile │ START WAL LOCATION: A9/2F000028 (file 00000001000000A90000002F)↵║ > ║ │ CHECKPOINT LOCATION: A9/2F000060 ↵║ > ║ │ BACKUP METHOD: streamed ↵║ > ║ │ BACKUP FROM: master ↵║ > ║ │ START TIME: 2020-06-21 17:36:30 CEST ↵║ > ║ │ LABEL: backup # 1234 ↵║ > ║ │ START TIMELINE: 1 ↵║ > ║ │ ║ > ║ spcmapfile │ 17522 /home/postgres ↵║ > ║ │ ║ > ╚════════════╧═════════════════════════════════════════════════════════════════╝ > > Without this information the backup is useless, so it must be backed > up, too. Obviously you can do that only after you got it. Thanks.  A clearer instruction for step 4, I'd have said something like "invoke pg_stop_backup(false, true)in the connection from step 1, piping the output to a file on the backup medium." -- Angular momentum makes the world go 'round.