Просмотр исходного кода

votequorum: transmit wait_for_all info in node info message

this is necessary to reset the wait_for_all data when a node is joining a cluster
that has already seen all nodes once.

Reviewed-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Fabio M. Di Nitto 14 лет назад
Родитель
Сommit
249dd966c2
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      services/votequorum.c

+ 8 - 1
services/votequorum.c

@@ -417,6 +417,7 @@ struct req_exec_quorum_nodeinfo {
 	unsigned int patch_version;	/* Backwards/forwards compatible */
 	unsigned int config_version;
 	unsigned int flags;
+	unsigned int wait_for_all;
 
 } __attribute__((packed));
 
@@ -889,6 +890,7 @@ static int quorum_exec_send_nodeinfo()
 	req_exec_quorum_nodeinfo.patch_version = VOTEQUORUM_PATCH_VERSION;
 	req_exec_quorum_nodeinfo.flags = us->flags;
 	req_exec_quorum_nodeinfo.first_trans = first_trans;
+	req_exec_quorum_nodeinfo.wait_for_all = wait_for_all;
 	if (have_disallowed())
 		req_exec_quorum_nodeinfo.flags |= NODE_FLAGS_SEESDISALLOWED;
 
@@ -1007,6 +1009,7 @@ static void exec_votequorum_nodeinfo_endian_convert (void *msg)
 	nodeinfo->patch_version = swab32(nodeinfo->patch_version);
 	nodeinfo->config_version = swab32(nodeinfo->config_version);
 	nodeinfo->flags = swab32(nodeinfo->flags);
+	nodeinfo->wait_for_all = swab32(nodeinfo->wait_for_all);
 }
 
 static void exec_votequorum_reconfigure_endian_convert (void *msg)
@@ -1066,7 +1069,7 @@ static void message_handler_req_exec_votequorum_nodeinfo (
 	node->expected_votes = req_exec_quorum_nodeinfo->expected_votes;
 	node->state = NODESTATE_MEMBER;
 
-	log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message: votes: %d, expected:%d\n", req_exec_quorum_nodeinfo->votes, req_exec_quorum_nodeinfo->expected_votes);
+	log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message: votes: %d, expected: %d wfa: %d\n", req_exec_quorum_nodeinfo->votes, req_exec_quorum_nodeinfo->expected_votes, req_exec_quorum_nodeinfo->wait_for_all);
 
 	/* Check flags for disallowed (if enabled) */
 	if (quorum_flags & VOTEQUORUM_FLAG_FEATURE_DISALLOWED) {
@@ -1095,6 +1098,10 @@ static void message_handler_req_exec_votequorum_nodeinfo (
 		free(node);
 	}
 
+	if ((wait_for_all) && (!req_exec_quorum_nodeinfo->wait_for_all)) {
+		wait_for_all = 0;
+	}
+
 	LEAVE();
 }