From 68ed1292eeb2e94e527befc6fd01023db27cfd4f Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 31 Jan 2021 07:15:55 +0000 Subject: [PATCH] Fix test failure caused by allowing pings during load Former-commit-id: 569a3d9ff86f4cd74e269391ce1d582e009147ce --- src/server.cpp | 6 +++--- tests/unit/scripting.tcl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index add31b969..e5e35857d 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -689,7 +689,7 @@ struct redisCommand redisCommandTable[] = { * failure detection, and a loading server is considered to be * not available. */ {"ping",pingCommand,-1, - "ok-stale fast @connection @replication", + "ok-stale ok-loading fast @connection @replication", 0,NULL,0,0,0,0,0,0}, {"echo",echoCommand,2, @@ -3853,8 +3853,8 @@ int processCommand(client *c, int callFlags) { (c->cmd->proc == execCommand && (c->mstate.cmd_flags & CMD_DENYOOM)); int is_denystale_command = !(c->cmd->flags & CMD_STALE) || (c->cmd->proc == execCommand && (c->mstate.cmd_inv_flags & CMD_STALE)); - int is_denyloading_command = strcmp(c->cmd->name, "ping") && (!(c->cmd->flags & CMD_LOADING) || - (c->cmd->proc == execCommand && (c->mstate.cmd_inv_flags & CMD_LOADING))); + int is_denyloading_command = !(c->cmd->flags & CMD_LOADING) || + (c->cmd->proc == execCommand && (c->mstate.cmd_inv_flags & CMD_LOADING)); /* Check if the user is authenticated. This check is skipped in case * the default user is flagged as "nopass" and is active. */ diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl index fe4c5f2e3..b41956f9a 100644 --- a/tests/unit/scripting.tcl +++ b/tests/unit/scripting.tcl @@ -449,7 +449,7 @@ start_server {tags {"scripting"}} { $rd eval {redis.call('set',KEYS[1],'y'); for i=1,1500000 do redis.call('ping') end return 'ok'} 1 x $rd flush after 200 - catch {r ping} err + catch {r echo "foo"} err assert_match {BUSY*} $err $rd read set elapsed [expr [clock clicks -milliseconds]-$start] @@ -458,7 +458,7 @@ start_server {tags {"scripting"}} { $rd debug loadaof $rd flush after 200 - catch {r ping} err + catch {r echo "foo"} err assert_match {LOADING*} $err $rd read set elapsed [expr [clock clicks -milliseconds]-$start]