char port_s[MAXTOKEN+1];
char pooler_s[MAXTOKEN+1];
int kk;
+ int size;
/* Check if the name is valid coordinator */
if ((idx = coordIdx(name)) < 0)
sval(VAR_pgxcOwner), getIpAddress(host));
pclose(f);
/* Reconfigure pgxc_ctl configuration with the new slave */
+ size = arraySizeName(VAR_coordNames);
/* Need an API to expand the array to desired size */
- if ((extendVar(VAR_coordSlaveServers, idx + 1, "none") != 0) ||
- (extendVar(VAR_coordSlaveDirs, idx + 1, "none") != 0) ||
- (extendVar(VAR_coordSlavePorts, idx + 1, "none") != 0) ||
- (extendVar(VAR_coordSlavePoolerPorts, idx + 1, "none") != 0) ||
- (extendVar(VAR_coordArchLogDirs, idx + 1, "none") != 0))
+ if ((extendVar(VAR_coordSlaveServers, size, "none") != 0) ||
+ (extendVar(VAR_coordSlaveDirs, size, "none") != 0) ||
+ (extendVar(VAR_coordSlavePorts, size, "none") != 0) ||
+ (extendVar(VAR_coordSlavePoolerPorts, size, "none") != 0) ||
+ (extendVar(VAR_coordArchLogDirs, size, "none") != 0))
{
elog(PANIC, "PANIC: Internal error, inconsistent coordinator information\n");
return 1;
}
if (!isVarYes(VAR_coordSlave))
assign_sval(VAR_coordSlave, "y");
- assign_arrayEl(VAR_coordSlaveServers, idx, host, NULL);
- assign_arrayEl(VAR_coordSlavePorts, idx, port_s, NULL);
- assign_arrayEl(VAR_coordSlavePoolerPorts, idx, pooler_s, NULL);
- assign_arrayEl(VAR_coordSlaveDirs, idx, dir, NULL);
- assign_arrayEl(VAR_coordArchLogDirs, idx, archDir, NULL);
+ replace_arrayEl(VAR_coordSlaveServers, idx, host, NULL);
+ replace_arrayEl(VAR_coordSlavePorts, idx, port_s, NULL);
+ replace_arrayEl(VAR_coordSlavePoolerPorts, idx, pooler_s, NULL);
+ replace_arrayEl(VAR_coordSlaveDirs, idx, dir, NULL);
+ replace_arrayEl(VAR_coordArchLogDirs, idx, archDir, NULL);
/* Update the configuration file and backup it */
if ((f = fopen(pgxc_ctl_config_path, "a")) == NULL)
{
char pooler_s[MAXTOKEN+1];
int kk;
bool wal;
+ int size;
if (walDir && (strcasecmp(walDir, "none") != 0))
wal = true;
"# End of addition ===============================\n",
sval(VAR_pgxcOwner), getIpAddress(host));
pclose(f);
+
+ size = arraySizeName(VAR_datanodeNames);
/* Need an API to expand the array to desired size */
- if ((extendVar(VAR_datanodeSlaveServers, idx + 1, "none") != 0) ||
- (extendVar(VAR_datanodeSlavePorts, idx + 1, "none") != 0) ||
- (extendVar(VAR_datanodeSlavePoolerPorts, idx + 1, "none") != 0) ||
- (extendVar(VAR_datanodeSlaveDirs, idx + 1, "none") != 0) ||
- (extendVar(VAR_datanodeArchLogDirs, idx + 1, "none") != 0))
+ if ((extendVar(VAR_datanodeSlaveServers, size, "none") != 0) ||
+ (extendVar(VAR_datanodeSlavePorts, size, "none") != 0) ||
+ (extendVar(VAR_datanodeSlavePoolerPorts, size, "none") != 0) ||
+ (extendVar(VAR_datanodeSlaveDirs, size, "none") != 0) ||
+ (extendVar(VAR_datanodeSlaveWALDirs, size, "none") != 0) ||
+ (extendVar(VAR_datanodeArchLogDirs, size, "none") != 0))
{
elog(PANIC, "PANIC: Internal error, inconsistent datanode information\n");
return 1;
if (!isVarYes(VAR_datanodeSlave))
assign_sval(VAR_datanodeSlave, "y");
- assign_arrayEl(VAR_datanodeSlaveServers, idx, host, NULL);
- assign_arrayEl(VAR_datanodeSlavePorts, idx, port_s, NULL);
- assign_arrayEl(VAR_datanodeSlavePoolerPorts, idx, pooler_s, NULL);
- assign_arrayEl(VAR_datanodeSlaveDirs, idx, dir, NULL);
- assign_arrayEl(VAR_datanodeSlaveWALDirs, idx, walDir, NULL);
- assign_arrayEl(VAR_datanodeArchLogDirs, idx, archDir, NULL);
+ replace_arrayEl(VAR_datanodeSlaveServers, idx, host, NULL);
+ replace_arrayEl(VAR_datanodeSlavePorts, idx, port_s, NULL);
+ replace_arrayEl(VAR_datanodeSlavePoolerPorts, idx, pooler_s, NULL);
+ replace_arrayEl(VAR_datanodeSlaveDirs, idx, dir, NULL);
+ replace_arrayEl(VAR_datanodeSlaveWALDirs, idx, walDir, NULL);
+ replace_arrayEl(VAR_datanodeArchLogDirs, idx, archDir, NULL);
/* Update the configuration file and backup it */
if ((f = fopen(pgxc_ctl_config_path, "a")) == NULL)
{