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

Commit 5de02c2

Browse files
committed
Add online_ugrade_path option
1 parent fd078e7 commit 5de02c2

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ bool ClientAuthInProgress = false; /* T during new-client
354354

355355
bool redirection_done = false; /* stderr redirected for syslogger? */
356356

357+
char* OnlineUpgradePath = (char*)"";
358+
357359
/* received START_AUTOVAC_LAUNCHER signal */
358360
static volatile sig_atomic_t start_autovac_launcher = false;
359361

@@ -565,10 +567,13 @@ static void
565567
UpgradePostgres(void)
566568
{
567569
#ifdef EXEC_BACKEND
568-
char* PostmasterArgs[] = {"/home/knizhnik/postgresql/dist/bin/postgres", "-U", "-D", "." ,NULL};
570+
char* PostmasterArgs[] = {"postgres", "-U", "-D", "." ,NULL};
569571
BackendParameters param;
570572
FILE *fp;
571573

574+
if (*OnlineUpgradePath == '\0')
575+
elog(ERROR, "Online upgrade path was not specified: alter system set online_ugrade_path='...' ; select pg_reload_conf()");
576+
572577
IsOnlineUpgrade = true;
573578
TerminateChildren(SIGTERM);
574579
if (CheckpointerPID != 0)
@@ -605,10 +610,11 @@ UpgradePostgres(void)
605610
return;
606611
}
607612

608-
elog(LOG, "Upgrade postgres");
613+
elog(LOG, "Upgrade postgres to %s", OnlineUpgradePath);
614+
PostmasterArgs[0] = psprintf("%s/postgres", OnlineUpgradePath);
609615
execv(PostmasterArgs[0], PostmasterArgs);
610616
#else
611-
elog(LOG, "Online upgrade is possible only postgres configured with EXEC_BACKEND");
617+
elog(LOG, "Online upgrade is possible only for postgres configured with EXEC_BACKEND");
612618
#endif
613619
}
614620

src/backend/utils/misc/guc.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,17 @@ static struct config_string ConfigureNamesString[] =
36683668
NULL, NULL, NULL
36693669
},
36703670

3671+
{
3672+
{"online_upgrade_path", PGC_SIGHUP, FILE_LOCATIONS,
3673+
gettext_noop("Specify path to binaries of new Postgres version for online upgrade"),
3674+
NULL,
3675+
GUC_SUPERUSER_ONLY
3676+
},
3677+
&OnlineUpgradePath,
3678+
"",
3679+
NULL, NULL, NULL
3680+
},
3681+
36713682
{
36723683
{"krb_server_keyfile", PGC_SIGHUP, CONN_AUTH_AUTH,
36733684
gettext_noop("Sets the location of the Kerberos server key file."),

src/include/postmaster/postmaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ extern bool log_hostname;
2929
extern bool enable_bonjour;
3030
extern char *bonjour_name;
3131
extern bool restart_after_crash;
32+
extern char* OnlineUpgradePath;
3233

3334
#ifdef WIN32
3435
extern HANDLE PostmasterHandle;

0 commit comments

Comments
 (0)