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
549b8b99
Commit
549b8b99
authored
Jul 03, 2018
by
antirez
Browse files
Improve style of PR #5084.
parent
526b30a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
549b8b99
...
@@ -860,13 +860,19 @@ int clientsCronResizeQueryBuffer(client *c) {
...
@@ -860,13 +860,19 @@ int clientsCronResizeQueryBuffer(client *c) {
* cycle. */
* cycle. */
c
->
querybuf_peak
=
0
;
c
->
querybuf_peak
=
0
;
/* Clients representing masters also use a "pending query buffer" that
* is the yet not applied part of the stream we are reading. Such buffer
* also needs resizing from time to time, otherwise after a very large
* transfer (a huge value or a big MIGRATE operation) it will keep using
* a lot of memory. */
if
(
c
->
flags
&
CLIENT_MASTER
)
{
if
(
c
->
flags
&
CLIENT_MASTER
)
{
/* There are two conditions to resize the pending query buffer:
/* There are two conditions to resize the pending query buffer:
* 1) Pending Query buffer is > LIMIT_PENDING_QUERYBUF.
* 1) Pending Query buffer is > LIMIT_PENDING_QUERYBUF.
* 2)
u
sed length is smaller than pending_querybuf_size/2 */
* 2)
U
sed length is smaller than pending_querybuf_size/2 */
size_t
pending_querybuf_size
=
sdsAllocSize
(
c
->
pending_querybuf
);
size_t
pending_querybuf_size
=
sdsAllocSize
(
c
->
pending_querybuf
);
if
(
pending_querybuf_size
>
LIMIT_PENDING_QUERYBUF
&&
if
(
pending_querybuf_size
>
LIMIT_PENDING_QUERYBUF
&&
sdslen
(
c
->
pending_querybuf
)
<
(
pending_querybuf_size
>>
1
)){
sdslen
(
c
->
pending_querybuf
)
<
(
pending_querybuf_size
/
2
))
{
c
->
pending_querybuf
=
sdsRemoveFreeSpace
(
c
->
pending_querybuf
);
c
->
pending_querybuf
=
sdsRemoveFreeSpace
(
c
->
pending_querybuf
);
}
}
}
}
...
...
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