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
80755722
Commit
80755722
authored
Jan 11, 2018
by
antirez
Browse files
New config options about protocol prefixed with "proto".
Related to #4568.
parent
c2fa4b8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
80755722
...
@@ -328,9 +328,9 @@ void loadServerConfigFromString(char *config) {
...
@@ -328,9 +328,9 @@ void loadServerConfigFromString(char *config) {
err
=
"maxmemory-samples must be 1 or greater"
;
err
=
"maxmemory-samples must be 1 or greater"
;
goto
loaderr
;
goto
loaderr
;
}
}
}
else
if
((
!
strcasecmp
(
argv
[
0
],
"max-bulk-len"
))
&&
argc
==
2
)
{
}
else
if
((
!
strcasecmp
(
argv
[
0
],
"
proto-
max-bulk-len"
))
&&
argc
==
2
)
{
server
.
max_bulk_len
=
memtoll
(
argv
[
1
],
NULL
);
server
.
proto_
max_bulk_len
=
memtoll
(
argv
[
1
],
NULL
);
}
else
if
((
!
strcasecmp
(
argv
[
0
],
"max-querybuf-len"
))
&&
argc
==
2
)
{
}
else
if
((
!
strcasecmp
(
argv
[
0
],
"
proto-
max-querybuf-len"
))
&&
argc
==
2
)
{
server
.
client_max_querybuf_len
=
memtoll
(
argv
[
1
],
NULL
);
server
.
client_max_querybuf_len
=
memtoll
(
argv
[
1
],
NULL
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"lfu-log-factor"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"lfu-log-factor"
)
&&
argc
==
2
)
{
server
.
lfu_log_factor
=
atoi
(
argv
[
1
]);
server
.
lfu_log_factor
=
atoi
(
argv
[
1
]);
...
@@ -1137,9 +1137,9 @@ void configSetCommand(client *c) {
...
@@ -1137,9 +1137,9 @@ void configSetCommand(client *c) {
freeMemoryIfNeeded
();
freeMemoryIfNeeded
();
}
}
}
config_set_memory_field
(
}
config_set_memory_field
(
"max-bulk-len"
,
server
.
max_bulk_len
)
{
"
proto-
max-bulk-len"
,
server
.
proto_
max_bulk_len
)
{
}
config_set_memory_field
(
}
config_set_memory_field
(
"max-querybuf-len"
,
server
.
client_max_querybuf_len
)
{
"
proto-
max-querybuf-len"
,
server
.
client_max_querybuf_len
)
{
}
config_set_memory_field
(
"repl-backlog-size"
,
ll
)
{
}
config_set_memory_field
(
"repl-backlog-size"
,
ll
)
{
resizeReplicationBacklog
(
ll
);
resizeReplicationBacklog
(
ll
);
}
config_set_memory_field
(
"auto-aof-rewrite-min-size"
,
ll
)
{
}
config_set_memory_field
(
"auto-aof-rewrite-min-size"
,
ll
)
{
...
@@ -1228,8 +1228,8 @@ void configGetCommand(client *c) {
...
@@ -1228,8 +1228,8 @@ void configGetCommand(client *c) {
/* Numerical values */
/* Numerical values */
config_get_numerical_field
(
"maxmemory"
,
server
.
maxmemory
);
config_get_numerical_field
(
"maxmemory"
,
server
.
maxmemory
);
config_get_numerical_field
(
"max-bulk-len"
,
server
.
max_bulk_len
);
config_get_numerical_field
(
"
proto-
max-bulk-len"
,
server
.
proto_
max_bulk_len
);
config_get_numerical_field
(
"max-querybuf-len"
,
server
.
client_max_querybuf_len
);
config_get_numerical_field
(
"
proto-
max-querybuf-len"
,
server
.
client_max_querybuf_len
);
config_get_numerical_field
(
"maxmemory-samples"
,
server
.
maxmemory_samples
);
config_get_numerical_field
(
"maxmemory-samples"
,
server
.
maxmemory_samples
);
config_get_numerical_field
(
"lfu-log-factor"
,
server
.
lfu_log_factor
);
config_get_numerical_field
(
"lfu-log-factor"
,
server
.
lfu_log_factor
);
config_get_numerical_field
(
"lfu-decay-time"
,
server
.
lfu_decay_time
);
config_get_numerical_field
(
"lfu-decay-time"
,
server
.
lfu_decay_time
);
...
@@ -2002,8 +2002,8 @@ int rewriteConfig(char *path) {
...
@@ -2002,8 +2002,8 @@ int rewriteConfig(char *path) {
rewriteConfigStringOption
(
state
,
"requirepass"
,
server
.
requirepass
,
NULL
);
rewriteConfigStringOption
(
state
,
"requirepass"
,
server
.
requirepass
,
NULL
);
rewriteConfigNumericalOption
(
state
,
"maxclients"
,
server
.
maxclients
,
CONFIG_DEFAULT_MAX_CLIENTS
);
rewriteConfigNumericalOption
(
state
,
"maxclients"
,
server
.
maxclients
,
CONFIG_DEFAULT_MAX_CLIENTS
);
rewriteConfigBytesOption
(
state
,
"maxmemory"
,
server
.
maxmemory
,
CONFIG_DEFAULT_MAXMEMORY
);
rewriteConfigBytesOption
(
state
,
"maxmemory"
,
server
.
maxmemory
,
CONFIG_DEFAULT_MAXMEMORY
);
rewriteConfigBytesOption
(
state
,
"max-bulk-len"
,
server
.
max_bulk_len
,
CONFIG_DEFAULT_MAX_BULK_LEN
);
rewriteConfigBytesOption
(
state
,
"
proto-
max-bulk-len"
,
server
.
proto_
max_bulk_len
,
CONFIG_DEFAULT_
PROTO_
MAX_BULK_LEN
);
rewriteConfigBytesOption
(
state
,
"max-querybuf-len"
,
server
.
client_max_querybuf_len
,
PROTO_MAX_QUERYBUF_LEN
);
rewriteConfigBytesOption
(
state
,
"
proto-
max-querybuf-len"
,
server
.
client_max_querybuf_len
,
PROTO_MAX_QUERYBUF_LEN
);
rewriteConfigEnumOption
(
state
,
"maxmemory-policy"
,
server
.
maxmemory_policy
,
maxmemory_policy_enum
,
CONFIG_DEFAULT_MAXMEMORY_POLICY
);
rewriteConfigEnumOption
(
state
,
"maxmemory-policy"
,
server
.
maxmemory_policy
,
maxmemory_policy_enum
,
CONFIG_DEFAULT_MAXMEMORY_POLICY
);
rewriteConfigNumericalOption
(
state
,
"maxmemory-samples"
,
server
.
maxmemory_samples
,
CONFIG_DEFAULT_MAXMEMORY_SAMPLES
);
rewriteConfigNumericalOption
(
state
,
"maxmemory-samples"
,
server
.
maxmemory_samples
,
CONFIG_DEFAULT_MAXMEMORY_SAMPLES
);
rewriteConfigNumericalOption
(
state
,
"lfu-log-factor"
,
server
.
lfu_log_factor
,
CONFIG_DEFAULT_LFU_LOG_FACTOR
);
rewriteConfigNumericalOption
(
state
,
"lfu-log-factor"
,
server
.
lfu_log_factor
,
CONFIG_DEFAULT_LFU_LOG_FACTOR
);
...
...
src/networking.c
View file @
80755722
...
@@ -1254,7 +1254,7 @@ int processMultibulkBuffer(client *c) {
...
@@ -1254,7 +1254,7 @@ int processMultibulkBuffer(client *c) {
}
}
ok
=
string2ll
(
c
->
querybuf
+
pos
+
1
,
newline
-
(
c
->
querybuf
+
pos
+
1
),
&
ll
);
ok
=
string2ll
(
c
->
querybuf
+
pos
+
1
,
newline
-
(
c
->
querybuf
+
pos
+
1
),
&
ll
);
if
(
!
ok
||
ll
<
0
||
ll
>
server
.
max_bulk_len
)
{
if
(
!
ok
||
ll
<
0
||
ll
>
server
.
proto_
max_bulk_len
)
{
addReplyError
(
c
,
"Protocol error: invalid bulk length"
);
addReplyError
(
c
,
"Protocol error: invalid bulk length"
);
setProtocolError
(
"invalid bulk length"
,
c
,
pos
);
setProtocolError
(
"invalid bulk length"
,
c
,
pos
);
return
C_ERR
;
return
C_ERR
;
...
...
src/server.c
View file @
80755722
...
@@ -1388,7 +1388,7 @@ void initServerConfig(void) {
...
@@ -1388,7 +1388,7 @@ void initServerConfig(void) {
server
.
active_defrag_threshold_upper
=
CONFIG_DEFAULT_DEFRAG_THRESHOLD_UPPER
;
server
.
active_defrag_threshold_upper
=
CONFIG_DEFAULT_DEFRAG_THRESHOLD_UPPER
;
server
.
active_defrag_cycle_min
=
CONFIG_DEFAULT_DEFRAG_CYCLE_MIN
;
server
.
active_defrag_cycle_min
=
CONFIG_DEFAULT_DEFRAG_CYCLE_MIN
;
server
.
active_defrag_cycle_max
=
CONFIG_DEFAULT_DEFRAG_CYCLE_MAX
;
server
.
active_defrag_cycle_max
=
CONFIG_DEFAULT_DEFRAG_CYCLE_MAX
;
server
.
max_bulk_len
=
CONFIG_DEFAULT_MAX_BULK_LEN
;
server
.
proto_
max_bulk_len
=
CONFIG_DEFAULT_
PROTO_
MAX_BULK_LEN
;
server
.
client_max_querybuf_len
=
PROTO_MAX_QUERYBUF_LEN
;
server
.
client_max_querybuf_len
=
PROTO_MAX_QUERYBUF_LEN
;
server
.
saveparams
=
NULL
;
server
.
saveparams
=
NULL
;
server
.
loading
=
0
;
server
.
loading
=
0
;
...
...
src/server.h
View file @
80755722
...
@@ -161,7 +161,7 @@ typedef long long mstime_t; /* millisecond time type. */
...
@@ -161,7 +161,7 @@ typedef long long mstime_t; /* millisecond time type. */
#define CONFIG_DEFAULT_DEFRAG_IGNORE_BYTES (100<<20)
/* don't defrag if frag overhead is below 100mb */
#define CONFIG_DEFAULT_DEFRAG_IGNORE_BYTES (100<<20)
/* don't defrag if frag overhead is below 100mb */
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MIN 25
/* 25% CPU min (at lower threshold) */
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MIN 25
/* 25% CPU min (at lower threshold) */
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MAX 75
/* 75% CPU max (at upper threshold) */
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MAX 75
/* 75% CPU max (at upper threshold) */
#define CONFIG_DEFAULT_MAX_BULK_LEN (512ll*1024*1024)
#define CONFIG_DEFAULT_
PROTO_
MAX_BULK_LEN (512ll*1024*1024)
/* Bulk request max size */
#define ACTIVE_EXPIRE_CYCLE_LOOKUPS_PER_LOOP 20
/* Loopkups per loop. */
#define ACTIVE_EXPIRE_CYCLE_LOOKUPS_PER_LOOP 20
/* Loopkups per loop. */
#define ACTIVE_EXPIRE_CYCLE_FAST_DURATION 1000
/* Microseconds */
#define ACTIVE_EXPIRE_CYCLE_FAST_DURATION 1000
/* Microseconds */
...
@@ -1133,7 +1133,7 @@ struct redisServer {
...
@@ -1133,7 +1133,7 @@ struct redisServer {
int
maxmemory_samples
;
/* Pricision of random sampling */
int
maxmemory_samples
;
/* Pricision of random sampling */
int
lfu_log_factor
;
/* LFU logarithmic counter factor. */
int
lfu_log_factor
;
/* LFU logarithmic counter factor. */
int
lfu_decay_time
;
/* LFU counter decay factor. */
int
lfu_decay_time
;
/* LFU counter decay factor. */
long
long
max_bulk_len
;
long
long
proto_
max_bulk_len
;
/* Protocol bulk length maximum size. */
/* Blocked clients */
/* Blocked clients */
unsigned
int
blocked_clients
;
/* # of clients executing a blocking cmd.*/
unsigned
int
blocked_clients
;
/* # of clients executing a blocking cmd.*/
unsigned
int
blocked_clients_by_type
[
BLOCKED_NUM
];
unsigned
int
blocked_clients_by_type
[
BLOCKED_NUM
];
...
...
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