8000 Rename the "fast_promote" file to just "promote". · sqlparser/postgres@38c6923 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 38c6923

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 b19e5a6 commit 38c6923

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/backend/access/transam/xlog.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ extern uint32 bootstrap_data_checksum_version;
6565
/* File path names (all relative to $PGDATA) */
6666
#define RECOVERY_COMMAND_FILE "recovery.conf"
6767
#define RECOVERY_COMMAND_DONE "recovery.done"
68-
#define PROMOTE_SIGNAL_FILE "promote"
69-
#define FAST_PROMOTE_SIGNAL_FILE "fast_promote"
68+
#define PROMOTE_SIGNAL_FILE "promote"
69+
#define FALLBACK_PROMOTE_SIGNAL_FILE "fallback_promote"
7070

7171

7272
/* User-settable parameters */
@@ -9927,19 +9927,20 @@ CheckForStandbyTrigger(void)
99279927
{
99289928
/*
99299929
* In 9.1 and 9.2 the postmaster unlinked the promote file inside the
9930-
* signal handler. We now leave the file in place and let the Startup
9931-
* process do the unlink. This allows Startup to know whether we're
9932-
* doing fast or normal promotion. Fast promotion takes precedence.
9930+
* signal handler. It now leaves the file in place and lets the
9931+
* Startup process do the unlink. This allows Startup to know whether
9932+
* it should create a full checkpoint before starting up (fallback
9933+
* mode). Fast promotion takes precedence.
99339934
*/
9934-
if (stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
9935+
if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
99359936
{
9936-
unlink(FAST_PROMOTE_SIGNAL_FILE);
99379937
unlink(PROMOTE_SIGNAL_FILE);
9938+
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
99389939
fast_promote = true;
99399940
}
9940-
else if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
9941+
else if (stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
99419942
{
9942-
unlink(PROMOTE_SIGNAL_FILE);
9943+
unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
99439944
fast_promote = false;
99449945
}
99459946

@@ -9975,7 +9976,7 @@ CheckPromoteSignal(void)
99759976
struct stat stat_buf;
99769977

99779978
if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0 ||
9978-
stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
9979+
stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
99799980
return true;
99809981

99819982
return false;

src/bin/pg_ctl/pg_ctl.c

Lines changed: 3 additions & 4 deletions
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)
0