Set slot status to "importing" or "migrating" */
| 3489 | |
| 3490 | /* Set slot status to "importing" or "migrating" */ |
| 3491 | static 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 | } |
| 3509 | cleanup: |
| 3510 | freeReplyObject(reply); |
| 3511 | return success; |
| 3512 | } |
| 3513 | |
| 3514 | static int clusterManagerClearSlotStatus(clusterManagerNode *node, int slot) { |
| 3515 | redisReply *reply = CLUSTER_MANAGER_COMMAND(node, |
no test coverage detected