Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 100251337B2F for ; Wed, 13 Apr 2011 04:49:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 67179-01 for ; Wed, 13 Apr 2011 07:49:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from depesz.com (andy.depesz.com [88.198.47.100]) by mail.postgresql.org (Postfix) with ESMTP id 6A9AD13364DE for ; Wed, 13 Apr 2011 04:49:26 -0300 (ADT) Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.75) (envelope-from ) id 1Q9upI-0005L4-B4 for pgsql-bugs@postgresql.org; Wed, 13 Apr 2011 09:49:24 +0200 Date: Wed, 13 Apr 2011 09:49:24 +0200 From: hubert depesz lubaczewski To: pgsql-bugs@postgresql.org Subject: 9.1 doesn't start when died mid-backup Message-ID: <20110413074924.GA11318@depesz.com> Reply-To: depesz@depesz.com MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/68 X-Sequence-Number: 29987 hi got new 9.1, straight from git. compiled, installed. did initdb, and then set config values using this script: perl -pi -e ' s/\A \s* (?: [#] \s* )? listen_addresses \s* = \s*.*/listen_addresses = \047*\047/x; s/\A \s* (?: [#] \s* )? log_destination \s* = \s*.*/log_destination = \047stderr\047/x; s/\A \s* (?: [#] \s* )? logging_collector \s* = \s*.*/logging_collector = on/x; s/\A \s* (?: [#] \s* )? log_min_duration_statement \s* = \s*.*/log_min_duration_statement = 0/x; s/\A \s* (?: [#] \s* )? log_line_prefix \s* = \s*.*/log_line_prefix = \047\%m \%u\@\%d \%p \%r \047/x; s/\A \s* (?: [#] \s* )? log_temp_files \s* = \s*.*/log_temp_files = 0/x; s/\A \s* (?: [#] \s* )? (log_checkpoints|log_connections|log_disconnections|log_lock_waits) \s* = \s*.*/$1 = on/x; s/\A \s* (?: [#] \s* )? wal_level \s* = \s*.*/wal_level = hot_standby/x; s/\A \s* (?: [#] \s* )? archive_mode \s* = \s*.*/archive_mode = on/x; s/\A \s* (?: [#] \s* )? archive_command \s* = \s*.*/archive_command = \047\/bin\/true\047/x; ' data/postgresql.conf afterwards I did start pg. then, i connected with psql, and issued: $ select pg_start_backup('xx'); pg_start_backup ----------------- 0/2000020 (1 row) $ create database pgdba; CREATE DATABASE $ create user postgres with superuser; CREATE ROLE $ create user depesz with superuser; CREATE ROLE $ create database depesz with owner depesz; CREATE DATABASE Afterwards, I exited psql, and simulated power-failure, with: =$ killall -9 postgres; killall -9 postmaster postmaster: no process found All pg processes were killed. When I then tried to start Pg, I got: =$ pg_ctl start pg_ctl: another server might be running; trying to start server anyway server starting but it didn't start. log looks like this: =$ cat postgresql-2011-04-13_093859.log 2011-04-13 09:38:59.807 CEST @ 3446 LOG: database system was interrupted; last known up at 2011-04-13 09:38:43 CEST 2011-04-13 09:38:59.807 CEST @ 3446 LOG: database system was not properly shut down; automatic recovery in progress 2011-04-13 09:38:59.852 CEST @ 3446 LOG: redo starts at 0/2000020 2011-04-13 09:39:00.304 CEST @ 3446 LOG: record with zero length at 0/20018E8 2011-04-13 09:39:00.304 CEST @ 3446 LOG: redo done at 0/2001898 2011-04-13 09:39:00.304 CEST @ 3446 LOG: last completed transaction was at log time 2011-04-13 09:38:43.563356+02 2011-04-13 09:39:00.304 CEST @ 3446 FATAL: WAL ends before end of online backup 2011-04-13 09:39:00.304 CEST @ 3446 HINT: Online backup started with pg_start_backup() must be ended with pg_stop_backup(), and all WAL up to that point must be available at recovery. 2011-04-13 09:39:00.304 CEST @ 3444 LOG: startup process (PID 3446) exited with exit code 1 2011-04-13 09:39:00.304 CEST @ 3444 LOG: aborting startup due to startup process failure interestingl7y backup_label got renamed to backup_label.old, and contains: START WAL LOCATION: 0/2000020 (file 000000010000000000000002) CHECKPOINT LOCATION: 0/2000058 START TIME: 2011-04-13 09:38:19 CEST LABEL: xx Given the file was renamed, I retried: =$ pg_ctl start server starting but again - it didn't work. Log looks like this: 2011-04-13 09:44:06.844 CEST @ 3783 LOG: database system was interrupted while in recovery at 2011-04-13 09:38:59 CEST 2011-04-13 09:44:06.844 CEST @ 3783 HINT: This probably means that some data is corrupted and you will have to use the last backup for recovery. 2011-04-13 09:44:06.845 CEST @ 3783 LOG: database system was not properly shut down; automatic recovery in progress 2011-04-13 09:44:06.877 CEST @ 3783 LOG: redo starts at 0/2000020 2011-04-13 09:44:07.316 CEST @ 3783 LOG: record with zero length at 0/20018E8 2011-04-13 09:44:07.316 CEST @ 3783 LOG: redo done at 0/2001898 2011-04-13 09:44:07.316 CEST @ 3783 LOG: last completed transaction was at log time 2011-04-13 09:38:43.563356+02 2011-04-13 09:44:07.316 CEST @ 3783 FATAL: WAL ends before end of online backup 2011-04-13 09:44:07.316 CEST @ 3783 HINT: Online backup started with pg_start_backup() must be ended with pg_stop_backup(), and all WAL up to that point must be available at recovery. 2011-04-13 09:44:07.316 CEST @ 3776 LOG: startup process (PID 3783) exited with exit code 1 2011-04-13 09:44:07.316 CEST @ 3776 LOG: aborting startup due to startup process failure So, it looks to me that by killing postgres mid-backup I made it end up in some state that doesn't let it start again. I *think* it might be related to this: http://archives.postgresql.org/pgsql-hackers/2011-03/msg01490.php and more specifically, with this: http://archives.postgresql.org/pgsql-hackers/2011-03/msg01627.php Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/