Checks whether the node is empty. Node is considered not-empty if it has * some key or if it already knows other nodes */
| 2658 | /* Checks whether the node is empty. Node is considered not-empty if it has |
| 2659 | * some key or if it already knows other nodes */ |
| 2660 | static int clusterManagerNodeIsEmpty(clusterManagerNode *node, char **err) { |
| 2661 | redisReply *info = clusterManagerGetNodeRedisInfo(node, err); |
| 2662 | int is_empty = 1; |
| 2663 | if (info == NULL) return 0; |
| 2664 | if (strstr(info->str, "db0:") != NULL) { |
| 2665 | is_empty = 0; |
| 2666 | goto result; |
| 2667 | } |
| 2668 | freeReplyObject(info); |
| 2669 | info = CLUSTER_MANAGER_COMMAND(node, "CLUSTER INFO"); |
| 2670 | if (err != NULL) *err = NULL; |
| 2671 | if (!clusterManagerCheckRedisReply(node, info, err)) { |
| 2672 | is_empty = 0; |
| 2673 | goto result; |
| 2674 | } |
| 2675 | long known_nodes = getLongInfoField(info->str, "cluster_known_nodes"); |
| 2676 | is_empty = (known_nodes == 1); |
| 2677 | result: |
| 2678 | freeReplyObject(info); |
| 2679 | return is_empty; |
| 2680 | } |
| 2681 | |
| 2682 | static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes, |
| 2683 | int ip_count) |
no test coverage detected