Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
cb8433f3
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,发现更多精彩内容 >>
提交
cb8433f3
编写于
5月 13, 2013
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CONFIG REWRITE: support for client-output-buffer-limit.
上级
f62851ae
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
11 deletion
+50
-11
src/config.c
src/config.c
+44
-2
src/redis.c
src/redis.c
+4
-9
src/redis.h
src/redis.h
+2
-0
未找到文件。
src/config.c
浏览文件 @
cb8433f3
...
...
@@ -47,6 +47,12 @@ static struct {
{
NULL
,
0
}
};
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
REDIS_CLIENT_LIMIT_NUM_CLASSES
]
=
{
{
0
,
0
,
0
},
/* normal */
{
1024
*
1024
*
256
,
1024
*
1024
*
64
,
60
},
/* slave */
{
1024
*
1024
*
32
,
1024
*
1024
*
8
,
60
}
/* pubsub */
};
/*-----------------------------------------------------------------------------
* Config file parsing
*----------------------------------------------------------------------------*/
...
...
@@ -1313,23 +1319,59 @@ void rewriteConfigDirOption(struct rewriteConfigState *state) {
}
void
rewriteConfigSlaveofOption
(
struct
rewriteConfigState
*
state
)
{
char
*
option
=
"slaveof"
;
sds
line
;
/* If this is a master, we want all the slaveof config options
* in the file to be removed. */
if
(
server
.
masterhost
==
NULL
)
return
;
line
=
sdscatprintf
(
sdsempty
(),
"
slaveof %s %d"
,
line
=
sdscatprintf
(
sdsempty
(),
"
%s %s %d"
,
option
,
server
.
masterhost
,
server
.
masterport
);
rewriteConfigRewriteLine
(
state
,
"slaveof"
,
line
,
1
);
rewriteConfigRewriteLine
(
state
,
option
,
line
,
1
);
}
void
rewriteConfigAppendonlyOption
(
struct
rewriteConfigState
*
state
)
{
int
force
=
server
.
aof_state
!=
REDIS_AOF_OFF
;
char
*
option
=
"appendonly"
;
sds
line
;
line
=
sdscatprintf
(
sdsempty
(),
"%s %s"
,
option
,
(
server
.
aof_state
==
REDIS_AOF_OFF
)
?
"no"
:
"yes"
);
rewriteConfigRewriteLine
(
state
,
option
,
line
,
force
);
}
void
rewriteConfigNotifykeyspaceeventsOption
(
struct
rewriteConfigState
*
state
)
{
int
force
=
server
.
notify_keyspace_events
!=
0
;
char
*
option
=
"notify-keyspace-events"
;
sds
line
,
flags
;
flags
=
keyspaceEventsFlagsToString
(
server
.
notify_keyspace_events
);
line
=
sdscatprintf
(
sdsempty
(),
"%s %s"
,
option
,
flags
);
sdsfree
(
flags
);
rewriteConfigRewriteLine
(
state
,
option
,
line
,
force
);
}
void
rewriteConfigClientoutputbufferlimitOption
(
struct
rewriteConfigState
*
state
)
{
int
j
;
char
*
option
=
"client-output-buffer-limit"
;
for
(
j
=
0
;
j
<
REDIS_CLIENT_LIMIT_NUM_CLASSES
;
j
++
)
{
int
force
=
(
server
.
client_obuf_limits
[
j
].
hard_limit_bytes
!=
clientBufferLimitsDefaults
[
j
].
hard_limit_bytes
)
||
(
server
.
client_obuf_limits
[
j
].
soft_limit_bytes
!=
clientBufferLimitsDefaults
[
j
].
soft_limit_bytes
)
||
(
server
.
client_obuf_limits
[
j
].
soft_limit_seconds
!=
clientBufferLimitsDefaults
[
j
].
soft_limit_seconds
);
sds
line
;
line
=
sdscatprintf
(
sdsempty
(),
"%s %s %llu %llu %ld"
,
option
,
getClientLimitClassName
(
j
),
server
.
client_obuf_limits
[
j
].
hard_limit_bytes
,
server
.
client_obuf_limits
[
j
].
soft_limit_bytes
,
(
long
)
server
.
client_obuf_limits
[
j
].
soft_limit_seconds
);
rewriteConfigRewriteLine
(
state
,
option
,
line
,
force
);
}
}
sds
rewriteConfigGetContentFromState
(
struct
rewriteConfigState
*
state
)
{
...
...
src/redis.c
浏览文件 @
cb8433f3
...
...
@@ -1162,6 +1162,8 @@ void createSharedObjects(void) {
}
void
initServerConfig
()
{
int
j
;
getRandomHexChars
(
server
.
runid
,
REDIS_RUN_ID_SIZE
);
server
.
configfile
=
NULL
;
server
.
hz
=
REDIS_DEFAULT_HZ
;
...
...
@@ -1263,15 +1265,8 @@ void initServerConfig() {
server
.
repl_no_slaves_since
=
time
(
NULL
);
/* Client output buffer limits */
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_NORMAL
].
hard_limit_bytes
=
0
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_NORMAL
].
soft_limit_bytes
=
0
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_NORMAL
].
soft_limit_seconds
=
0
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_SLAVE
].
hard_limit_bytes
=
1024
*
1024
*
256
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_SLAVE
].
soft_limit_bytes
=
1024
*
1024
*
64
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_SLAVE
].
soft_limit_seconds
=
60
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_PUBSUB
].
hard_limit_bytes
=
1024
*
1024
*
32
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_PUBSUB
].
soft_limit_bytes
=
1024
*
1024
*
8
;
server
.
client_obuf_limits
[
REDIS_CLIENT_LIMIT_CLASS_PUBSUB
].
soft_limit_seconds
=
60
;
for
(
j
=
0
;
j
<
REDIS_CLIENT_LIMIT_NUM_CLASSES
;
j
++
)
server
.
client_obuf_limits
[
j
]
=
clientBufferLimitsDefaults
[
j
];
/* Double constants initialization */
R_Zero
=
0
.
0
;
...
...
src/redis.h
浏览文件 @
cb8433f3
...
...
@@ -492,6 +492,8 @@ typedef struct clientBufferLimitsConfig {
time_t
soft_limit_seconds
;
}
clientBufferLimitsConfig
;
extern
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
REDIS_CLIENT_LIMIT_NUM_CLASSES
];
/* The redisOp structure defines a Redis Operation, that is an instance of
* a command with an argument vector, database ID, propagation target
* (REDIS_PROPAGATE_*), and command pointer.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录