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
1ccc270a
Commit
1ccc270a
authored
Nov 18, 2019
by
antirez
Browse files
Expire cycle: make expire effort configurable.
parent
84b01f63
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
1ccc270a
...
@@ -256,7 +256,7 @@ void loadServerConfigFromString(char *config) {
...
@@ -256,7 +256,7 @@ void loadServerConfigFromString(char *config) {
for
(
configYesNo
*
config
=
configs_yesno
;
config
->
name
!=
NULL
;
config
++
)
{
for
(
configYesNo
*
config
=
configs_yesno
;
config
->
name
!=
NULL
;
config
++
)
{
if
((
!
strcasecmp
(
argv
[
0
],
config
->
name
)
||
if
((
!
strcasecmp
(
argv
[
0
],
config
->
name
)
||
(
config
->
alias
&&
!
strcasecmp
(
argv
[
0
],
config
->
alias
)))
&&
(
config
->
alias
&&
!
strcasecmp
(
argv
[
0
],
config
->
alias
)))
&&
(
argc
==
2
))
(
argc
==
2
))
{
{
if
((
*
(
config
->
config
)
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
if
((
*
(
config
->
config
)
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
...
@@ -580,6 +580,14 @@ void loadServerConfigFromString(char *config) {
...
@@ -580,6 +580,14 @@ void loadServerConfigFromString(char *config) {
err
=
"active-defrag-max-scan-fields must be positive"
;
err
=
"active-defrag-max-scan-fields must be positive"
;
goto
loaderr
;
goto
loaderr
;
}
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"active-expire-effort"
)
&&
argc
==
2
)
{
server
.
active_expire_effort
=
atoi
(
argv
[
1
]);
if
(
server
.
active_expire_effort
<
1
||
server
.
active_expire_effort
>
10
)
{
err
=
"active-expire-effort must be between 1 and 10"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-entries"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-entries"
)
&&
argc
==
2
)
{
server
.
hash_max_ziplist_entries
=
memtoll
(
argv
[
1
],
NULL
);
server
.
hash_max_ziplist_entries
=
memtoll
(
argv
[
1
],
NULL
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-value"
)
&&
argc
==
2
)
{
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"hash-max-ziplist-value"
)
&&
argc
==
2
)
{
...
@@ -1165,6 +1173,8 @@ void configSetCommand(client *c) {
...
@@ -1165,6 +1173,8 @@ void configSetCommand(client *c) {
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
,
1
,
99
)
{
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
,
1
,
99
)
{
}
config_set_numerical_field
(
}
config_set_numerical_field
(
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
,
1
,
LONG_MAX
)
{
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
,
1
,
LONG_MAX
)
{
}
config_set_numerical_field
(
"active-expire-effort"
,
server
.
active_expire_effort
,
1
,
10
)
{
}
config_set_numerical_field
(
}
config_set_numerical_field
(
"auto-aof-rewrite-percentage"
,
server
.
aof_rewrite_perc
,
0
,
INT_MAX
){
"auto-aof-rewrite-percentage"
,
server
.
aof_rewrite_perc
,
0
,
INT_MAX
){
}
config_set_numerical_field
(
}
config_set_numerical_field
(
...
@@ -1478,6 +1488,7 @@ void configGetCommand(client *c) {
...
@@ -1478,6 +1488,7 @@ void configGetCommand(client *c) {
config_get_numerical_field
(
"active-defrag-cycle-min"
,
server
.
active_defrag_cycle_min
);
config_get_numerical_field
(
"active-defrag-cycle-min"
,
server
.
active_defrag_cycle_min
);
config_get_numerical_field
(
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
);
config_get_numerical_field
(
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
);
config_get_numerical_field
(
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
);
config_get_numerical_field
(
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
);
config_get_numerical_field
(
"active-expire-effort"
,
server
.
active_expire_effort
);
config_get_numerical_field
(
"auto-aof-rewrite-percentage"
,
config_get_numerical_field
(
"auto-aof-rewrite-percentage"
,
server
.
aof_rewrite_perc
);
server
.
aof_rewrite_perc
);
config_get_numerical_field
(
"auto-aof-rewrite-min-size"
,
config_get_numerical_field
(
"auto-aof-rewrite-min-size"
,
...
@@ -2327,6 +2338,7 @@ int rewriteConfig(char *path) {
...
@@ -2327,6 +2338,7 @@ int rewriteConfig(char *path) {
rewriteConfigNumericalOption
(
state
,
"active-defrag-cycle-min"
,
server
.
active_defrag_cycle_min
,
CONFIG_DEFAULT_DEFRAG_CYCLE_MIN
);
rewriteConfigNumericalOption
(
state
,
"active-defrag-cycle-min"
,
server
.
active_defrag_cycle_min
,
CONFIG_DEFAULT_DEFRAG_CYCLE_MIN
);
rewriteConfigNumericalOption
(
state
,
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
,
CONFIG_DEFAULT_DEFRAG_CYCLE_MAX
);
rewriteConfigNumericalOption
(
state
,
"active-defrag-cycle-max"
,
server
.
active_defrag_cycle_max
,
CONFIG_DEFAULT_DEFRAG_CYCLE_MAX
);
rewriteConfigNumericalOption
(
state
,
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
,
CONFIG_DEFAULT_DEFRAG_MAX_SCAN_FIELDS
);
rewriteConfigNumericalOption
(
state
,
"active-defrag-max-scan-fields"
,
server
.
active_defrag_max_scan_fields
,
CONFIG_DEFAULT_DEFRAG_MAX_SCAN_FIELDS
);
rewriteConfigNumericalOption
(
state
,
"active-expire-effort"
,
server
.
active_expire_effort
,
CONFIG_DEFAULT_ACTIVE_EXPIRE_EFFORT
);
rewriteConfigYesNoOption
(
state
,
"appendonly"
,
server
.
aof_enabled
,
0
);
rewriteConfigYesNoOption
(
state
,
"appendonly"
,
server
.
aof_enabled
,
0
);
rewriteConfigStringOption
(
state
,
"appendfilename"
,
server
.
aof_filename
,
CONFIG_DEFAULT_AOF_FILENAME
);
rewriteConfigStringOption
(
state
,
"appendfilename"
,
server
.
aof_filename
,
CONFIG_DEFAULT_AOF_FILENAME
);
rewriteConfigEnumOption
(
state
,
"appendfsync"
,
server
.
aof_fsync
,
aof_fsync_enum
,
CONFIG_DEFAULT_AOF_FSYNC
);
rewriteConfigEnumOption
(
state
,
"appendfsync"
,
server
.
aof_fsync
,
aof_fsync_enum
,
CONFIG_DEFAULT_AOF_FSYNC
);
...
...
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