mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 08:00:49 +00:00
Cluster Manager: add importing/migrating nodes to backup info
This commit is contained in:
parent
c33cb4938a
commit
93e51239ce
@ -2732,6 +2732,36 @@ static sds clusterManagerNodeGetJSON(clusterManagerNode *node,
|
||||
json = sdscatprintf(json, ",\n \"cluster_errors\": %lu",
|
||||
error_count);
|
||||
}
|
||||
if (node->migrating_count > 0 && node->migrating != NULL) {
|
||||
int i = 0;
|
||||
sds migrating = sdsempty();
|
||||
for (; i < node->migrating_count; i += 2) {
|
||||
sds slot = node->migrating[i];
|
||||
sds dest = node->migrating[i + 1];
|
||||
if (slot && dest) {
|
||||
if (sdslen(migrating) > 0) migrating = sdscat(migrating, ",");
|
||||
migrating = sdscatfmt(migrating, "\"%S\": \"%S\"", slot, dest);
|
||||
}
|
||||
}
|
||||
if (sdslen(migrating) > 0)
|
||||
json = sdscatfmt(json, ",\n \"migrating\": {%S}", migrating);
|
||||
sdsfree(migrating);
|
||||
}
|
||||
if (node->importing_count > 0 && node->importing != NULL) {
|
||||
int i = 0;
|
||||
sds importing = sdsempty();
|
||||
for (; i < node->importing_count; i += 2) {
|
||||
sds slot = node->importing[i];
|
||||
sds from = node->importing[i + 1];
|
||||
if (slot && from) {
|
||||
if (sdslen(importing) > 0) importing = sdscat(importing, ",");
|
||||
importing = sdscatfmt(importing, "\"%S\": \"%S\"", slot, from);
|
||||
}
|
||||
}
|
||||
if (sdslen(importing) > 0)
|
||||
json = sdscatfmt(json, ",\n \"importing\": {%S}", importing);
|
||||
sdsfree(importing);
|
||||
}
|
||||
json = sdscat(json, "\n }");
|
||||
sdsfree(replicate);
|
||||
sdsfree(slots);
|
||||
|
Loading…
x
Reference in New Issue
Block a user