Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
e6f39338
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
e6f39338
编写于
7月 28, 2015
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CLIENT_MASTER introduced.
上级
c1e94b6b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
10 deletion
+20
-10
src/config.c
src/config.c
+4
-4
src/networking.c
src/networking.c
+9
-2
src/server.c
src/server.c
+1
-1
src/server.h
src/server.h
+6
-3
未找到文件。
src/config.c
浏览文件 @
e6f39338
...
...
@@ -90,7 +90,7 @@ configEnum aof_fsync_enum[] = {
};
/* Output buffer limits presets. */
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
CLIENT_TYPE_COUNT
]
=
{
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
CLIENT_TYPE_
OBUF_
COUNT
]
=
{
{
0
,
0
,
0
},
/* normal */
{
1024
*
1024
*
256
,
1024
*
1024
*
64
,
60
},
/* slave */
{
1024
*
1024
*
32
,
1024
*
1024
*
8
,
60
}
/* pubsub */
...
...
@@ -1163,13 +1163,13 @@ void configGetCommand(client *c) {
sds
buf
=
sdsempty
();
int
j
;
for
(
j
=
0
;
j
<
CLIENT_TYPE_COUNT
;
j
++
)
{
for
(
j
=
0
;
j
<
CLIENT_TYPE_
OBUF_
COUNT
;
j
++
)
{
buf
=
sdscatprintf
(
buf
,
"%s %llu %llu %ld"
,
getClientTypeName
(
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
);
if
(
j
!=
CLIENT_TYPE_COUNT
-
1
)
if
(
j
!=
CLIENT_TYPE_
OBUF_
COUNT
-
1
)
buf
=
sdscatlen
(
buf
,
" "
,
1
);
}
addReplyBulkCString
(
c
,
"client-output-buffer-limit"
);
...
...
@@ -1566,7 +1566,7 @@ void rewriteConfigClientoutputbufferlimitOption(struct rewriteConfigState *state
int
j
;
char
*
option
=
"client-output-buffer-limit"
;
for
(
j
=
0
;
j
<
CLIENT_TYPE_COUNT
;
j
++
)
{
for
(
j
=
0
;
j
<
CLIENT_TYPE_
OBUF_
COUNT
;
j
++
)
{
int
force
=
(
server
.
client_obuf_limits
[
j
].
hard_limit_bytes
!=
clientBufferLimitsDefaults
[
j
].
hard_limit_bytes
)
||
(
server
.
client_obuf_limits
[
j
].
soft_limit_bytes
!=
...
...
src/networking.c
浏览文件 @
e6f39338
...
...
@@ -1567,12 +1567,13 @@ unsigned long getClientOutputBufferMemoryUsage(client *c) {
* CLIENT_TYPE_NORMAL -> Normal client
* CLIENT_TYPE_SLAVE -> Slave or client executing MONITOR command
* CLIENT_TYPE_PUBSUB -> Client subscribed to Pub/Sub channels
* CLIENT_TYPE_MASTER -> The client representing our replication master.
*/
int
getClientType
(
client
*
c
)
{
if
(
c
->
flags
&
CLIENT_MASTER
)
return
CLIENT_TYPE_MASTER
;
if
((
c
->
flags
&
CLIENT_SLAVE
)
&&
!
(
c
->
flags
&
CLIENT_MONITOR
))
return
CLIENT_TYPE_SLAVE
;
if
(
c
->
flags
&
CLIENT_PUBSUB
)
return
CLIENT_TYPE_PUBSUB
;
if
(
c
->
flags
&
CLIENT_PUBSUB
)
return
CLIENT_TYPE_PUBSUB
;
return
CLIENT_TYPE_NORMAL
;
}
...
...
@@ -1580,6 +1581,7 @@ int getClientTypeByName(char *name) {
if
(
!
strcasecmp
(
name
,
"normal"
))
return
CLIENT_TYPE_NORMAL
;
else
if
(
!
strcasecmp
(
name
,
"slave"
))
return
CLIENT_TYPE_SLAVE
;
else
if
(
!
strcasecmp
(
name
,
"pubsub"
))
return
CLIENT_TYPE_PUBSUB
;
else
if
(
!
strcasecmp
(
name
,
"master"
))
return
CLIENT_TYPE_MASTER
;
else
return
-
1
;
}
...
...
@@ -1588,6 +1590,7 @@ char *getClientTypeName(int class) {
case
CLIENT_TYPE_NORMAL
:
return
"normal"
;
case
CLIENT_TYPE_SLAVE
:
return
"slave"
;
case
CLIENT_TYPE_PUBSUB
:
return
"pubsub"
;
case
CLIENT_TYPE_MASTER
:
return
"master"
;
default:
return
NULL
;
}
}
...
...
@@ -1603,6 +1606,10 @@ int checkClientOutputBufferLimits(client *c) {
unsigned
long
used_mem
=
getClientOutputBufferMemoryUsage
(
c
);
class
=
getClientType
(
c
);
/* For the purpose of output buffer limiting, masters are handled
* like normal clients. */
if
(
class
==
CLIENT_TYPE_MASTER
)
class
=
CLIENT_TYPE_NORMAL
;
if
(
server
.
client_obuf_limits
[
class
].
hard_limit_bytes
&&
used_mem
>=
server
.
client_obuf_limits
[
class
].
hard_limit_bytes
)
hard
=
1
;
...
...
src/server.c
浏览文件 @
e6f39338
...
...
@@ -1533,7 +1533,7 @@ void initServerConfig(void) {
server
.
repl_no_slaves_since
=
time
(
NULL
);
/* Client output buffer limits */
for
(
j
=
0
;
j
<
CLIENT_TYPE_COUNT
;
j
++
)
for
(
j
=
0
;
j
<
CLIENT_TYPE_
OBUF_
COUNT
;
j
++
)
server
.
client_obuf_limits
[
j
]
=
clientBufferLimitsDefaults
[
j
];
/* Double constants initialization */
...
...
src/server.h
浏览文件 @
e6f39338
...
...
@@ -276,7 +276,10 @@ typedef long long mstime_t; /* millisecond time type. */
#define CLIENT_TYPE_NORMAL 0
/* Normal req-reply clients + MONITORs */
#define CLIENT_TYPE_SLAVE 1
/* Slaves. */
#define CLIENT_TYPE_PUBSUB 2
/* Clients subscribed to PubSub channels. */
#define CLIENT_TYPE_COUNT 3
#define CLIENT_TYPE_MASTER 3
/* Master. */
#define CLIENT_TYPE_OBUF_COUNT 3
/* Number of clients to expose to output
buffer configuration. Just the first
three: normal, slave, pubsub. */
/* Slave replication state. Used in server.repl_state for slaves to remember
* what to do next. */
...
...
@@ -625,7 +628,7 @@ typedef struct clientBufferLimitsConfig {
time_t
soft_limit_seconds
;
}
clientBufferLimitsConfig
;
extern
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
CLIENT_TYPE_COUNT
];
extern
clientBufferLimitsConfig
clientBufferLimitsDefaults
[
CLIENT_TYPE_
OBUF_
COUNT
];
/* The redisOp structure defines a Redis Operation, that is an instance of
* a command with an argument vector, database ID, propagation target
...
...
@@ -751,7 +754,7 @@ struct redisServer {
int
supervised
;
/* 1 if supervised, 0 otherwise. */
int
supervised_mode
;
/* See SUPERVISED_* */
int
daemonize
;
/* True if running as a daemon */
clientBufferLimitsConfig
client_obuf_limits
[
CLIENT_TYPE_COUNT
];
clientBufferLimitsConfig
client_obuf_limits
[
CLIENT_TYPE_
OBUF_
COUNT
];
/* AOF persistence */
int
aof_state
;
/* AOF_(ON|OFF|WAIT_REWRITE) */
int
aof_fsync
;
/* Kind of fsync() policy */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录