mirror of
https://github.com/redis/redis.git
synced 2026-06-03 22:01:02 -04:00
Log node address when ASM starts (#15056)
Log source/destination address on import/migrate start events for easier debugging.
This commit is contained in:
parent
3bcfbbe92a
commit
eb74450fca
1 changed files with 17 additions and 3 deletions
|
|
@ -1057,13 +1057,27 @@ void clusterMigrationCommand(client *c) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Returns the address of the node in the format "ip:port". */
|
||||
static const char *getNodeAddressStr(const char *node_id, int len) {
|
||||
serverAssert(node_id != NULL);
|
||||
static char buf[NET_HOST_PORT_STR_LEN];
|
||||
|
||||
clusterNode *n = clusterLookupNode(node_id, len);
|
||||
char *ip = n ? clusterNodeIp(n) : "?";
|
||||
int port = n ? (server.tls_replication ? clusterNodeTlsPort(n) :
|
||||
clusterNodeTcpPort(n)) : 0;
|
||||
formatAddr(buf, sizeof(buf), ip, port);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Log a human-readable message for ASM task lifecycle events. */
|
||||
void asmLogTaskEvent(asmTask *task, int event) {
|
||||
sds str = slotRangeArrayToString(task->slots);
|
||||
|
||||
switch (event) {
|
||||
case ASM_EVENT_IMPORT_STARTED:
|
||||
serverLog(LL_NOTICE, "Import task %s started for slots: %s", task->id, str);
|
||||
serverLog(LL_NOTICE, "Import task %s started for slots: %s, source address: %s",
|
||||
task->id, str, getNodeAddressStr(task->source, CLUSTER_NAMELEN));
|
||||
break;
|
||||
case ASM_EVENT_IMPORT_FAILED:
|
||||
serverLog(LL_NOTICE, "Import task %s failed for slots: %s", task->id, str);
|
||||
|
|
@ -1076,8 +1090,8 @@ void asmLogTaskEvent(asmTask *task, int event) {
|
|||
task->id, str, getKeyCountInSlotRangeArray(task->slots));
|
||||
break;
|
||||
case ASM_EVENT_MIGRATE_STARTED:
|
||||
serverLog(LL_NOTICE, "Migrate task %s started for slots: %s (number of keys at start: %llu)",
|
||||
task->id, str, getKeyCountInSlotRangeArray(task->slots));
|
||||
serverLog(LL_NOTICE, "Migrate task %s started for slots: %s, destination address: %s, (number of keys at start: %llu)",
|
||||
task->id, str, getNodeAddressStr(task->dest, CLUSTER_NAMELEN), getKeyCountInSlotRangeArray(task->slots));
|
||||
break;
|
||||
case ASM_EVENT_MIGRATE_FAILED:
|
||||
serverLog(LL_NOTICE, "Migrate task %s failed for slots: %s", task->id, str);
|
||||
|
|
|
|||
Loading…
Reference in a new issue