Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
ffbbb0cc
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ffbbb0cc
编写于
11月 25, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1455 TD-2196
上级
d1cd6206
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
49 addition
and
29 deletion
+49
-29
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+12
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+3
-3
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+33
-26
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
ffbbb0cc
...
...
@@ -97,6 +97,7 @@ extern int32_t tsAlternativeRole;
extern
int32_t
tsBalanceInterval
;
extern
int32_t
tsOfflineThreshold
;
extern
int32_t
tsMnodeEqualVnodeNum
;
extern
int32_t
tsFlowCtrl
;
// restful
extern
int32_t
tsEnableHttpModule
;
...
...
src/common/src/tglobal.c
浏览文件 @
ffbbb0cc
...
...
@@ -133,6 +133,7 @@ int32_t tsAlternativeRole = 0;
int32_t
tsBalanceInterval
=
300
;
// seconds
int32_t
tsOfflineThreshold
=
86400
*
100
;
// seconds 10days
int32_t
tsMnodeEqualVnodeNum
=
4
;
int32_t
tsFlowCtrl
=
1
;
// restful
int32_t
tsEnableHttpModule
=
1
;
...
...
@@ -971,6 +972,17 @@ static void doInitGlobalConfig(void) {
cfg
.
maxValue
=
1000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// module configs
cfg
.
option
=
"flowctrl"
;
cfg
.
ptr
=
&
tsFlowCtrl
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
1
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"http"
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
ffbbb0cc
...
...
@@ -660,7 +660,7 @@ static int32_t vnodeGetWalInfo(int32_t vgId, char *fileName, int64_t *fileId) {
static
void
vnodeNotifyRole
(
int32_t
vgId
,
int8_t
role
)
{
SVnodeObj
*
pVnode
=
vnodeAcquire
(
vgId
);
if
(
pVnode
==
NULL
)
{
v
Error
(
"vgId:%d, vnode not found while notify role"
,
vgId
);
v
Trace
(
"vgId:%d, vnode not found while notify role"
,
vgId
);
return
;
}
...
...
@@ -680,12 +680,12 @@ static void vnodeNotifyRole(int32_t vgId, int8_t role) {
static
void
vnodeCtrlFlow
(
int32_t
vgId
,
int32_t
level
)
{
SVnodeObj
*
pVnode
=
vnodeAcquire
(
vgId
);
if
(
pVnode
==
NULL
)
{
v
Error
(
"vgId:%d, vnode not found while ctrl flow
"
,
vgId
);
v
Trace
(
"vgId:%d, vnode not found while flow ctrl
"
,
vgId
);
return
;
}
pVnode
->
flowctlLevel
=
level
;
vDebug
(
"vgId:%d, set flowctl level:%d"
,
pVnode
->
vgId
,
level
);
vDebug
(
"vgId:%d, set flowct
r
l level:%d"
,
pVnode
->
vgId
,
level
);
vnodeRelease
(
pVnode
);
}
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
ffbbb0cc
...
...
@@ -17,6 +17,7 @@
#include "os.h"
#include "taosmsg.h"
#include "taoserror.h"
#include "tglobal.h"
#include "tqueue.h"
#include "trpc.h"
#include "tsdb.h"
...
...
@@ -40,6 +41,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
static
int32_t
vnodeProcessAlterTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessDropStableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessUpdateTagValMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodePerformFlowCtrl
(
SVWriteMsg
*
pWrite
);
void
vnodeInitWriteFp
(
void
)
{
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_SUBMIT
]
=
vnodeProcessSubmitMsg
;
...
...
@@ -50,32 +52,6 @@ void vnodeInitWriteFp(void) {
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_UPDATE_TAG_VAL
]
=
vnodeProcessUpdateTagValMsg
;
}
static
void
vnodeFlowCtlMsgToWQueue
(
void
*
param
,
void
*
tmrId
)
{
SVWriteMsg
*
pWrite
=
param
;
SVnodeObj
*
pVnode
=
pWrite
->
pVnode
;
int32_t
code
=
vnodeWriteToWQueue
(
pVnode
,
pWrite
->
pHead
,
pWrite
->
qtype
,
&
pWrite
->
rpcMsg
);
if
(
code
!=
0
&&
pWrite
->
qtype
==
TAOS_QTYPE_RPC
)
{
vDebug
(
"vgId:%d, failed to reprocess msg after perform flowctl since %s"
,
pVnode
->
vgId
,
tstrerror
(
code
));
dnodeSendRpcVWriteRsp
(
pWrite
->
pVnode
,
pWrite
,
code
);
}
tfree
(
pWrite
);
vnodeRelease
(
pWrite
->
pVnode
);
}
static
int32_t
vnodePerformFlowCtrl
(
SVWriteMsg
*
pWrite
)
{
SVnodeObj
*
pVnode
=
pWrite
->
pVnode
;
if
(
pVnode
->
flowctlLevel
<=
0
)
return
0
;
int32_t
ms
=
pVnode
->
flowctlLevel
*
5
;
void
*
unUsed
=
NULL
;
taosTmrReset
(
vnodeFlowCtlMsgToWQueue
,
ms
,
pWrite
,
tsDnodeTmr
,
&
unUsed
);
vDebug
(
"vgId:%d, perform flowctl for %d ms"
,
pVnode
->
vgId
,
ms
);
return
TSDB_CODE_RPC_ACTION_IN_PROGRESS
;
}
int32_t
vnodeProcessWrite
(
void
*
vparam
,
void
*
wparam
,
int32_t
qtype
,
void
*
rparam
)
{
int32_t
code
=
0
;
SVnodeObj
*
pVnode
=
vparam
;
...
...
@@ -298,3 +274,34 @@ void vnodeFreeFromWQueue(void *vparam, SVWriteMsg *pWrite) {
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
}
static
void
vnodeFlowCtlMsgToWQueue
(
void
*
param
,
void
*
tmrId
)
{
SVWriteMsg
*
pWrite
=
param
;
SVnodeObj
*
pVnode
=
pWrite
->
pVnode
;
int32_t
code
=
vnodeWriteToWQueue
(
pVnode
,
pWrite
->
pHead
,
pWrite
->
qtype
,
pWrite
->
rpcMsg
.
handle
==
NULL
?
NULL
:
&
pWrite
->
rpcMsg
);
if
(
code
!=
0
&&
pWrite
->
qtype
==
TAOS_QTYPE_RPC
)
{
vDebug
(
"vgId:%d, failed to reprocess msg after perform flowctrl since %s"
,
pVnode
->
vgId
,
tstrerror
(
code
));
dnodeSendRpcVWriteRsp
(
pWrite
->
pVnode
,
pWrite
,
code
);
}
tfree
(
pWrite
);
vnodeRelease
(
pWrite
->
pVnode
);
}
static
int32_t
vnodePerformFlowCtrl
(
SVWriteMsg
*
pWrite
)
{
SVnodeObj
*
pVnode
=
pWrite
->
pVnode
;
if
(
pVnode
->
flowctlLevel
<=
0
)
return
0
;
if
(
tsFlowCtrl
==
0
)
{
int32_t
ms
=
pVnode
->
flowctlLevel
*
2
;
if
(
ms
>
60000
)
ms
=
60000
;
vDebug
(
"vgId:%d, perform flowctrl for %d ms"
,
pVnode
->
vgId
,
ms
);
taosMsleep
(
ms
);
return
0
;
}
else
{
void
*
unUsed
=
NULL
;
taosTmrReset
(
vnodeFlowCtlMsgToWQueue
,
5
,
pWrite
,
tsDnodeTmr
,
&
unUsed
);
return
TSDB_CODE_RPC_ACTION_IN_PROGRESS
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录