index 810f6fef6e31dc3e99d65dcc624996cb67d5387f..166a11433426fc0ea57d488b54c1dc96a869a0cb 100644 (file)
*
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.122 2010年04月07日 03:48:51 itagaki Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.123 2010年09月14日 08:05:33 heikki Exp $
*
*-------------------------------------------------------------------------
*/
static char pid_file[MAXPGPATH];
static char conf_file[MAXPGPATH];
static char backup_file[MAXPGPATH];
+static char recovery_file[MAXPGPATH];
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
static void unlimit_core_size(void);
}
else
{
- if ((shutdown_mode == SMART_MODE) && (stat(backup_file, &statbuf) == 0))
+ /*
+ * If backup_label exists, an online backup is running. Warn the
+ * user that smart shutdown will wait for it to finish. However, if
+ * recovery.conf is also present, we're recovering from an online
+ * backup instead of performing one.
+ */
+ if (shutdown_mode == SMART_MODE &&
+ stat(backup_file, &statbuf) == 0 &&
+ stat(recovery_file, &statbuf) != 0)
{
print_msg(_("WARNING: online backup mode is active\n"
"Shutdown will not complete until pg_stop_backup() is called.\n\n"));
exit(1);
}
- if ((shutdown_mode == SMART_MODE) && (stat(backup_file, &statbuf) == 0))
+ /*
+ * If backup_label exists, an online backup is running. Warn the
+ * user that smart shutdown will wait for it to finish. However, if
+ * recovery.conf is also present, we're recovering from an online
+ * backup instead of performing one.
+ */
+ if (shutdown_mode == SMART_MODE &&
+ stat(backup_file, &statbuf) == 0 &&
+ stat(recovery_file, &statbuf) != 0)
{
print_msg(_("WARNING: online backup mode is active\n"
"Shutdown will not complete until pg_stop_backup() is called.\n\n"));
snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
snprintf(backup_file, MAXPGPATH, "%s/backup_label", pg_data);
+ snprintf(recovery_file, MAXPGPATH, "%s/recovery.conf", pg_data);
}
switch (ctl_command)