Comment 11 for bug 1285380

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

With following, it works as described in last comment:

=== modified file 'gcs/src/gcs_group.c'
--- gcs/src/gcs_group.c 2014-02-28 02:15:22 +0000
+++ gcs/src/gcs_group.c 2014-03-08 20:20:23 +0000
@@ -894,6 +894,10 @@
     const char* begin = str;
     const char* end;
     int err = -EHOSTDOWN; /* worst error */
+ bool dcomma = false; /* dangling comma */
+
+ if (!strcmp(str+strlen(str)-1,","))
+ dcomma = true;

     do {
         end = strchr(begin, ',');
@@ -912,8 +916,10 @@
         int const idx = len > 0 ? /* consider empty name as "any" */
             group_find_node_by_name (group, joiner_idx, begin, len, status) :
             /* err == -EAGAIN here means that at least one of the nodes in the
- * list will be available later, so don't try others. */
- (err == -EAGAIN ?
+ * list will be available later, so don't try others.
+ * Also, dangling comma is checked to see if fallback is attempted
+ * or not */
+ ((err == -EAGAIN && !dcomma) ?
              err : group_find_node_by_state(group, joiner_idx, status));

         if (idx >= 0) return idx;

ie. with dangling comma, it falls back to provider discovery of
nodes based on their states, without it, it is strict in
conforming to the nodes.