Handle all CLUSTER_REDIR_ error code when verifying script. (#12707)
Clarify the errors related to the cluster mode in the script, return the command that encountered an execution error along with the specific error message. --------- Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
This commit is contained in:
parent
28b6155ba5
commit
282b82e9d2
15
src/script.c
15
src/script.c
@ -437,7 +437,22 @@ static int scriptVerifyClusterState(scriptRunCtx *run_ctx, client *c, client *or
|
|||||||
} else if (error_code == CLUSTER_REDIR_DOWN_STATE) {
|
} else if (error_code == CLUSTER_REDIR_DOWN_STATE) {
|
||||||
*err = sdsnew("Script attempted to execute a command while the "
|
*err = sdsnew("Script attempted to execute a command while the "
|
||||||
"cluster is down");
|
"cluster is down");
|
||||||
|
} else if (error_code == CLUSTER_REDIR_CROSS_SLOT) {
|
||||||
|
*err = sdscatfmt(sdsempty(),
|
||||||
|
"Command '%S' in script attempted to access keys that don't hash to the same slot",
|
||||||
|
c->cmd->fullname);
|
||||||
|
} else if (error_code == CLUSTER_REDIR_UNSTABLE) {
|
||||||
|
/* The request spawns multiple keys in the same slot,
|
||||||
|
* but the slot is not "stable" currently as there is
|
||||||
|
* a migration or import in progress. */
|
||||||
|
*err = sdscatfmt(sdsempty(),
|
||||||
|
"Unable to execute command '%S' in script "
|
||||||
|
"because undeclared keys were accessed during rehashing of the slot",
|
||||||
|
c->cmd->fullname);
|
||||||
|
} else if (error_code == CLUSTER_REDIR_DOWN_UNBOUND) {
|
||||||
|
*err = sdsnew("Script attempted to access a slot not served");
|
||||||
} else {
|
} else {
|
||||||
|
/* error_code == CLUSTER_REDIR_MOVED || error_code == CLUSTER_REDIR_ASK */
|
||||||
*err = sdsnew("Script attempted to access a non local key in a "
|
*err = sdsnew("Script attempted to access a non local key in a "
|
||||||
"cluster node");
|
"cluster node");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user