Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9e6155f4
Commit
9e6155f4
authored
Feb 12, 2015
by
antirez
Browse files
Extend memory unit support in CONFIG SET.
Related to PR #2357.
parent
304aa59c
Changes
1
Show whitespace changes
Inline
Side-by-side
src/config.c
View file @
9e6155f4
...
...
@@ -609,6 +609,7 @@ void loadServerConfig(char *filename, char *options) {
void
configSetCommand
(
redisClient
*
c
)
{
robj
*
o
;
long
long
ll
;
int
err
;
redisAssertWithInfo
(
c
,
c
->
argv
[
2
],
sdsEncodedObject
(
c
->
argv
[
2
]));
redisAssertWithInfo
(
c
,
c
->
argv
[
3
],
sdsEncodedObject
(
c
->
argv
[
3
]));
o
=
c
->
argv
[
3
];
...
...
@@ -628,7 +629,6 @@ void configSetCommand(redisClient *c) {
zfree
(
server
.
masterauth
);
server
.
masterauth
=
((
char
*
)
o
->
ptr
)[
0
]
?
zstrdup
(
o
->
ptr
)
:
NULL
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"maxmemory"
))
{
int
err
;
ll
=
memtoll
(
o
->
ptr
,
&
err
);
if
(
err
||
ll
<
0
)
goto
badfmt
;
server
.
maxmemory
=
ll
;
...
...
@@ -852,7 +852,6 @@ void configSetCommand(redisClient *c) {
* whole configuration string or accept it all, even if a single
* error in a single client class is present. */
for
(
j
=
0
;
j
<
vlen
;
j
++
)
{
char
*
eptr
;
long
val
;
if
((
j
%
4
)
==
0
)
{
...
...
@@ -861,8 +860,8 @@ void configSetCommand(redisClient *c) {
goto
badfmt
;
}
}
else
{
val
=
str
toll
(
v
[
j
],
&
e
ptr
,
10
);
if
(
e
ptr
[
0
]
!=
'\0'
||
val
<
0
)
{
val
=
mem
toll
(
v
[
j
],
&
e
rr
);
if
(
e
rr
||
val
<
0
)
{
sdsfreesplitres
(
v
,
vlen
);
goto
badfmt
;
}
...
...
@@ -896,7 +895,8 @@ void configSetCommand(redisClient *c) {
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<=
0
)
goto
badfmt
;
server
.
repl_timeout
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"repl-backlog-size"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<=
0
)
goto
badfmt
;
ll
=
memtoll
(
o
->
ptr
,
&
err
);
if
(
err
||
ll
<
0
)
goto
badfmt
;
resizeReplicationBacklog
(
ll
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"repl-backlog-ttl"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
...
...
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