Skip to content

Commit 4143782

Browse files
committed
Change pgxc_ctl to use wal_level, max_wal_senders and archive_mode GUC of the master
when creating coordinator/datanode slave. Also, preserve these GUC of the master when removing the slave.
1 parent bb78e69 commit 4143782

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

contrib/pgxc_ctl/coord_cmd.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,7 @@ prepare_initCoordinatorSlave(char *nodeName)
402402
"# Added to initialize the slave, %s\n"
403403
"hot_standby = on\n"
404404
"port = %s\n"
405-
"wal_level = minimal\n"
406-
"archive_mode = off\n"
407405
"archive_command = ''\n"
408-
"max_wal_senders = 0\n"
409406
"# End of Addition\n",
410407
timeStampString(timestamp, MAXTOKEN), aval(VAR_coordPorts)[idx]);
411408
fclose(f);
@@ -1252,10 +1249,12 @@ add_coordinatorSlave(char *name, char *host, char *dir, char *archDir)
12521249
"# Added to initialize the slave, %s\n"
12531250
"hot_standby = on\n"
12541251
"port = %d\n"
1255-
"wal_level = minimal\n" /* WAL level --- minimal. No cascade slave so far. */
1256-
"archive_mode = off\n" /* No archive mode */
1252+
"wal_level = hot_standby\n" /* WAL level --- to be ready to failover */
1253+
"archive_mode = on\n" /* To be ready to be a master */
12571254
"archive_command = ''\n" /* No archive mode */
1258-
"max_wal_senders = 0\n" /* Minimum WAL senders */
1255+
"max_wal_senders = 5\n" /* To be ready to be a master: Tentatively 5. */
1256+
/* Next major version will allow common */
1257+
/* max_wal_senders to be taken here. */
12591258
"# End of Addition\n",
12601259
timeStampString(date, MAXTOKEN), atoi(aval(VAR_coordPorts)[idx]));
12611260
fclose(f);
@@ -1469,11 +1468,8 @@ remove_coordinatorSlave(char *name, int clean_opt)
14691468
fprintf(f,
14701469
"#=======================================\n"
14711470
"# Updated to remove the slave %s\n"
1472-
"archive_mode = off\n"
14731471
"synchronous_standby_names = ''\n"
14741472
"archive_command = ''\n"
1475-
"max_wal_senders = 0\n"
1476-
"wal_level = minimal\n"
14771473
"# End of the update\n",
14781474
timeStampString(date, MAXTOKEN));
14791475
fclose(f);

contrib/pgxc_ctl/datanode_cmd.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,10 +1203,7 @@ add_datanodeSlave(char *name, char *host, char *dir, char *archDir)
12031203
"# Added to initialize the slave, %s\n"
12041204
"hot_standby = on\n"
12051205
"port = %s\n"
1206-
"wal_level = minimal\n" /* WAL level --- minimal. No cascade slave so far. */
1207-
"archive_mode = off\n" /* No archive mode */
12081206
"archive_command = ''\n" /* No archive mode */
1209-
"max_wal_senders = 0\n" /* Minimum WAL senders */
12101207
"# End of Addition\n",
12111208
timeStampString(date, MAXTOKEN), aval(VAR_datanodePorts)[idx]);
12121209
fclose(f);
@@ -1425,11 +1422,8 @@ remove_datanodeSlave(char *name, int clean_opt)
14251422
fprintf(f,
14261423
"#=======================================\n"
14271424
"# Updated to remove the slave %s\n"
1428-
"archive_mode = off\n"
14291425
"synchronous_standby_names = ''\n"
14301426
"archive_command = ''\n"
1431-
"max_wal_senders = 0\n"
1432-
"wal_level = minimal\n"
14331427
"# End of the update\n",
14341428
timeStampString(date, MAXTOKEN));
14351429
fclose(f);

0 commit comments

Comments
 (0)