MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterManagerSetSlot

Function clusterManagerSetSlot

app/redis-6.2.6/src/redis-cli.c:3491–3512  ·  view source on GitHub ↗

Set slot status to "importing" or "migrating" */

Source from the content-addressed store, hash-verified

3489
3490/* Set slot status to "importing" or "migrating" */
3491static int clusterManagerSetSlot(clusterManagerNode *node1,
3492 clusterManagerNode *node2,
3493 int slot, const char *status, char **err) {
3494 redisReply *reply = CLUSTER_MANAGER_COMMAND(node1, "CLUSTER "
3495 "SETSLOT %d %s %s",
3496 slot, status,
3497 (char *) node2->name);
3498 if (err != NULL) *err = NULL;
3499 if (!reply) return 0;
3500 int success = 1;
3501 if (reply->type == REDIS_REPLY_ERROR) {
3502 success = 0;
3503 if (err != NULL) {
3504 *err = zmalloc((reply->len + 1) * sizeof(char));
3505 strcpy(*err, reply->str);
3506 } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(node1, reply->str);
3507 goto cleanup;
3508 }
3509cleanup:
3510 freeReplyObject(reply);
3511 return success;
3512}
3513
3514static int clusterManagerClearSlotStatus(clusterManagerNode *node, int slot) {
3515 redisReply *reply = CLUSTER_MANAGER_COMMAND(node,

Calls 2

zmallocFunction · 0.85
freeReplyObjectFunction · 0.85

Tested by

no test coverage detected