mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 23:31:03 +00:00
Cluster Manager: code cleanup
This commit is contained in:
parent
6e9864fe0d
commit
2593fb9c0c
@ -3413,8 +3413,8 @@ cleanup:
|
|||||||
/* Wait until the cluster configuration is consistent. */
|
/* Wait until the cluster configuration is consistent. */
|
||||||
static void clusterManagerWaitForClusterJoin(void) {
|
static void clusterManagerWaitForClusterJoin(void) {
|
||||||
printf("Waiting for the cluster to join\n");
|
printf("Waiting for the cluster to join\n");
|
||||||
int counter = 0,
|
int counter = 0,
|
||||||
check_after = CLUSTER_JOIN_CHECK_AFTER +
|
check_after = CLUSTER_JOIN_CHECK_AFTER +
|
||||||
(int)(listLength(cluster_manager.nodes) * 0.15f);
|
(int)(listLength(cluster_manager.nodes) * 0.15f);
|
||||||
while(!clusterManagerIsConfigConsistent()) {
|
while(!clusterManagerIsConfigConsistent()) {
|
||||||
printf(".");
|
printf(".");
|
||||||
@ -3434,11 +3434,11 @@ static void clusterManagerWaitForClusterJoin(void) {
|
|||||||
char *node_ip = NULL;
|
char *node_ip = NULL;
|
||||||
int node_port = 0, node_bus_port = 0;
|
int node_port = 0, node_bus_port = 0;
|
||||||
list *from = (list *) dictGetVal(entry);
|
list *from = (list *) dictGetVal(entry);
|
||||||
if (parseClusterNodeAddress(nodeaddr, &node_ip,
|
if (parseClusterNodeAddress(nodeaddr, &node_ip,
|
||||||
&node_port, &node_bus_port) && node_bus_port) {
|
&node_port, &node_bus_port) && node_bus_port) {
|
||||||
clusterManagerLogErr(" - The port %d of node %s may "
|
clusterManagerLogErr(" - The port %d of node %s may "
|
||||||
"be unreachable from:\n",
|
"be unreachable from:\n",
|
||||||
node_bus_port, node_ip);
|
node_bus_port, node_ip);
|
||||||
} else {
|
} else {
|
||||||
clusterManagerLogErr(" - Node %s may be unreachable "
|
clusterManagerLogErr(" - Node %s may be unreachable "
|
||||||
"from:\n", nodeaddr);
|
"from:\n", nodeaddr);
|
||||||
@ -3873,12 +3873,12 @@ static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
|
|||||||
char *lines = reply->str, *p, *line;
|
char *lines = reply->str, *p, *line;
|
||||||
while ((p = strstr(lines, "\n")) != NULL) {
|
while ((p = strstr(lines, "\n")) != NULL) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
line = lines;
|
line = lines;
|
||||||
lines = p + 1;
|
lines = p + 1;
|
||||||
char *nodename = NULL, *addr = NULL, *flags = NULL, *link_status = NULL;
|
char *nodename = NULL, *addr = NULL, *flags = NULL, *link_status = NULL;
|
||||||
while ((p = strchr(line, ' ')) != NULL) {
|
while ((p = strchr(line, ' ')) != NULL) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
char *token = line;
|
char *token = line;
|
||||||
line = p + 1;
|
line = p + 1;
|
||||||
if (i == 0) nodename = token;
|
if (i == 0) nodename = token;
|
||||||
@ -3889,12 +3889,10 @@ static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (i == 7) link_status = line;
|
if (i == 7) link_status = line;
|
||||||
|
if (nodename == NULL || addr == NULL || flags == NULL ||
|
||||||
if (nodename == NULL || addr == NULL || flags == NULL ||
|
link_status == NULL) continue;
|
||||||
link_status == NULL)
|
|
||||||
continue;
|
|
||||||
if (strstr(flags, "myself") != NULL) continue;
|
if (strstr(flags, "myself") != NULL) continue;
|
||||||
int disconnected = ((strstr(flags, "disconnected") != NULL) ||
|
int disconnected = ((strstr(flags, "disconnected") != NULL) ||
|
||||||
(strstr(link_status, "disconnected")));
|
(strstr(link_status, "disconnected")));
|
||||||
int handshaking = (strstr(flags, "handshake") != NULL);
|
int handshaking = (strstr(flags, "handshake") != NULL);
|
||||||
if (disconnected || handshaking) {
|
if (disconnected || handshaking) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user