Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f3aaf2b4
Unverified
Commit
f3aaf2b4
authored
Sep 25, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Sep 25, 2019
Browse files
Merge pull request #6401 from valentinogeron/fix-discard-during-oom
DISCARD should not fail during OOM
parents
f6cf08e5
7a73b7f1
Changes
2
Show whitespace changes
Inline
Side-by-side
src/server.c
View file @
f3aaf2b4
...
@@ -3412,7 +3412,7 @@ int processCommand(client *c) {
...
@@ -3412,7 +3412,7 @@ int processCommand(client *c) {
* is in MULTI/EXEC context? Error. */
* is in MULTI/EXEC context? Error. */
if
(
out_of_memory
&&
if
(
out_of_memory
&&
(
c
->
cmd
->
flags
&
CMD_DENYOOM
||
(
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
);
flagTransaction
(
c
);
addReply
(
c
,
shared
.
oomerr
);
addReply
(
c
,
shared
.
oomerr
);
return
C_OK
;
return
C_OK
;
...
...
tests/unit/multi.tcl
View file @
f3aaf2b4
...
@@ -306,4 +306,18 @@ start_server {tags {"multi"}} {
...
@@ -306,4 +306,18 @@ start_server {tags {"multi"}} {
}
}
close_replication_stream $repl
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
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment