mirror of
https://github.com/fluencelabs/redis
synced 2025-05-12 02:37:11 +00:00
Merge pull request #6401 from valentinogeron/fix-discard-during-oom
DISCARD should not fail during OOM
This commit is contained in:
commit
f3aaf2b4d8
@ -3412,7 +3412,7 @@ int processCommand(client *c) {
|
||||
* is in MULTI/EXEC context? Error. */
|
||||
if (out_of_memory &&
|
||||
(c->cmd->flags & CMD_DENYOOM ||
|
||||
(c->flags & CLIENT_MULTI && c->cmd->proc != execCommand))) {
|
||||
(c->flags & CLIENT_MULTI && c->cmd->proc != execCommand && c->cmd->proc != discardCommand))) {
|
||||
flagTransaction(c);
|
||||
addReply(c, shared.oomerr);
|
||||
return C_OK;
|
||||
|
@ -306,4 +306,18 @@ start_server {tags {"multi"}} {
|
||||
}
|
||||
close_replication_stream $repl
|
||||
}
|
||||
|
||||
test {DISCARD should not fail during OOM} {
|
||||
set rd [redis_deferring_client]
|
||||
$rd config set maxmemory 1
|
||||
assert {[$rd read] eq {OK}}
|
||||
r multi
|
||||
catch {r set x 1} e
|
||||
assert_match {OOM*} $e
|
||||
r discard
|
||||
$rd config set maxmemory 0
|
||||
assert {[$rd read] eq {OK}}
|
||||
$rd close
|
||||
r ping
|
||||
} {PONG}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user