Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3b519172
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3b519172
编写于
12月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: post sem in mnode while sync timeout
上级
f623837b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
9 deletion
+19
-9
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+7
-0
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+12
-9
未找到文件。
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
3b519172
...
...
@@ -101,6 +101,7 @@ static void *mndBuildCheckpointTickMsg(int32_t *pContLen, int64_t sec) {
}
static
void
mndPullupTrans
(
SMnode
*
pMnode
)
{
mTrace
(
"pullup trans msg"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -110,6 +111,7 @@ static void mndPullupTrans(SMnode *pMnode) {
}
static
void
mndPullupTtl
(
SMnode
*
pMnode
)
{
mTrace
(
"pullup ttl"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TTL_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
...
...
@@ -117,6 +119,7 @@ static void mndPullupTtl(SMnode *pMnode) {
}
static
void
mndCalMqRebalance
(
SMnode
*
pMnode
)
{
mTrace
(
"calc mq rebalance"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -143,6 +146,7 @@ static void mndStreamCheckpointTick(SMnode *pMnode, int64_t sec) {
}
static
void
mndPullupTelem
(
SMnode
*
pMnode
)
{
mTrace
(
"pullup telem msg"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -152,6 +156,7 @@ static void mndPullupTelem(SMnode *pMnode) {
}
static
void
mndPullupGrant
(
SMnode
*
pMnode
)
{
mTrace
(
"pullup grant msg"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -162,6 +167,7 @@ static void mndPullupGrant(SMnode *pMnode) {
}
static
void
mndIncreaseUpTime
(
SMnode
*
pMnode
)
{
mTrace
(
"increate uptime"
);
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
...
...
@@ -213,6 +219,7 @@ static void mndSetVgroupOffline(SMnode *pMnode, int32_t dnodeId, int64_t curMs)
}
static
void
mndCheckDnodeOffline
(
SMnode
*
pMnode
)
{
mTrace
(
"check dnode offline"
);
if
(
mndAcquireRpc
(
pMnode
)
!=
0
)
return
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
3b519172
...
...
@@ -78,26 +78,27 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
SSdbRaw
*
pRaw
=
pMsg
->
pCont
;
int32_t
transId
=
sdbGetIdFromRaw
(
pMnode
->
pSdb
,
pRaw
);
pMgmt
->
errCode
=
pMeta
->
code
;
mInfo
(
"trans:%d, is proposed, saved:%d code:0x%x, apply index:%"
PRId64
" term:%"
PRIu64
" config:%"
PRId64
" role:%s raw:%p
"
,
" role:%s raw:%p
sec:%d seq:%"
PRId64
,
transId
,
pMgmt
->
transId
,
pMeta
->
code
,
pMeta
->
index
,
pMeta
->
term
,
pMeta
->
lastConfigIndex
,
syncStr
(
pMeta
->
state
),
pRaw
);
pRaw
,
pMgmt
->
transSec
,
pMgmt
->
transSeq
);
if
(
pM
gmt
->
errC
ode
==
0
)
{
if
(
pM
eta
->
c
ode
==
0
)
{
sdbWriteWithoutFree
(
pMnode
->
pSdb
,
pRaw
);
sdbSetApplyInfo
(
pMnode
->
pSdb
,
pMeta
->
index
,
pMeta
->
term
,
pMeta
->
lastConfigIndex
);
}
taosThreadMutexLock
(
&
pMgmt
->
lock
);
pMgmt
->
errCode
=
pMeta
->
code
;
if
(
transId
<=
0
)
{
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
mError
(
"trans:%d, invalid commit msg
"
,
transId
);
mError
(
"trans:%d, invalid commit msg
, cache transId:%d seq:%"
PRId64
,
transId
,
pMgmt
->
transId
,
pMgmt
->
transSeq
);
}
else
if
(
transId
==
pMgmt
->
transId
)
{
if
(
pMgmt
->
errCode
!=
0
)
{
mError
(
"trans:%d, failed to propose since %s, post sem"
,
transId
,
tstrerror
(
pMgmt
->
errCode
));
}
else
{
mInfo
(
"trans:%d, is proposed and post sem
"
,
transId
);
mInfo
(
"trans:%d, is proposed and post sem
, seq:%"
PRId64
,
transId
,
pMgmt
->
transSeq
);
}
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
...
...
@@ -108,7 +109,7 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
STrans
*
pTrans
=
mndAcquireTrans
(
pMnode
,
transId
);
if
(
pTrans
!=
NULL
)
{
mInfo
(
"trans:%d, execute in mnode which not leader"
,
transId
);
mInfo
(
"trans:%d, execute in mnode which not leader
or sync timeout
"
,
transId
);
mndTransExecute
(
pMnode
,
pTrans
);
mndReleaseTrans
(
pMnode
,
pTrans
);
// sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
...
...
@@ -324,6 +325,7 @@ void mndCleanupSync(SMnode *pMnode) {
}
void
mndSyncCheckTimeout
(
SMnode
*
pMnode
)
{
mTrace
(
"check sync timeout"
);
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
taosThreadMutexLock
(
&
pMgmt
->
lock
);
if
(
pMgmt
->
transId
!=
0
)
{
...
...
@@ -350,7 +352,6 @@ void mndSyncCheckTimeout(SMnode *pMnode) {
int32_t
mndSyncPropose
(
SMnode
*
pMnode
,
SSdbRaw
*
pRaw
,
int32_t
transId
)
{
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
pMgmt
->
errCode
=
0
;
SRpcMsg
req
=
{.
msgType
=
TDMT_MND_APPLY_MSG
,
.
contLen
=
sdbGetRawTotalSize
(
pRaw
)};
if
(
req
.
contLen
<=
0
)
return
-
1
;
...
...
@@ -360,6 +361,8 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
memcpy
(
req
.
pCont
,
pRaw
,
req
.
contLen
);
taosThreadMutexLock
(
&
pMgmt
->
lock
);
pMgmt
->
errCode
=
0
;
if
(
pMgmt
->
transId
!=
0
)
{
mError
(
"trans:%d, can't be proposed since trans:%d already waiting for confirm"
,
transId
,
pMgmt
->
transId
);
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
...
...
@@ -406,7 +409,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
}
terrno
=
pMgmt
->
errCode
;
return
pMgmt
->
errCode
;
return
terrno
;
}
void
mndSyncStart
(
SMnode
*
pMnode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录