mirror of https://github.com/valkey-io/valkey
support whole cluster info for INFO command in cluster section (#2876)
Allow users to more easily get cluster information. Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
This commit is contained in:
parent
3d65a4aecd
commit
04d0bba398
|
|
@ -898,7 +898,7 @@ void clusterCommand(client *c) {
|
|||
} else if (!strcasecmp(c->argv[1]->ptr, "info") && c->argc == 2) {
|
||||
/* CLUSTER INFO */
|
||||
|
||||
sds info = genClusterInfoString();
|
||||
sds info = genClusterInfoString(sdsempty());
|
||||
|
||||
/* Produce the reply protocol. */
|
||||
addReplyVerbatim(c, info, sdslen(info), "txt");
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ unsigned long getClusterConnectionsCount(void);
|
|||
int isClusterHealthy(void);
|
||||
|
||||
sds clusterGenNodesDescription(client *c, int filter, int tls_primary);
|
||||
sds genClusterInfoString(void);
|
||||
sds genClusterInfoString(sds info);
|
||||
/* handle implementation specific debug cluster commands. Return 1 if handled, 0 otherwise. */
|
||||
int handleDebugClusterCommand(client *c);
|
||||
const char **clusterDebugCommandExtendedHelp(void);
|
||||
|
|
|
|||
|
|
@ -7041,8 +7041,7 @@ void clusterCommandShards(client *c) {
|
|||
dictReleaseIterator(di);
|
||||
}
|
||||
|
||||
sds genClusterInfoString(void) {
|
||||
sds info = sdsempty();
|
||||
sds genClusterInfoString(sds info) {
|
||||
char *statestr[] = {"ok", "fail"};
|
||||
int slots_assigned = 0, slots_ok = 0, slots_pfail = 0, slots_fail = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1862,7 +1862,7 @@ __attribute__((noinline)) void logStackTrace(void *eip, int uplevel, int current
|
|||
#endif /* HAVE_BACKTRACE */
|
||||
|
||||
sds genClusterDebugString(sds infostring) {
|
||||
sds cluster_info = genClusterInfoString();
|
||||
sds cluster_info = genClusterInfoString(sdsempty());
|
||||
sds cluster_nodes = clusterGenNodesDescription(NULL, 0, 0);
|
||||
|
||||
infostring = sdscatprintf(infostring, "\r\n# Cluster info\r\n");
|
||||
|
|
|
|||
|
|
@ -6433,6 +6433,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
|
|||
"# Cluster\r\n"
|
||||
"cluster_enabled:%d\r\n",
|
||||
server.cluster_enabled);
|
||||
if (server.cluster_enabled) info = genClusterInfoString(info);
|
||||
}
|
||||
|
||||
/* Scripting engines */
|
||||
|
|
|
|||
Loading…
Reference in New Issue