Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T6kfk-0006vA-7H for pgsql-bugs@postgresql.org; Wed, 29 Aug 2012 15:59:16 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T6kfe-00059V-GH for pgsql-bugs@postgresql.org; Wed, 29 Aug 2012 15:59:15 +0000 Received: from awork2.localnet (p5DDC4BB1.dip.t-dialin.net [93.220.75.177]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MZ7a0-1TL6em3Tzg-00Lco2; Wed, 29 Aug 2012 17:59:09 +0200 From: Andres Freund Organization: 2ndquadrant.com To: pgsql-bugs@postgresql.org Subject: Re: BUG #7500: hot-standby replica crash after an initial rsync Date: Wed, 29 Aug 2012 17:59:06 +0200 User-Agent: KMail/1.13.7 (Linux/3.5.0-rc6-andres-00196-gfdb1335; KDE/4.8.4; x86_64; ; ) Cc: Stuart Bishop References: <201208221440.11558.andres@2ndquadrant.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208291759.07170.andres@2ndquadrant.com> X-Provags-ID: V02:K0:SAdjLB4+fjnLS3st3zl3qCL3ow9nD4pRzuQFv9XcbWy ivOEpY6oXCy5HBNWBklo7IqjzqsAy8w3JoO7ONRdzwfmCNqv3a /MB42eW8pZlNekLWgcPkcSeD+08FTcpQ5mSTfJ2MLKyCHeMEhI GWqJ+Efm8yncvukt7UI8UmGK/qJC0qmOPd8QIfn3Ftvh8WJXTg 76BIqej5vwib9TWDhcZNLVh1w5SGJ6qJA2jR9Oc1OI7oVQZXpo kNdkDt79/CaMp5yCu5usGSbifPc2lSMQk9Pegcb36ZbKgJhoIZ ihE1pQ5X47Fk13Kh0kuB6xHfkjzJ6aDHBbCMl9GO30MrUB3Jq3 LE3PoADcxoWPM8LSUEkr+POCjEHy6OST5h+ZZks2/ZeoEykxGa f2tDsH6MFlQ9g== X-Pg-Spam-Score: 1.7 (+) X-Archive-Number: 201208/226 X-Sequence-Number: 33950 On Wednesday, August 29, 2012 05:32:31 PM Stuart Bishop wrote: > I believe I just hit this same issue, but with PG 9.1.3: > > <@:32407> 2012-08-29 10:02:09 UTC LOG: shutting down > <@:32407> 2012-08-29 10:02:09 UTC LOG: database system is shut down > <[unknown]@[unknown]:31687> 2012-08-29 13:34:03 UTC LOG: connection > received: host=[local] > <[unknown]@[unknown]:31687> 2012-08-29 13:34:03 UTC LOG: incomplete > startup packet > <@:31686> 2012-08-29 13:34:03 UTC LOG: database system was > interrupted; last known up at 2012-08-29 13:14:47 UTC > <@:31686> 2012-08-29 13:34:03 UTC LOG: entering standby mode > <@:31686> 2012-08-29 13:34:03 UTC LOG: redo starts at A92/5F000020 > <@:31686> 2012-08-29 13:34:03 UTC FATAL: could not access status of > transaction 208177034 > <@:31686> 2012-08-29 13:34:03 UTC DETAIL: Could not read from file > "pg_multixact/offsets/0C68" at offset 131072: Success. > <@:31686> 2012-08-29 13:34:03 UTC CONTEXT: xlog redo create multixact > 208177034 offset 1028958730: 1593544329 1593544330 > <@:31681> 2012-08-29 13:34:03 UTC LOG: startup process (PID 31686) > exited with exit code 1 > <@:31681> 2012-08-29 13:34:03 UTC LOG: terminating any other active > server processes > > This was attempting to rebuild a hot standby after switching my master > to a new server. In between the shutdown and the attempt to restart: > > - The master was put into backup mode. > - The datadir was rsynced over, using rsync -ahhP --delete-before > --exclude=postmaster.pid --exclude=pg_xlog > - The master was taken out of backup mode. > - The pg_xlog directory was emptied > - The pg_xlog directory was rsynced across from the master. This > included all the WAL files from before the promotion, throughout > backup mode, and a few from after backup mode was left. Thats not valid, you cannot easily guarantee that youve not copied files that were in the progress of being written to. Use a recovery_command if you do not want all files to be transferred via the replication connection. But do that only for files that have been archived via an archive_command beforehand. Did you have a backup label in the rsync'ed datadir? In Maxim's case I could detect that he had not via line numbers, but I do not see them here... Greetings, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services