Unverified Commit 282b82e9 authored by Chen Tianjie's avatar Chen Tianjie Committed by GitHub
Browse files

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: default avatarMadelyn Olson <madelyneolson@gmail.com>
parent 28b6155b
...@@ -437,7 +437,22 @@ static int scriptVerifyClusterState(scriptRunCtx *run_ctx, client *c, client *or ...@@ -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");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment