Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f623837b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
f623837b
编写于
12月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: adjust mnode timer
上级
2b256542
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
12 deletion
+20
-12
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-0
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+3
-0
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+16
-12
未找到文件。
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
f623837b
...
...
@@ -89,6 +89,7 @@ typedef struct {
int32_t
errCode
;
int32_t
transId
;
int32_t
transSec
;
int64_t
transSeq
;
TdThreadMutex
lock
;
int8_t
selfIndex
;
int8_t
numOfReplicas
;
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
f623837b
...
...
@@ -280,6 +280,9 @@ static void *mndThreadFp(void *param) {
if
(
sec
%
(
tsStatusInterval
*
5
)
==
0
)
{
mndCheckDnodeOffline
(
pMnode
);
}
if
(
sec
%
(
MNODE_TIMEOUT_SEC
/
2
)
==
0
)
{
mndSyncCheckTimeout
(
pMnode
);
}
}
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
f623837b
...
...
@@ -17,8 +17,6 @@
#include "mndSync.h"
#include "mndTrans.h"
#define TRANS_TIMEOUT_SEC 10
static
int32_t
mndSyncEqCtrlMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
{
return
-
1
;
...
...
@@ -103,6 +101,7 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
}
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
tsem_post
(
&
pMgmt
->
syncSem
);
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
}
else
{
...
...
@@ -210,6 +209,7 @@ static void mndBecomeFollower(const SSyncFSM *pFsm) {
mInfo
(
"vgId:1, become follower and post sem, trans:%d, failed to propose since not leader"
,
pMgmt
->
transId
);
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
pMgmt
->
errCode
=
TSDB_CODE_SYN_NOT_LEADER
;
tsem_post
(
&
pMgmt
->
syncSem
);
}
...
...
@@ -272,6 +272,7 @@ int32_t mndInitSync(SMnode *pMnode) {
taosThreadMutexInit
(
&
pMgmt
->
lock
,
NULL
);
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
SSyncInfo
syncInfo
=
{
.
snapshotStrategy
=
SYNC_STRATEGY_STANDARD_SNAPSHOT
,
...
...
@@ -328,17 +329,18 @@ void mndSyncCheckTimeout(SMnode *pMnode) {
if
(
pMgmt
->
transId
!=
0
)
{
int32_t
curSec
=
taosGetTimestampSec
();
int32_t
delta
=
curSec
-
pMgmt
->
transSec
;
if
(
delta
>
TRANS
_TIMEOUT_SEC
)
{
mError
(
"trans:%d, failed to propose since timeout, start:%d cur:%d delta:%d
"
,
pMgmt
->
transId
,
pMgmt
->
transSec
,
curSec
,
delta
);
if
(
delta
>
MNODE
_TIMEOUT_SEC
)
{
mError
(
"trans:%d, failed to propose since timeout, start:%d cur:%d delta:%d
seq:%"
PRId64
,
pMgmt
->
transId
,
pMgmt
->
transSec
,
curSec
,
delta
,
pMgmt
->
transSeq
);
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
terrno
=
TSDB_CODE_SYN_TIMEOUT
;
pMgmt
->
errCode
=
TSDB_CODE_SYN_TIMEOUT
;
tsem_post
(
&
pMgmt
->
syncSem
);
}
else
{
mDebug
(
"trans:%d, waiting for sync confirm, start:%d cur:%d delta:%d
"
,
pMgmt
->
transId
,
pMgmt
->
transSec
,
curSec
,
curSec
-
pMgmt
->
transSec
);
mDebug
(
"trans:%d, waiting for sync confirm, start:%d cur:%d delta:%d
seq:%"
PRId64
,
pMgmt
->
transId
,
pMgmt
->
transSec
,
curSec
,
curSec
-
pMgmt
->
transSec
,
pMgmt
->
transSeq
);
}
}
else
{
// mTrace("check sync timeout msg, no trans waiting for confirm");
...
...
@@ -368,26 +370,28 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
mInfo
(
"trans:%d, will be proposed"
,
transId
);
pMgmt
->
transId
=
transId
;
pMgmt
->
transSec
=
taosGetTimestampSec
();
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
int32_t
code
=
syncPropose
(
pMgmt
->
sync
,
&
req
,
false
);
int64_t
seq
=
0
;
int32_t
code
=
syncPropose
(
pMgmt
->
sync
,
&
req
,
false
,
&
seq
);
if
(
code
==
0
)
{
mInfo
(
"trans:%d, is proposing and wait sem"
,
transId
);
mInfo
(
"trans:%d, is proposing and wait sem, seq:%"
PRId64
,
transId
,
seq
);
pMgmt
->
transSeq
=
seq
;
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
tsem_wait
(
&
pMgmt
->
syncSem
);
}
else
if
(
code
>
0
)
{
mInfo
(
"trans:%d, confirm at once since replica is 1, continue execute"
,
transId
);
taosThreadMutexLock
(
&
pMgmt
->
lock
);
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
sdbWriteWithoutFree
(
pMnode
->
pSdb
,
pRaw
);
sdbSetApplyInfo
(
pMnode
->
pSdb
,
req
.
info
.
conn
.
applyIndex
,
req
.
info
.
conn
.
applyTerm
,
SYNC_INDEX_INVALID
);
code
=
0
;
}
else
{
mError
(
"trans:%d, failed to proposed since %s"
,
transId
,
terrstr
());
taosThreadMutexLock
(
&
pMgmt
->
lock
);
pMgmt
->
transId
=
0
;
pMgmt
->
transSec
=
0
;
pMgmt
->
transSeq
=
0
;
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
if
(
terrno
==
0
)
{
terrno
=
TSDB_CODE_APP_ERROR
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录