Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a8cHL-0004Vf-1o for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Dec 2015 23:11:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a8cHJ-0004BG-Sa for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Dec 2015 23:11:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a8cHJ-0004BA-G2 for pgsql-bugs@postgresql.org; Mon, 14 Dec 2015 23:11:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a8cHG-00083e-VM for pgsql-bugs@postgresql.org; Mon, 14 Dec 2015 23:11:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tBENBFPb000938; Mon, 14 Dec 2015 18:11:15 -0500 From: Tom Lane To: Peter Eisentraut cc: Michael Paquier , PostgreSQL mailing lists , Heikki Linnakangas Subject: Re: pg_rewind exiting with error code 1 when source and target are on the same timeline In-reply-to: <566B82CF.6070809@gmx.net> References: <5627E2A4.4000402@gmx.net> <566106F7.4000404@gmx.net> <566B82CF.6070809@gmx.net> Comments: In-reply-to Peter Eisentraut message dated "Fri, 11 Dec 2015 21:13:35 -0500" Date: Mon, 14 Dec 2015 18:11:15 -0500 Message-ID: <937.1450134675@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Peter Eisentraut writes: > On 12/3/15 11:10 PM, Michael Paquier wrote: >> On Fri, Dec 4, 2015 at 12:22 PM, Peter Eisentraut wrote: >>> After playing with this a bit, I think your patch is correct. The code >>> has drifted a bit in the meantime, so attached is an updated patch. >> Thanks for looking at it. > I committed this to master. It's also on the 9.5 open item list, but if > I backport it then the tests don't pass. Still looking. Not sure yet > if this is because of code changes in pg_rewind master or test > infrastructure changes in master. I poked into this and found that the problem is that 9.5 is lacking the hunks of commit e50cda78 that teach sanityChecks() to allow the control file state to be DB_SHUTDOWNED_IN_RECOVERY, to wit @@ -374,10 +380,11 @@ sanityChecks(void) /* * Target cluster better not be running. This doesn't guard against * someone starting the cluster concurrently. Also, this is probably more - * strict than necessary; it's OK if the master was not shut down cleanly, - * as long as it isn't running at the moment. + * strict than necessary; it's OK if the target node was not shut down + * cleanly, as long as it isn't running at the moment. */ - if (ControlFile_target.state != DB_SHUTDOWNED) + if (ControlFile_target.state != DB_SHUTDOWNED && + ControlFile_target.state != DB_SHUTDOWNED_IN_RECOVERY) pg_fatal("target server must be shut down cleanly\n"); /* @@ -385,75 +392,149 @@ sanityChecks(void) * server is shut down. There isn't any very strong reason for this * limitation, but better safe than sorry. */ - if (datadir_source && ControlFile_source.state != DB_SHUTDOWNED) + if (datadir_source && + ControlFile_source.state != DB_SHUTDOWNED && + ControlFile_source.state != DB_SHUTDOWNED_IN_RECOVERY) pg_fatal("source data directory must be shut down cleanly\n"); } (Actually, it's only the second of these that is critical to make the test pass, but I should think we should apply both of them if either.) If I apply these, without any of the rest of e50cda78, everything seems fine. I'm going to go ahead and push that in the interests of getting some buildfarm cycles on it; but if someone could confirm that this is not an insane thing to do, it'd help. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs