]> granicus.if.org Git - postgresql/commitdiff
Rename the "fast_promote" file to just "promote".
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 19 Aug 2013 17:57:53 +0000 (20:57 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 19 Aug 2013 18:01:14 +0000 (21:01 +0300)
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.

src/backend/access/transam/xlog.c
src/bin/pg_ctl/pg_ctl.c

index 6f7680e9957e28a768ade545fee0f556a54a5295..91f62368fe06e2892a20be5b0a1361a542814049 100644 (file)
@@ -65,8 +65,8 @@ extern uint32 bootstrap_data_checksum_version;
 /* File path names (all relative to $PGDATA) */
 #define RECOVERY_COMMAND_FILE  "recovery.conf"
 #define RECOVERY_COMMAND_DONE  "recovery.done"
-#define PROMOTE_SIGNAL_FILE "promote"
-#define FAST_PROMOTE_SIGNAL_FILE "fast_promote"
+#define PROMOTE_SIGNAL_FILE            "promote"
+#define FALLBACK_PROMOTE_SIGNAL_FILE "fallback_promote"
 
 
 /* User-settable parameters */
@@ -9927,19 +9927,20 @@ CheckForStandbyTrigger(void)
        {
                /*
                 * In 9.1 and 9.2 the postmaster unlinked the promote file inside the
-                * signal handler. We now leave the file in place and let the Startup
-                * process do the unlink. This allows Startup to know whether we're
-                * doing fast or normal promotion. Fast promotion takes precedence.
+                * signal handler. It now leaves the file in place and lets the
+                * Startup process do the unlink. This allows Startup to know whether
+                * it should create a full checkpoint before starting up (fallback
+                * mode). Fast promotion takes precedence.
                 */
-               if (stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
+               if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
                {
-                       unlink(FAST_PROMOTE_SIGNAL_FILE);
                        unlink(PROMOTE_SIGNAL_FILE);
+                       unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
                        fast_promote = true;
                }
-               else if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
+               else if (stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
                {
-                       unlink(PROMOTE_SIGNAL_FILE);
+                       unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
                        fast_promote = false;
                }
 
@@ -9975,7 +9976,7 @@ CheckPromoteSignal(void)
        struct stat stat_buf;
 
        if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0 ||
-               stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
+               stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
                return true;
 
        return false;
index 9045e00a1dba8468b6ade31967e4a71d9739d660..1fca1cbd25f1cb8ac941e466f3ea97325793c104 100644 (file)
@@ -1099,12 +1099,11 @@ do_promote(void)
        }
 
        /*
-        * For 9.3 onwards, use fast promotion as the default option. Promotion
+        * For 9.3 onwards, "fast" promotion is performed. Promotion
         * with a full checkpoint is still possible by writing a file called
-        * "promote", e.g. snprintf(promote_file, MAXPGPATH, "%s/promote",
-        * pg_data);
+        * "fallback_promote" instead of "promote"
         */
-       snprintf(promote_file, MAXPGPATH, "%s/fast_promote", pg_data);
+       snprintf(promote_file, MAXPGPATH, "%s/promote", pg_data);
 
        if ((prmfile = fopen(promote_file, "w")) == NULL)
        {