Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call makeObjectShared to normalize a shared object into a true shared object #1566

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ void configSetCommand(client *c) {
err:
if (deny_loading_error) {
/* We give the loading error precedence because it may be handled by clients differently, unlike a plain -ERR. */
addReplyErrorObject(c, shared.loadingerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.loadingerr_compat : shared.loadingerr);
} else if (invalid_arg_name) {
addReplyErrorFormat(c, "Unknown option or number of arguments for CONFIG SET - '%s'", invalid_arg_name);
} else if (errstr) {
Expand Down
6 changes: 3 additions & 3 deletions src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,11 @@ void shutdownCommand(client *c) {
if (server.busy_module_yield_flags && server.busy_module_yield_reply) {
addReplyErrorFormat(c, "-BUSY %s", server.busy_module_yield_reply);
} else if (server.busy_module_yield_flags) {
addReplyErrorObject(c, shared.slowmoduleerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowmoduleerr_compat : shared.slowmoduleerr);
} else if (scriptIsEval()) {
addReplyErrorObject(c, shared.slowevalerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowevalerr_compat : shared.slowevalerr);
} else {
addReplyErrorObject(c, shared.slowscripterr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowscripterr_compat : shared.slowscripterr);
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void debugCommand(client *c) {
if (getPositiveLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != C_OK) return;

if (server.loading || server.async_loading) {
addReplyErrorObject(c, shared.loadingerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.loadingerr_compat : shared.loadingerr);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ int functionsUnregisterEngine(const char *engine_name) {
*/
void functionStatsCommand(client *c) {
if (scriptIsRunning() && scriptIsEval()) {
addReplyErrorObject(c, shared.slowevalerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowevalerr_compat : shared.slowevalerr);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ void scriptKill(client *c, int is_eval) {
}
if (is_eval && !(curr_run_ctx->flags & SCRIPT_EVAL_MODE)) {
/* Kill a function with 'SCRIPT KILL' is not allow */
addReplyErrorObject(c, shared.slowscripterr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowscripterr_compat : shared.slowscripterr);
return;
}
if (!is_eval && (curr_run_ctx->flags & SCRIPT_EVAL_MODE)) {
/* Kill an eval with 'FUNCTION KILL' is not allow */
addReplyErrorObject(c, shared.slowevalerr);
addReplyErrorObject(c, server.extended_redis_compat ? shared.slowevalerr_compat : shared.slowevalerr);
return;
}
curr_run_ctx->flags |= SCRIPT_KILLED;
Expand Down
260 changes: 144 additions & 116 deletions src/server.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ struct sharedObjectsStruct {
robj *ok, *err, *emptybulk, *czero, *cone, *pong, *space, *queued, *null[4], *nullarray[4], *emptymap[4],
*emptyset[4], *emptyarray, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr, *outofrangeerr, *noscripterr,
*loadingerr, *slowevalerr, *slowscripterr, *slowmoduleerr, *bgsaveerr, *primarydownerr, *roreplicaerr,
*loadingerr_compat, *slowevalerr_compat, *slowscripterr_compat, *slowmoduleerr_compat, *bgsaveerr_compat,
*execaborterr, *noautherr, *noreplicaserr, *busykeyerr, *oomerr, *plus, *messagebulk, *pmessagebulk,
*subscribebulk, *unsubscribebulk, *psubscribebulk, *punsubscribebulk, *del, *unlink, *rpop, *lpop, *lpush,
*rpoplpush, *lmove, *blmove, *zpopmin, *zpopmax, *emptyscan, *multi, *exec, *left, *right, *hset, *srem,
Expand Down
Loading