Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2C3u-0004h1-F9 for pgsql-admin@arkaria.postgresql.org; Fri, 08 Mar 2019 09:45:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2C3s-0005Vz-0x for pgsql-admin@arkaria.postgresql.org; Fri, 08 Mar 2019 09:45:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2C3r-0005SB-NC for pgsql-admin@lists.postgresql.org; Fri, 08 Mar 2019 09:45:03 +0000 Received: from smtpout.aon.at ([195.3.96.117]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2C3o-0002g3-Fe for pgsql-admin@lists.postgresql.org; Fri, 08 Mar 2019 09:45:03 +0000 Received: (qmail 29425 invoked from network); 8 Mar 2019 09:44:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on WARSBL508.highway.telekom.at X-Spam-Level: Received: from 100-71-10-150.rfc6598.a1.net (HELO localhost.localdomain) ([100.71.10.150]) (envelope-sender ) by smarthub84.res.a1.net (qmail-ldap-1.03) with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Mar 2019 09:44:56 -0000 X-A1Mail-Track-Id: 1552038296:29376:smarthub84:100.71.10.150:1 Message-ID: Subject: Re: Backup restore question "could not locate required checkpoint record" From: Laurenz Albe To: A Farkas , pgsql-admin@lists.postgresql.org In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 08 Mar 2019 10:44:49 +0100 User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk A Farkas wrote: > On a new apt-get install of postgresql 11, I performed the following: > backup (pg_start_backup ('b1'), rsync, pg_stop_backup) > CREATE DATABASE > CREATE TABLE > INSERT INTO TABLE > DROP TABLE > backup (pg_start_backup ('b1'), rsync, pg_stop_backup) > > The point is to restore point in time, before DROP. > From the logs: > 2019-03-08 10:02:17 EET,6/8,0,LOG,00000,"statement: DROP table test;",,,,,,,,,"pgAdmin 4 - CONN:821988" > > So I write recovery.conf: > restore_command='cp /pg-data/xlog/%f %p' > recovery_target_time='2019-03-08 10:02:17 EET' > recovery_target_inclusive='false' > recovery_target_timeline=1 > > Server says: > postgres@postgre01-Virtual-Machine:/pg-data/pglogs$ cat postgresql-2019-03-08_103727..csv > cat: postgresql-2019-03-08_103727..csv: No such file or directory > postgres@postgre01-Virtual-Machine:/pg-data/pglogs$ cat postgresql-2019-03-08_103727.csv > 2019-03-08 10:37:27.263 EET,,,39151,,5c8229c6.98ef,1,,2019-03-08 10:37:26 EET,,0,LOG,00000,"ending log output to stderr",,"Future log output will go to log destination ""csvlog"".",,,,,,,"" > 2019-03-08 10:37:27.349 EET,,,39153,,5c8229c7.98f1,1,,2019-03-08 10:37:27 EET,,0,LOG,00000,"database system was interrupted while in recovery at log time 2019-03-08 10:29:57 EET",,"If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target.",,,,,,,"" > 2019-03-08 10:37:27.856 EET,,,39153,,5c8229c7.98f1,2,,2019-03-08 10:37:27 EET,,0,LOG,00000,"starting archive recovery",,,,,,,,,"" > 2019-03-08 10:37:27.858 EET,,,39153,,5c8229c7.98f1,3,,2019-03-08 10:37:27 EET,,0,LOG,00000,"invalid checkpoint record",,,,,,,,,"" > 2019-03-08 10:37:27.858 EET,,,39153,,5c8229c7.98f1,4,,2019-03-08 10:37:27 EET,,0,FATAL,XX000,"could not locate required checkpoint record",,"If you are not restoring from a backup, try removing the file ""/var/lib/postgresql/11/main/backup_label"".",,,,,,,"" > 2019-03-08 10:37:27.859 EET,,,39151,,5c8229c6.98ef,2,,2019-03-08 10:37:26 EET,,0,LOG,00000,"startup process (PID 39153) exited with exit code 1",,,,,,,,,"" > 2019-03-08 10:37:27.859 EET,,,39151,,5c8229c6.98ef,3,,2019-03-08 10:37:26 EET,,0,LOG,00000,"aborting startup due to startup process failure",,,,,,,,,"" > 2019-03-08 10:37:27.861 EET,,,39151,,5c8229c6.98ef,4,,2019-03-08 10:37:26 EET,,0,LOG,00000,"database system is shut down",,,,,,,,,"" That means that either you didn't put "recovery.conf" in the data directory, or you got the name wrong. The message "starting archive recovery" is not issued if a "recovery_target_time" is set. In that case, the database would say "starting point-in-time recovery to ...". Since your "recovery.conf" is not read, PostgreSQL also has no "restore_command", and in its "pg_xlog" is cannot find the WAL segment that contains the checkpoint from the backup. That's why you get the error message. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com