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
a317f55d
Unverified
Commit
a317f55d
authored
Jul 16, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jul 16, 2018
Browse files
Merge pull request #5131 from soloestoy/optimize-xdel
Streams: free lp if all elements are deleted
parents
185e0d9c
c9324f81
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
a317f55d
...
@@ -705,10 +705,15 @@ void streamIteratorRemoveEntry(streamIterator *si, streamID *current) {
...
@@ -705,10 +705,15 @@ void streamIteratorRemoveEntry(streamIterator *si, streamID *current) {
/* Change the valid/deleted entries count in the master entry. */
/* Change the valid/deleted entries count in the master entry. */
unsigned
char
*
p
=
lpFirst
(
lp
);
unsigned
char
*
p
=
lpFirst
(
lp
);
aux
=
lpGetInteger
(
p
);
aux
=
lpGetInteger
(
p
);
if
(
aux
==
1
)
{
lpFree
(
lp
);
raxRemove
(
si
->
stream
->
rax
,
si
->
ri
.
key
,
si
->
ri
.
key_len
,
NULL
);
}
else
{
lp
=
lpReplaceInteger
(
lp
,
&
p
,
aux
-
1
);
lp
=
lpReplaceInteger
(
lp
,
&
p
,
aux
-
1
);
p
=
lpNext
(
lp
,
p
);
/* Seek deleted field. */
p
=
lpNext
(
lp
,
p
);
/* Seek deleted field. */
aux
=
lpGetInteger
(
p
);
aux
=
lpGetInteger
(
p
);
lp
=
lpReplaceInteger
(
lp
,
&
p
,
aux
+
1
);
lp
=
lpReplaceInteger
(
lp
,
&
p
,
aux
+
1
);
}
/* Update the number of entries counter. */
/* Update the number of entries counter. */
si
->
stream
->
length
--
;
si
->
stream
->
length
--
;
...
...
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