On Wed, Sep 16, 2015 at 9:46 PM, Michael Paquier wrote:
> That's something that we discussed in this CF's patch to ease the
> handling of timeline switches when rewinding a node, I wouldn't have
> any objection to get that backpatched to 9.5 though (the
> DB_SHUTDOWNED_IN_RECOVERY part I mean).
Independent patch attached FWIW (I'm sure you had the same though).
--
Michael
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 032301f..1e38122 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -374,10 +374,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,
+ * strict than necessary; it's OK if the 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,7 +386,9 @@ 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");
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers