*** a/src/backend/postmaster/postmaster.c --- b/src/backend/postmaster/postmaster.c *************** *** 2193,2198 **** pmdie(SIGNAL_ARGS) --- 2193,2209 ---- */ pmState = (pmState == PM_RUN) ? PM_WAIT_BACKUP : PM_WAIT_READONLY; + + /* + * Urge users to call pg_stop_backup to complete the smart + * shutdown if online backup mode is active. + */ + if (pmState == PM_WAIT_BACKUP && BackupInProgress()) + ereport(WARNING, + (errmsg("online backup mode is active"), + errhint("Shutdown will not complete until pg_stop_backup() is called."))); + else + pmState = PM_WAIT_BACKENDS; } /* *** a/src/bin/pg_ctl/pg_ctl.c --- b/src/bin/pg_ctl/pg_ctl.c *************** *** 141,147 **** static bool postmaster_is_alive(pid_t pid); static char postopts_file[MAXPGPATH]; static char pid_file[MAXPGPATH]; static char conf_file[MAXPGPATH]; - static char backup_file[MAXPGPATH]; #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE) static void unlimit_core_size(void); --- 141,146 ---- *************** *** 769,775 **** do_stop(void) { int cnt; pgpid_t pid; - struct stat statbuf; pid = get_pgpid(); --- 768,773 ---- *************** *** 802,813 **** do_stop(void) } else { - if ((shutdown_mode == SMART_MODE) && (stat(backup_file, &statbuf) == 0)) - { - print_msg(_("WARNING: online backup mode is active\n" - "Shutdown will not complete until pg_stop_backup() is called.\n\n")); - } - print_msg(_("waiting for server to shut down...")); for (cnt = 0; cnt < wait_seconds; cnt++) --- 800,805 ---- *************** *** 844,850 **** do_restart(void) { int cnt; pgpid_t pid; - struct stat statbuf; pid = get_pgpid(); --- 836,841 ---- *************** *** 879,890 **** do_restart(void) exit(1); } - if ((shutdown_mode == SMART_MODE) && (stat(backup_file, &statbuf) == 0)) - { - print_msg(_("WARNING: online backup mode is active\n" - "Shutdown will not complete until pg_stop_backup() is called.\n\n")); - } - print_msg(_("waiting for server to shut down...")); /* always wait for restart */ --- 870,875 ---- *************** *** 1961,1967 **** main(int argc, char **argv) snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data); 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); } switch (ctl_command) --- 1946,1951 ----