Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
f71c4d54
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,发现更多精彩内容 >>
提交
f71c4d54
编写于
10月 27, 2014
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Diskless sync delay is now configurable.
上级
4b520177
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
3 deletion
+17
-3
src/config.c
src/config.c
+12
-0
src/redis.c
src/redis.c
+1
-0
src/redis.h
src/redis.h
+1
-0
src/replication.c
src/replication.c
+3
-3
未找到文件。
src/config.c
浏览文件 @
f71c4d54
...
...
@@ -271,6 +271,12 @@ void loadServerConfigFromString(char *config) {
if
((
server
.
repl_diskless_sync
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"repl-diskless-sync-delay"
)
&&
argc
==
2
)
{
server
.
repl_diskless_sync_delay
=
atoi
(
argv
[
1
]);
if
(
server
.
repl_diskless_sync_delay
<
0
)
{
err
=
"repl-diskless-sync-delay can't be negative"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"repl-backlog-size"
)
&&
argc
==
2
)
{
long
long
size
=
memtoll
(
argv
[
1
],
NULL
);
if
(
size
<=
0
)
{
...
...
@@ -873,6 +879,10 @@ void configSetCommand(redisClient *c) {
if
(
yn
==
-
1
)
goto
badfmt
;
server
.
repl_diskless_sync
=
yn
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"repl-diskless-sync-delay"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
server
.
repl_diskless_sync_delay
=
ll
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slave-priority"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
...
...
@@ -991,6 +1001,7 @@ void configGetCommand(redisClient *c) {
config_get_numerical_field
(
"min-slaves-to-write"
,
server
.
repl_min_slaves_to_write
);
config_get_numerical_field
(
"min-slaves-max-lag"
,
server
.
repl_min_slaves_max_lag
);
config_get_numerical_field
(
"hz"
,
server
.
hz
);
config_get_numerical_field
(
"repl-diskless-sync-delay"
,
server
.
repl_diskless_sync_delay
);
/* Bool (yes/no) values */
config_get_bool_field
(
"no-appendfsync-on-rewrite"
,
...
...
@@ -1734,6 +1745,7 @@ int rewriteConfig(char *path) {
rewriteConfigBytesOption
(
state
,
"repl-backlog-ttl"
,
server
.
repl_backlog_time_limit
,
REDIS_DEFAULT_REPL_BACKLOG_TIME_LIMIT
);
rewriteConfigYesNoOption
(
state
,
"repl-disable-tcp-nodelay"
,
server
.
repl_disable_tcp_nodelay
,
REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY
);
rewriteConfigYesNoOption
(
state
,
"repl-diskless-sync"
,
server
.
repl_diskless_sync
,
REDIS_DEFAULT_REPL_DISKLESS_SYNC
);
rewriteConfigNumericalOption
(
state
,
"repl-diskless-sync-delay"
,
server
.
repl_diskless_sync_delay
,
REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY
);
rewriteConfigNumericalOption
(
state
,
"slave-priority"
,
server
.
slave_priority
,
REDIS_DEFAULT_SLAVE_PRIORITY
);
rewriteConfigNumericalOption
(
state
,
"min-slaves-to-write"
,
server
.
repl_min_slaves_to_write
,
REDIS_DEFAULT_MIN_SLAVES_TO_WRITE
);
rewriteConfigNumericalOption
(
state
,
"min-slaves-max-lag"
,
server
.
repl_min_slaves_max_lag
,
REDIS_DEFAULT_MIN_SLAVES_MAX_LAG
);
...
...
src/redis.c
浏览文件 @
f71c4d54
...
...
@@ -1395,6 +1395,7 @@ void initServerConfig(void) {
server
.
repl_down_since
=
0
;
/* Never connected, repl is down since EVER. */
server
.
repl_disable_tcp_nodelay
=
REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY
;
server
.
repl_diskless_sync
=
REDIS_DEFAULT_REPL_DISKLESS_SYNC
;
server
.
repl_diskless_sync_delay
=
REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY
;
server
.
slave_priority
=
REDIS_DEFAULT_SLAVE_PRIORITY
;
server
.
master_repl_offset
=
0
;
...
...
src/redis.h
浏览文件 @
f71c4d54
...
...
@@ -743,6 +743,7 @@ struct redisServer {
int
repl_min_slaves_max_lag
;
/* Max lag of <count> slaves to write. */
int
repl_good_slaves_count
;
/* Number of slaves with lag <= max_lag. */
int
repl_diskless_sync
;
/* Send RDB to slaves sockets directly. */
int
repl_diskless_sync_delay
;
/* Delay to start a diskless repl BGSAVE. */
/* Replication (slave) */
char
*
masterauth
;
/* AUTH with this password with master */
char
*
masterhost
;
/* Hostname of master */
...
...
src/replication.c
浏览文件 @
f71c4d54
...
...
@@ -1869,9 +1869,9 @@ void replicationCron(void) {
}
}
if
(
slaves_waiting
&&
max_idle
>
REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY
)
{
/* Let's start a BGSAVE with disk target
. */
if
(
slaves_waiting
&&
max_idle
>
server
.
repl_diskless_sync_delay
)
{
/* Start a BGSAVE. Usually with socket target, or with disk target
* if there was a recent socket -> disk config change
. */
if
(
startBgsaveForReplication
()
==
REDIS_OK
)
{
/* It started! We need to change the state of slaves
* from WAIT_BGSAVE_START to WAIT_BGSAVE_END. */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录