Use a non-zero default value for max_wal_senders on coordinator and datanode
authorPavan Deolasee <[email protected]>
Mon, 28 Mar 2016 08:29:04 +0000 (13:59 +0530)
committerPavan Deolasee <[email protected]>
Mon, 28 Mar 2016 08:29:04 +0000 (13:59 +0530)
master

contrib/pgxc_ctl/config.c

index b36fa2bc820328a936792e7eb1b08dedb679d83a..b35c4c1f27cb0d540c242d3c8794a910734c03ec 100644 (file)
@@ -1196,6 +1196,13 @@ NodeType getNodeType(char *nodeName)
 
 }
 
+#define DEFAULT_PGXC_CTL_MAX_WAL_SENDERS       5
+
+/*
+ * Determine default value for max_wal_senders. We pick up the value specified
+ * for some other existing coordinator or datanode or return the
+ * DEFAULT_PGXC_CTL_MAX_WAL_SENDERS value if none is spcified
+ */
 int getDefaultWalSender(int isCoord)
 {
        int ii;
@@ -1206,8 +1213,11 @@ int getDefaultWalSender(int isCoord)
        for (ii = 0; aval(names)[ii]; ii++)
        {
                if (doesExist(names, ii) && !is_none(aval(names)[ii]) && (atoi(aval(walSender)[ii]) >= 0))
-                       return atoi(aval(walSender)[ii]);
+               {
+                       int nsenders = atoi(aval(walSender)[ii]);
+                       return nsenders ? nsenders : DEFAULT_PGXC_CTL_MAX_WAL_SENDERS;
+               }
        }
-       /* If none found, return 5 as the default value.. */
-       return 5;
+       /* If none found, return the default value.. */
+       return DEFAULT_PGXC_CTL_MAX_WAL_SENDERS;
 }