Make sure to write to the GTM control file only after paths are set up
authorPavan Deolasee <[email protected]>
Mon, 15 Feb 2016 12:50:44 +0000 (18:20 +0530)
committerPavan Deolasee <[email protected]>
Mon, 15 Feb 2016 18:30:08 +0000 (00:00 +0530)
correctly

src/gtm/main/main.c

index 123350029e646b7f155066e8e341ed1b9b3112b8..c0b3832123c4cd96607480d8c40b51ebd2a22c71 100644 (file)
@@ -193,9 +193,6 @@ InitGTMProcess()
        MyThreadID = pthread_self();
        MemoryContextInit();
 
-       /* Backup the restore point */
-       GTM_WriteRestorePoint();
-
        /*
         * The memory context is now set up.
         * Add the thrinfo structure in the global array
@@ -706,6 +703,10 @@ main(int argc, char *argv[])
                GTM_MutexLockRelease(&control_lock);
        }
 
+       /* Backup the restore point */
+       GTM_SetNeedBackup();
+       GTM_WriteRestorePoint();
+
        if (Recovery_IsStandby())
        {
                if (!gtm_standby_register_self(NodeName, GTMPortNumber, GTMDataDir))
@@ -2230,6 +2231,8 @@ PromoteToActive(void)
                                         errmsg("could not close GTM configuration file \"%s\": %m",
                                                        conf_file)));
        }
+       GTM_SetNeedBackup();
+       GTM_WriteRestorePoint();
        return;
 }