Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ build-debug/
build-release/
cmake-build-debug/
cmake-build-release/
ignore/
27 changes: 24 additions & 3 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,17 @@ void setClusterNodeToInboundClusterLink(clusterNode *node, clusterLink *link) {
serverAssert(!node->inbound_link);
node->inbound_link = link;
link->node = node;
if (server.verbosity <= LL_VERBOSE) {
char ip[NET_IP_STR_LEN];
int port;
if (connAddrPeerName(link->conn, ip, sizeof(ip), &port) != -1) {
serverLog(LL_VERBOSE, "Bound cluster node %.40s (%s) to connection of client %s:%d",
node->name, node->human_nodename, ip, port);
} else {
serverLog(LL_VERBOSE, "Error resolving the inbound connection address of node %.40s (%s)",
node->name, node->human_nodename);
}
}
}

static void clusterConnAcceptHandler(connection *conn) {
Expand Down Expand Up @@ -3833,11 +3844,21 @@ int clusterProcessPacket(clusterLink *link) {
clusterSendPing(link, CLUSTERMSG_TYPE_PONG);
}

if (server.verbosity <= LL_DEBUG) {
char ip[NET_IP_STR_LEN];
int port;
if (connAddrPeerName(link->conn, ip, sizeof(ip), &port) != -1) {
serverLog(LL_DEBUG, "%s packet received from: %.40s (%s) from client: %s:%d",
clusterGetMessageTypeString(type),
clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link),
ip, port);
} else {
serverLog(LL_DEBUG, "Error resolving the address of packet sender %.40s (%s)",
clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link));
}
}
/* PING, PONG, MEET: process config information. */
if (type == CLUSTERMSG_TYPE_PING || type == CLUSTERMSG_TYPE_PONG || type == CLUSTERMSG_TYPE_MEET) {
serverLog(LL_DEBUG, "%s packet received: %.40s", clusterGetMessageTypeString(type),
clusterLinkGetNodeName(link));

if (sender && nodeInMeetState(sender)) {
/* Once we get a response for MEET from the sender, we can stop sending more MEET. */
sender->flags &= ~CLUSTER_NODE_MEET;
Expand Down
3 changes: 3 additions & 0 deletions tests/support/cluster_util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ proc cluster_setup {masters replicas node_count slot_allocator replica_allocator
for {set i 0} {$i < $node_count} {incr i} {
R $i CLUSTER SET-CONFIG-EPOCH $config_epoch
incr config_epoch
# Make it easier to understand how the server interacts with
# other nodes when reading the server logs.
R $i CONFIG SET cluster-announce-human-nodename "R$i"
}

# Have all nodes meet
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/cluster/manual-failover.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,21 @@ start_cluster 3 1 {tags {external:skip cluster}} {
# verify we print the logs.

# Both importing slots and migrating slots are move to R3.
set pattern "*Failover occurred in migration source. Update importing source for slot 0 to node $R3_nodeid () in shard $R3_shardid*"
set pattern "*Failover occurred in migration source. Update importing source for slot 0 to node $R3_nodeid * in shard $R3_shardid*"
verify_log_message -1 $pattern $loglines1
set pattern "*Failover occurred in migration target. Slot 5462 is now being migrated to node $R3_nodeid () in shard $R3_shardid*"
set pattern "*Failover occurred in migration target. Slot 5462 is now being migrated to node $R3_nodeid * in shard $R3_shardid*"
verify_log_message -1 $pattern $loglines1

# Both slots are move to R3.
set R0_slots 5462
set pattern "*A failover occurred in shard $R3_shardid; node $R0_nodeid () lost $R0_slots slot(s) and failed over to node $R3_nodeid*"
set pattern "*A failover occurred in shard $R3_shardid; node $R0_nodeid * lost $R0_slots slot(s) and failed over to node $R3_nodeid*"
verify_log_message -1 $pattern $loglines1
verify_log_message -2 $pattern $loglines2

# Both importing slots and migrating slots are move to R3.
set pattern "*A failover occurred in migration source. Update importing source of 1 slot(s) to node $R3_nodeid () in shard $R3_shardid*"
set pattern "*A failover occurred in migration source. Update importing source of 1 slot(s) to node $R3_nodeid * in shard $R3_shardid*"
verify_log_message -1 $pattern $loglines1
set pattern "*A failover occurred in migration target. Update migrating target of 1 slot(s) to node $R3_nodeid () in shard $R3_shardid*"
set pattern "*A failover occurred in migration target. Update migrating target of 1 slot(s) to node $R3_nodeid * in shard $R3_shardid*"
verify_log_message -1 $pattern $loglines1

R 1 debug disable-cluster-reconnection 0
Expand Down
Loading