BUG #12128: Cannot start backup again if it shutdown after replay one *.history file.

From: eshkinkot(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12128: Cannot start backup again if it shutdown after replay one *.history file.
Date: 2014-12-02 13:17:02
Message-ID: 20141202131702.2554.48300@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12128
Logged by: Sergey Burladyan
Email address: eshkinkot(at)gmail(dot)com
PostgreSQL version: 9.2.9
Operating system: Slackware 14.1
Description:

I try to start new slave but was wrong with archive and new slave restore
only one history file,
without any WALs. So I stop new slave, fix problem and start it again, but
it cannot start now.

I do something like this (use archive without streaming):
1. create master
2. create slave
3. kill master, promote slave and wait 00000002.history in archive
4. create new slave from new master
5. backup from new slave
6. start from backup, replay only one history file
(I do this trick for restore only *.history file for reproduce the error)
=== recovery.conf ===
restore_command = 'if [[ %f = *.history ]]; then cp ~/tmp/w/%f %p; else
false; fi'
recovery_target_timeline = 'latest'
standby_mode = on

$ /usr/lib64/postgresql/9.2/bin/postgres -D b -p 5430
LOG: database system was interrupted while in recovery at log time
2014-12-02 15:32:14 MSK
HINT: If this has occurred more than once some data might be corrupted and
you might need to choose an earlier recovery target.
LOG: creating missing WAL directory "pg_xlog/archive_status"
cp: cannot stat ‘/home/sergey/tmp/w/00000003.history’: No such file or
directory
LOG: restored log file "00000002.history" from archive
LOG: entering standby mode
cp: cannot stat ‘/home/sergey/tmp/w/00000003.history’: No such file or
directory
cp: cannot stat ‘/home/sergey/tmp/w/00000003.history’: No such file or
directory
^CLOG: received fast shutdown request
LOG: shutting down
LOG: database system is shut down

7. shutdown it and allow restore WALs, but now slave from backup cannot
start again
=== recovery.conf ===
restore_command = 'cp ~/tmp/w/%f %p'
recovery_target_timeline = 'latest'
standby_mode = on

LOG: database system was shut down in recovery at 2014-12-02 15:54:34 MSK
cp: cannot stat ‘/home/sergey/tmp/w/00000003.history’: No such file or
directory
LOG: restored log file "00000002.history" from archive
LOG: entering standby mode
LOG: restored log file "00000002000000000000000B" from archive
FATAL: backup_label contains data inconsistent with control file
HINT: This means that the backup is corrupted and you will have to use
another backup for recovery.
LOG: startup process (PID 10821) exited with exit code 1
LOG: aborting startup due to startup process failure

$ diff -urN <(pg_controldata b_org/) <(pg_controldata b/)
--- /dev/fd/63 2014-12-02 15:58:15.685046719 +0300
+++ /dev/fd/62 2014-12-02 15:58:15.686046721 +0300
@@ -1,8 +1,8 @@
pg_control version number: 922
Catalog version number: 201204301
Database system identifier: 6088213639255289694
-Database cluster state: in archive recovery
-pg_control last modified: Вт 02 дек 2014 15:32:25
+Database cluster state: shut down in recovery
+pg_control last modified: Вт 02 дек 2014 15:54:34
Latest checkpoint location: 0/B000058
Prior checkpoint location: 0/8000058
Latest checkpoint's REDO location: 0/B000020

so, looks like after database cluster state changed to "shut down in
recovery" it cannot start again
from backup.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-12-02 17:18:08 Re: BUG #12126: Empty tsvector as output of to_tsvector function
Previous Message s.beer 2014-12-02 10:59:44 BUG #12127: could not stat file