Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
1472c682
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,发现更多精彩内容 >>
提交
1472c682
编写于
10月 16, 2014
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Diskless replication: redis.conf and CONFIG SET/GET support.
上级
78adcfe1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
5 deletion
+18
-5
src/config.c
src/config.c
+13
-1
src/redis.c
src/redis.c
+1
-1
src/redis.h
src/redis.h
+2
-2
src/replication.c
src/replication.c
+2
-1
未找到文件。
src/config.c
浏览文件 @
1472c682
...
...
@@ -270,6 +270,10 @@ void loadServerConfigFromString(char *config) {
if
((
server
.
repl_disable_tcp_nodelay
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"repl-diskless-sync"
)
&&
argc
==
2
)
{
if
((
server
.
repl_diskless_sync
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"repl-backlog-size"
)
&&
argc
==
2
)
{
long
long
size
=
memtoll
(
argv
[
1
],
NULL
);
if
(
size
<=
0
)
{
...
...
@@ -284,7 +288,7 @@ void loadServerConfigFromString(char *config) {
goto
loaderr
;
}
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"masterauth"
)
&&
argc
==
2
)
{
server
.
masterauth
=
zstrdup
(
argv
[
1
]);
server
.
masterauth
=
zstrdup
(
argv
[
1
]);
}
else
if
(
!
strcasecmp
(
argv
[
0
],
"slave-serve-stale-data"
)
&&
argc
==
2
)
{
if
((
server
.
repl_serve_stale_data
=
yesnotoi
(
argv
[
1
]))
==
-
1
)
{
err
=
"argument must be 'yes' or 'no'"
;
goto
loaderr
;
...
...
@@ -911,6 +915,11 @@ void configSetCommand(redisClient *c) {
if
(
yn
==
-
1
)
goto
badfmt
;
server
.
repl_disable_tcp_nodelay
=
yn
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"repl-diskless-sync"
))
{
int
yn
=
yesnotoi
(
o
->
ptr
);
if
(
yn
==
-
1
)
goto
badfmt
;
server
.
repl_diskless_sync
=
yn
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"slave-priority"
))
{
if
(
getLongLongFromObject
(
o
,
&
ll
)
==
REDIS_ERR
||
ll
<
0
)
goto
badfmt
;
...
...
@@ -1067,6 +1076,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
(
"repl-diskless-sync"
,
server
.
repl_diskless_sync
);
config_get_bool_field
(
"aof-rewrite-incremental-fsync"
,
server
.
aof_rewrite_incremental_fsync
);
config_get_bool_field
(
"aof-load-truncated"
,
...
...
@@ -1792,6 +1803,7 @@ int rewriteConfig(char *path) {
rewriteConfigBytesOption
(
state
,
"repl-backlog-size"
,
server
.
repl_backlog_size
,
REDIS_DEFAULT_REPL_BACKLOG_SIZE
);
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
,
"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
浏览文件 @
1472c682
...
...
@@ -1480,7 +1480,7 @@ void initServerConfig(void) {
server
.
repl_slave_ro
=
REDIS_DEFAULT_SLAVE_READ_ONLY
;
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_R
DB
_DISKLESS_SYNC
;
server
.
repl_diskless_sync
=
REDIS_DEFAULT_R
EPL
_DISKLESS_SYNC
;
server
.
slave_priority
=
REDIS_DEFAULT_SLAVE_PRIORITY
;
server
.
master_repl_offset
=
0
;
...
...
src/redis.h
浏览文件 @
1472c682
...
...
@@ -114,8 +114,8 @@ typedef long long mstime_t; /* millisecond time type. */
#define REDIS_DEFAULT_RDB_COMPRESSION 1
#define REDIS_DEFAULT_RDB_CHECKSUM 1
#define REDIS_DEFAULT_RDB_FILENAME "dump.rdb"
#define REDIS_DEFAULT_R
DB
_DISKLESS_SYNC 0
#define REDIS_DEFAULT_R
DB
_DISKLESS_SYNC_DELAY 5
#define REDIS_DEFAULT_R
EPL
_DISKLESS_SYNC 0
#define REDIS_DEFAULT_R
EPL
_DISKLESS_SYNC_DELAY 5
#define REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA 1
#define REDIS_DEFAULT_SLAVE_READ_ONLY 1
#define REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY 0
...
...
src/replication.c
浏览文件 @
1472c682
...
...
@@ -1967,7 +1967,8 @@ void replicationCron(void) {
}
}
if
(
slaves_waiting
&&
max_idle
>
REDIS_DEFAULT_RDB_DISKLESS_SYNC_DELAY
)
{
if
(
slaves_waiting
&&
max_idle
>
REDIS_DEFAULT_REPL_DISKLESS_SYNC_DELAY
)
{
/* Let's start a BGSAVE with disk target. */
if
(
startBgsaveForReplication
()
==
REDIS_OK
)
{
/* It started! We need to change the state of slaves
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录