Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
967ae8ca
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
967ae8ca
编写于
4月 24, 2013
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Config option to turn AOF rewrite incremental fsync on/off.
上级
c735116c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
1 deletion
+23
-1
redis.conf
redis.conf
+6
-0
src/aof.c
src/aof.c
+2
-1
src/config.c
src/config.c
+13
-0
src/redis.c
src/redis.c
+1
-0
src/redis.h
src/redis.h
+1
-0
未找到文件。
redis.conf
浏览文件 @
967ae8ca
...
...
@@ -580,6 +580,12 @@ client-output-buffer-limit pubsub 32mb 8mb 60
# 100 only in environments where very low latency is required.
hz
10
# When a child rewrites the AOF file, if the following option is enabled
# the file will be fsync-ed every 32 MB of data generated. This is useful
# in order to commit the file to the disk more incrementally and avoid
# big latency spikes.
aof
-
rewrite
-
incremental
-
fsync
yes
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you
...
...
src/aof.c
浏览文件 @
967ae8ca
...
...
@@ -855,7 +855,8 @@ int rewriteAppendOnlyFile(char *filename) {
}
rioInitWithFile
(
&
aof
,
fp
);
rioSetAutoSync
(
&
aof
,
REDIS_AOF_AUTOSYNC_BYTES
);
if
(
server
.
aof_rewrite_incremental_fsync
)
rioSetAutoSync
(
&
aof
,
REDIS_AOF_AUTOSYNC_BYTES
);
for
(
j
=
0
;
j
<
server
.
dbnum
;
j
++
)
{
char
selectcmd
[]
=
"*2
\r\n
$6
\r\n
SELECT
\r\n
"
;
redisDb
*
db
=
server
.
db
+
j
;
...
...
src/config.c
浏览文件 @
967ae8ca
...
...
@@ -317,6 +317,12 @@ void loadServerConfigFromString(char *config) {
argc
==
2
)
{
server
.
aof_rewrite_min_size
=
memtoll
(
argv
[
1
],
NULL
);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"aof-rewrite-incremental-fsync"
)
&&
argc
==
2
)
{
if
((
server
.
aof_rewrite_incremental_fsync
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"requirepass"
)
&&
argc
==
2
)
{
if
(
strlen
(
argv
[
1
])
>
REDIS_AUTHPASS_MAX_LEN
)
{
err
=
"Password is longer than REDIS_AUTHPASS_MAX_LEN"
;
...
...
@@ -566,6 +572,11 @@ void configSetCommand(redisClient *c) {
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"auto-aof-rewrite-min-size"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
aof_rewrite_min_size
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"aof-rewrite-incremental-fsync"
))
{
int
yn
=
yesnotoi
(
o
->
ptr
);
if
(
yn
==
-
1
)
goto
badfmt
;
server
.
aof_rewrite_incremental_fsync
=
yn
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"save"
))
{
int
vlen
,
j
;
sds
*
v
=
sdssplitlen
(
o
->
ptr
,
sdslen
(
o
->
ptr
),
" "
,
1
,
&
vlen
);
...
...
@@ -847,6 +858,8 @@ void configGetCommand(redisClient *c) {
config_get_bool_field
(
"activerehashing"
,
server
.
activerehashing
);
config_get_bool_field
(
"repl-disable-tcp-nodelay"
,
server
.
repl_disable_tcp_nodelay
);
config_get_bool_field
(
"aof-rewrite-incremental-fsync"
,
server
.
aof_rewrite_incremental_fsync
);
/* Everything we can't handle with macros follows. */
...
...
src/redis.c
浏览文件 @
967ae8ca
...
...
@@ -1189,6 +1189,7 @@ void initServerConfig() {
server
.
aof_fd
=
-
1
;
server
.
aof_selected_db
=
-
1
;
/* Make sure the first time will not match */
server
.
aof_flush_postponed_start
=
0
;
server
.
aof_rewrite_incremental_fsync
=
1
;
server
.
pidfile
=
zstrdup
(
"/var/run/redis.pid"
);
server
.
rdb_filename
=
zstrdup
(
"dump.rdb"
);
server
.
aof_filename
=
zstrdup
(
"appendonly.aof"
);
...
...
src/redis.h
浏览文件 @
967ae8ca
...
...
@@ -585,6 +585,7 @@ struct redisServer {
time_t
aof_rewrite_time_start
;
/* Current AOF rewrite start time. */
int
aof_lastbgrewrite_status
;
/* REDIS_OK or REDIS_ERR */
unsigned
long
aof_delayed_fsync
;
/* delayed AOF fsync() counter */
int
aof_rewrite_incremental_fsync
;
/* fsync incrementally while rewriting? */
/* RDB persistence */
long
long
dirty
;
/* Changes to DB from the last save */
long
long
dirty_before_bgsave
;
/* Used to restore dirty on failed BGSAVE */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录