diff options
author | Tomas Vondra | 2017-09-30 16:58:53 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-09-30 16:58:53 +0000 |
commit | f6d85461ca5d6a9afce2ea87a18e98dbdc0d98c2 (patch) | |
tree | ead26775cfc16ead63f72b1ff70f33bd1d05857a | |
parent | d668b3081eb3797a6da84ce7d2ebd5e959b84b59 (diff) |
Fix the pg_basebackup call when adding standby nodes
When adding standby nodes using pgxc_ctl, it's calling pg_basebackup
internally. But the "-x" option was removed in PostgreSQL 10, so the
call is failing.
A straightforward fix would be to use "-X fetch" which does exactly
what "-x" used to do. But I've decided to use "-X stream" instead,
as that does not rely on wal_keep_segments.
Reported by Tank.zhang"<[email protected]>, along with "-X fetch" fix.
-rw-r--r-- | contrib/pgxc_ctl/coord_cmd.c | 4 | ||||
-rw-r--r-- | contrib/pgxc_ctl/datanode_cmd.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pgxc_ctl/coord_cmd.c b/contrib/pgxc_ctl/coord_cmd.c index b1cd50fd4e..40612dbf5d 100644 --- a/contrib/pgxc_ctl/coord_cmd.c +++ b/contrib/pgxc_ctl/coord_cmd.c @@ -304,7 +304,7 @@ cmd_t *prepare_initCoordinatorSlave(char *nodeName) */ appendCmdEl(cmdBuildDir, (cmdBaseBkup = initCmd(aval(VAR_coordSlaveServers)[idx]))); snprintf(newCommand(cmdBaseBkup), MAXLINE, - "pg_basebackup -p %s -h %s -D %s -x", + "pg_basebackup -p %s -h %s -D %s -X stream", aval(VAR_coordPorts)[idx], aval(VAR_coordMasterServers)[idx], aval(VAR_coordSlaveDirs)[idx]); /* Configure recovery.conf file at the slave */ @@ -1414,7 +1414,7 @@ int add_coordinatorSlave(char *name, char *host, int port, int pooler_port, char doImmediate(aval(VAR_coordMasterServers)[idx], NULL, "pg_ctl start -w -Z coordinator -D %s", aval(VAR_coordMasterDirs)[idx]); /* pg_basebackup */ - doImmediate(host, NULL, "pg_basebackup -p %s -h %s -D %s -x", + doImmediate(host, NULL, "pg_basebackup -p %s -h %s -D %s -X stream", aval(VAR_coordPorts)[idx], aval(VAR_coordMasterServers)[idx], dir); /* Update the slave configuration with hot standby and port */ if ((f = pgxc_popen_w(host, "cat >> %s/postgresql.conf", dir)) == NULL) diff --git a/contrib/pgxc_ctl/datanode_cmd.c b/contrib/pgxc_ctl/datanode_cmd.c index 5d39e709a5..ee048d9711 100644 --- a/contrib/pgxc_ctl/datanode_cmd.c +++ b/contrib/pgxc_ctl/datanode_cmd.c @@ -327,7 +327,7 @@ cmd_t *prepare_initDatanodeSlave(char *nodeName) /* Obtain base backup of the master */ appendCmdEl(cmdBuildDir, (cmdBaseBkup = initCmd(aval(VAR_datanodeSlaveServers)[idx]))); snprintf(newCommand(cmdBaseBkup), MAXLINE, - "pg_basebackup -p %s -h %s -D %s -x", + "pg_basebackup -p %s -h %s -D %s -X stream", aval(VAR_datanodePorts)[idx], aval(VAR_datanodeMasterServers)[idx], aval(VAR_datanodeSlaveDirs)[idx]); @@ -1484,7 +1484,7 @@ int add_datanodeSlave(char *name, char *host, int port, int pooler, char *dir, doImmediate(aval(VAR_datanodeMasterServers)[idx], NULL, "pg_ctl start -w -Z datanode -D %s", aval(VAR_datanodeMasterDirs)[idx]); /* pg_basebackup */ - doImmediate(host, NULL, "pg_basebackup -p %s -h %s -D %s -x %s %s", + doImmediate(host, NULL, "pg_basebackup -p %s -h %s -D %s -X stream %s %s", aval(VAR_datanodePorts)[idx], aval(VAR_datanodeMasterServers)[idx], dir, wal ? "--xlogdir" : "", |