/** * Print info about a node. * * \param[in] node Node to print info about */ static void dump_node(const sup_node_t *node) { char seen_str[EXA_MAX_NODES_NUMBER + 1]; char clique_str[EXA_MAX_NODES_NUMBER + 1]; if (node == NULL) return; exa_nodeset_to_bin(&node->view.nodes_seen, seen_str); exa_nodeset_to_bin(&node->view.clique, clique_str); __debug("%c%c%u: (state=%s seen=%s clique=%s coord=%u accepted=%u committed=%u)", self_sees(node) ? ' ' : '-', node->id == self->id ? '*' : ' ', node->id, sup_state_name(node->view.state), seen_str, clique_str, node->view.coord, node->view.accepted, node->view.committed); }
/** * Print a view in a file. * * \param[in] view View to print * \param file File to print to */ void sup_view_debug(const sup_view_t *view) { char seen_str[EXA_MAX_NODES_NUMBER + 1]; char clique_str[EXA_MAX_NODES_NUMBER + 1]; if (view == NULL) { __debug("(null view)"); return; } exa_nodeset_to_bin(&view->nodes_seen, seen_str); exa_nodeset_to_bin(&view->clique, clique_str); __debug("state=%s seen=%s num_seen=%u clique=%s coord=%u" " accepted=%u committed=%u", sup_state_name(view->state), seen_str, view->num_seen, clique_str, view->coord, view->accepted, view->committed); }
/** * Before sending a ping. */ static void sup_pre_ping(void) { update_last_seen(); #ifdef USE_YAOURT if (yaourt_event_wait(EXAMSG_CSUPD_ID, "sup_pre_ping") != 0) self_view_changed = true; #endif if (self_view_changed || other_view_changed) { exa_nodeset_t new_clique; bool clique_changed; exa_nodeid_t coord; __trace("RECALCULATING CLIQUE"); sup_clique_compute(&cluster, &new_clique); clique_changed = !exa_nodeset_equals(&new_clique, &self->view.clique); if (clique_changed) { exa_nodeset_copy(&self->view.clique, &new_clique); coord = exa_nodeset_first(&self->view.clique); if (coord != self->view.coord) { __trace("new coord: %u", coord); self->view.coord = coord; } } #ifdef DEBUG { char clique_str[EXA_MAX_NODES_NUMBER + 1]; exa_nodeset_to_bin(&self->view.clique, clique_str); __trace("Clique: %s %s", clique_str, clique_changed ? "CHANGED" : ""); } #endif } if (self_view_changed || other_view_changed) { __trace("*** SUP_MSHIP_CHANGE ***"); set_state(SUP_STATE_CHANGE); } #ifdef WITH_TRACE dump_view(0); #endif }
/** * Commit the previously accepted clique. */ static void commit_clique(void) { #ifdef DEBUG char clique_str[EXA_MAX_NODES_NUMBER + 1]; exa_nodeset_to_bin(&accepted_clique, clique_str); __debug("@@@ delivering membership %u:%s to Evmgr", self->view.accepted, clique_str); #endif EXA_ASSERT(self_sees(self)); sup_deliver(self->view.accepted, &accepted_clique); set_state(SUP_STATE_COMMIT); self->view.committed = self->view.accepted; }
/** * Dump our view of the cluster in the logs. */ static void dump_view(int sig) { exa_nodeid_t node_id; char known_str[EXA_MAX_NODES_NUMBER + 1]; if (sig) __debug("got signal %d, dumping view", sig); __debug("incarnation: %hu", self->incarnation); exa_nodeset_to_bin(&cluster.known_nodes, known_str); __debug("num_nodes: %u known_nodes: %s", cluster.num_nodes, known_str); for (node_id = 0; node_id < EXA_MAX_NODES_NUMBER; node_id++) if (exa_nodeset_contains(&cluster.known_nodes, node_id)) dump_node(sup_cluster_node(&cluster, node_id)); }