Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3619a20

Browse files
committed
Rename the "fast_promote" file to just "promote".
This keeps the usual trigger file name unchanged from 9.2, avoiding nasty issues if you use a pre-9.3 pg_ctl binary with a 9.3 server or vice versa. The fallback behavior of creating a full checkpoint before starting up is now triggered by a file called "fallback_promote". That can be useful for debugging purposes, but we don't expect any users to have to resort to that and we might want to remove that in the future, which is why the fallback mechanism is undocumented.
1 parent c64de21 commit 3619a20

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/backend/access/transam/xlog.c

+11-10
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ extern uint32 bootstrap_data_checksum_version;
6666
/* File path names (all relative to $PGDATA) */
6767
#define RECOVERY_COMMAND_FILE "recovery.conf"
6868
#define RECOVERY_COMMAND_DONE "recovery.done"
69-
#define PROMOTE_SIGNAL_FILE "promote"
70-
#define FAST_PROMOTE_SIGNAL_FILE "fast_promote"
69+
#define PROMOTE_SIGNAL_FILE "promote"
70+
#define FALLBACK_PROMOTE_SIGNAL_FILE "fallback_promote"
7171

7272

7373
/* User-settable parameters */
@@ -11082,19 +11082,20 @@ CheckForStandbyTrigger(void)
1108211082
{
1108311083
/*
1108411084
* In 9.1 and 9.2 the postmaster unlinked the promote file inside the
11085-
* signal handler. We now leave the file in place and let the Startup
11086-
* process do the unlink. This allows Startup to know whether we're
11087-
* doing fast or normal promotion. Fast promotion takes precedence.
11085+
* signal handler. It now leaves the file in place and lets the
11086+
* Startup process do the unlink. This allows Startup to know whether
11087+
* it should create a full checkpoint before starting up (fallback
11088+
* mode). Fast promotion takes precedence.
1108811089
*/
11089-
if (stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
11090+
if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
1109011091
{
11091-
unlink(FAST_PROMOTE_SIGNAL_FILE);
1109211092
unlink(PROMOTE_SIGNAL_FILE);
11093+
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
1109311094
fast_promote = true;
1109411095
}
11095-
else if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
11096+
else if (stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
1109611097
{
11097-
unlink(PROMOTE_SIGNAL_FILE);
11098+
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
1109811099
fast_promote = false;
1109911100
}
1110011101

@@ -11130,7 +11131,7 @@ CheckPromoteSignal(void)
1113011131
struct stat stat_buf;
1113111132

1113211133
if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0 ||
11133-
stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
11134+
stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
1113411135
return true;
1113511136

1113611137
return false;

src/bin/pg_ctl/pg_ctl.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -1099,12 +1099,11 @@ do_promote(void)
10991099
}
11001100

11011101
/*
1102-
* For 9.3 onwards, use fast promotion as the default option. Promotion
1102+
* For 9.3 onwards, "fast" promotion is performed. Promotion
11031103
* with a full checkpoint is still possible by writing a file called
1104-
* "promote", e.g. snprintf(promote_file, MAXPGPATH, "%s/promote",
1105-
* pg_data);
1104+
* "fallback_promote" instead of "promote"
11061105
*/
1107-
snprintf(promote_file, MAXPGPATH, "%s/fast_promote", pg_data);
1106+
snprintf(promote_file, MAXPGPATH, "%s/promote", pg_data);
11081107

11091108
if ((prmfile = fopen(promote_file, "w")) == NULL)
11101109
{

0 commit comments

Comments
 (0)