Skip to content
Open
Changes from all 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
18 changes: 18 additions & 0 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -5533,6 +5533,24 @@ void clusterCron(void) {
}

if (update_state || server.cluster->state == CLUSTER_FAIL) clusterUpdateState();

/* Log cluster info and nodes information for better debugability of the transient cluster state */
if (server.verbosity <= LL_VERBOSE) {
run_with_period(5000) {
sds cluster_info = genClusterInfoString();
sds cluster_nodes = clusterGenNodesDescription(NULL, 0, 0);

sds infostring = sdscatprintf(sdsempty(), "\r\n# Cluster info\r\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New lines break log parsing. If someone turns on for some reason, it should still be "valid" log lines. I'm OK logging the state, but I don't think it should just be verbatim the info fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. So, it's an exception for crash report to have new lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madolson and I discussed offline. We discussed we can have a single log line with information around failed nodes rather than all the nodes.

infostring = sdscatsds(infostring, cluster_info);
infostring = sdscatprintf(infostring, "\n------ CLUSTER NODES OUTPUT ------\n");
infostring = sdscatsds(infostring, cluster_nodes);
serverLog(LL_VERBOSE, "%s", infostring);

sdsfree(cluster_info);
sdsfree(cluster_nodes);
sdsfree(infostring);
}
}
}

/* This function is called before the event handler returns to sleep for
Expand Down
Loading