Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit06e8c8e

Browse files
committed
Don't warn about an in-progress online backup, when we're recovering from
an online backup instead of performing one. pg_ctl can detect that bychecking if recovery.conf exists.Backup label file is renamed away early in recovery, so the window wherebackup label exists during recovery is normally very small, but you can runinto it e.g if restore_command is set incorrectly and the startup processnever finds even the first WAL segment containing the checkpoint record tostart recovery from.Fujii Masao with comments by me.
1 parentc1ba7db commit06e8c8e

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.122 2010/04/07 03:48:51 itagaki Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.123 2010/09/14 08:05:33 heikki Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -142,6 +142,7 @@ static char postopts_file[MAXPGPATH];
142142
staticcharpid_file[MAXPGPATH];
143143
staticcharconf_file[MAXPGPATH];
144144
staticcharbackup_file[MAXPGPATH];
145+
staticcharrecovery_file[MAXPGPATH];
145146

146147
#if defined(HAVE_GETRLIMIT)&& defined(RLIMIT_CORE)
147148
staticvoidunlimit_core_size(void);
@@ -802,7 +803,15 @@ do_stop(void)
802803
}
803804
else
804805
{
805-
if ((shutdown_mode==SMART_MODE)&& (stat(backup_file,&statbuf)==0))
806+
/*
807+
* If backup_label exists, an online backup is running. Warn the
808+
* user that smart shutdown will wait for it to finish. However, if
809+
* recovery.conf is also present, we're recovering from an online
810+
* backup instead of performing one.
811+
*/
812+
if (shutdown_mode==SMART_MODE&&
813+
stat(backup_file,&statbuf)==0&&
814+
stat(recovery_file,&statbuf)!=0)
806815
{
807816
print_msg(_("WARNING: online backup mode is active\n"
808817
"Shutdown will not complete until pg_stop_backup() is called.\n\n"));
@@ -879,7 +888,15 @@ do_restart(void)
879888
exit(1);
880889
}
881890

882-
if ((shutdown_mode==SMART_MODE)&& (stat(backup_file,&statbuf)==0))
891+
/*
892+
* If backup_label exists, an online backup is running. Warn the
893+
* user that smart shutdown will wait for it to finish. However, if
894+
* recovery.conf is also present, we're recovering from an online
895+
* backup instead of performing one.
896+
*/
897+
if (shutdown_mode==SMART_MODE&&
898+
stat(backup_file,&statbuf)==0&&
899+
stat(recovery_file,&statbuf)!=0)
883900
{
884901
print_msg(_("WARNING: online backup mode is active\n"
885902
"Shutdown will not complete until pg_stop_backup() is called.\n\n"));
@@ -1962,6 +1979,7 @@ main(int argc, char **argv)
19621979
snprintf(pid_file,MAXPGPATH, "%s/postmaster.pid",pg_data);
19631980
snprintf(conf_file,MAXPGPATH, "%s/postgresql.conf",pg_data);
19641981
snprintf(backup_file,MAXPGPATH, "%s/backup_label",pg_data);
1982+
snprintf(recovery_file,MAXPGPATH, "%s/recovery.conf",pg_data);
19651983
}
19661984

19671985
switch (ctl_command)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp