From: Pavan Deolasee Date: Tue, 4 Oct 2016 05:27:00 +0000 (+0530) Subject: Correctly initialise coordMaxWALSenders and datanodeMaxWALSenders while adding X-Git-Tag: XL9_5_R1_4~11 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2e27d202bb8443508f771126bcfc58f41819c8ab;p=postgres-xl.git Correctly initialise coordMaxWALSenders and datanodeMaxWALSenders while adding new nodes via pgxc_ctl --- diff --git a/contrib/pgxc_ctl/coord_cmd.c b/contrib/pgxc_ctl/coord_cmd.c index ec69a35760..00afd1e52e 100644 --- a/contrib/pgxc_ctl/coord_cmd.c +++ b/contrib/pgxc_ctl/coord_cmd.c @@ -967,6 +967,7 @@ int add_coordinatorMaster(char *name, char *host, int port, int pooler, int size, idx; char port_s[MAXTOKEN+1]; char pooler_s[MAXTOKEN+1]; + char max_wal_senders_s[MAXTOKEN+1]; int gtmPxyIdx; int connCordIndx; char *gtmHost; @@ -1039,12 +1040,13 @@ int add_coordinatorMaster(char *name, char *host, int port, int pooler, */ snprintf(port_s, MAXTOKEN, "%d", port); snprintf(pooler_s, MAXTOKEN, "%d", pooler); + snprintf(max_wal_senders_s, MAXTOKEN, "%d", getDefaultWalSender(true)); assign_arrayEl(VAR_coordNames, idx, name, NULL); assign_arrayEl(VAR_coordMasterServers, idx, host, NULL); assign_arrayEl(VAR_coordPorts, idx, port_s, "-1"); assign_arrayEl(VAR_poolerPorts, idx, pooler_s, NULL); assign_arrayEl(VAR_coordMasterDirs, idx, dir, NULL); - assign_arrayEl(VAR_coordMaxWALSenders, idx, aval(VAR_coordMaxWALSenders)[0], "-1"); /* Could be vulnerable */ + assign_arrayEl(VAR_coordMaxWALSenders, idx, max_wal_senders_s, NULL); assign_arrayEl(VAR_coordSlaveServers, idx, "none", NULL); assign_arrayEl(VAR_coordSlavePorts, idx, "none", NULL); assign_arrayEl(VAR_coordSlavePoolerPorts, idx, "none", NULL); diff --git a/contrib/pgxc_ctl/datanode_cmd.c b/contrib/pgxc_ctl/datanode_cmd.c index dff0001e76..4a3b83b325 100644 --- a/contrib/pgxc_ctl/datanode_cmd.c +++ b/contrib/pgxc_ctl/datanode_cmd.c @@ -964,7 +964,8 @@ int add_datanodeMaster(char *name, char *host, int port, int pooler, char *dir, FILE *f, *lockf; int size, idx; char port_s[MAXTOKEN+1]; - char pooler_s[MAXTOKEN+1]; + char pooler_s[MAXTOKEN+1]; + char max_wal_senders_s[MAXTOKEN+1]; int gtmPxyIdx; int connCordIdx; char *gtmHost; @@ -1072,13 +1073,14 @@ int add_datanodeMaster(char *name, char *host, int port, int pooler, char *dir, */ snprintf(port_s, MAXTOKEN, "%d", port); snprintf(pooler_s, MAXTOKEN, "%d", pooler); + snprintf(max_wal_senders_s, MAXTOKEN, "%d", getDefaultWalSender(false)); assign_arrayEl(VAR_datanodeNames, idx, name, NULL); assign_arrayEl(VAR_datanodeMasterServers, idx, host, NULL); assign_arrayEl(VAR_datanodePorts, idx, port_s, "-1"); assign_arrayEl(VAR_datanodePoolerPorts, idx, pooler_s, "-1"); assign_arrayEl(VAR_datanodeMasterDirs, idx, dir, NULL); assign_arrayEl(VAR_datanodeMasterWALDirs, idx, waldir, NULL); - assign_arrayEl(VAR_datanodeMaxWALSenders, idx, aval(VAR_datanodeMaxWALSenders)[0], NULL); /* Could be vulnerable */ + assign_arrayEl(VAR_datanodeMaxWALSenders, idx, max_wal_senders_s, NULL); if (isVarYes(VAR_datanodeSlave)) { assign_arrayEl(VAR_datanodeSlaveServers, idx, "none", NULL);