Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
934d0f97
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看板
提交
934d0f97
编写于
6月 20, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:error in windows
上级
ee1b1007
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
38 deletion
+51
-38
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+19
-38
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+31
-0
未找到文件。
include/common/tmsgdef.h
浏览文件 @
934d0f97
...
...
@@ -144,6 +144,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mq-tmr"
,
SMTimerReq
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TELEM_TIMER
,
"telem-tmr"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS_TIMER
,
"trans-tmr"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TTL_TIMER
,
"ttl-tmr"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_TRANS
,
"kill-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_QUERY
,
"kill-query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_CONN
,
"kill-conn"
,
NULL
,
NULL
)
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
934d0f97
...
...
@@ -63,6 +63,21 @@ static void mndPullupTrans(SMnode *pMnode) {
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
}
static
void
mndTtlTimer
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
sizeof
(
SMsgHead
)
+
sizeof
(
int32_t
);
SMsgHead
*
pHead
=
rpcMallocCont
(
contLen
);
if
(
pHead
==
NULL
)
{
mError
(
"ttl time malloc err. contLen:%d"
,
contLen
);
return
;
}
int32_t
t
=
taosGetTimestampSec
();
*
(
int32_t
*
)(
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
)))
=
htonl
(
t
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TTL_TIMER
,
.
pCont
=
pHead
,
.
contLen
=
contLen
};
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
}
static
void
mndCalMqRebalance
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
...
...
@@ -77,54 +92,20 @@ static void mndPullupTelem(SMnode *pMnode) {
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
}
static
void
mndPushTtlTime
(
SMnode
*
pMnode
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
int32_t
contLen
=
sizeof
(
SMsgHead
)
+
sizeof
(
int32_t
);
SMsgHead
*
pHead
=
rpcMallocCont
(
contLen
);
if
(
pHead
==
NULL
)
{
mError
(
"ttl time malloc err. contLen:%d"
,
contLen
);
sdbRelease
(
pSdb
,
pVgroup
);
continue
;
}
pHead
->
contLen
=
htonl
(
contLen
);
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
int32_t
t
=
taosGetTimestampSec
();
*
(
int32_t
*
)(
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
)))
=
htonl
(
t
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_DROP_TTL_TABLE
,
.
pCont
=
pHead
,
.
contLen
=
contLen
};
SEpSet
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
int32_t
code
=
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
if
(
code
!=
0
){
mError
(
"ttl time seed err. code:%d"
,
code
);
}
mError
(
"ttl time seed succ. time:%d"
,
t
);
sdbRelease
(
pSdb
,
pVgroup
);
}
}
static
void
*
mndThreadFp
(
void
*
param
)
{
SMnode
*
pMnode
=
param
;
int64_t
lastTime
=
0
;
setThreadName
(
"mnode-timer"
);
while
(
1
)
{
if
(
lastTime
%
(
864000
)
==
0
)
{
// sleep 1 day for ttl
mndPushTtlTime
(
pMnode
);
}
lastTime
++
;
taosMsleep
(
100
);
if
(
mndGetStop
(
pMnode
))
break
;
if
(
lastTime
%
(
864000
)
==
1
)
{
// sleep 1 day for ttl
mndTtlTimer
(
pMnode
);
}
if
(
lastTime
%
(
tsTransPullupInterval
*
10
)
==
0
)
{
mndPullupTrans
(
pMnode
);
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
934d0f97
...
...
@@ -21,6 +21,7 @@
#include "mndShow.h"
#include "mndSync.h"
#include "mndUser.h"
#include "mndVgroup.h"
#define TRANS_VER_NUMBER 1
#define TRANS_ARRAY_SIZE 8
...
...
@@ -56,6 +57,7 @@ static bool mndCannotExecuteTransAction(SMnode *pMnode) { return !pMnode->dep
static
void
mndTransSendRpcRsp
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
int32_t
mndProcessTransReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessTtl
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessKillTransReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndRetrieveTrans
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
...
...
@@ -72,6 +74,7 @@ int32_t mndInitTrans(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndTransActionDelete
,
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TTL_TIMER
,
mndProcessTtl
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS_TIMER
,
mndProcessTransReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_TRANS
,
mndProcessKillTransReq
);
...
...
@@ -1346,6 +1349,34 @@ static int32_t mndProcessTransReq(SRpcMsg *pReq) {
return
0
;
}
static
int32_t
mndProcessTtl
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
SMsgHead
*
pHead
=
(
SMsgHead
*
)(
pReq
->
pCont
);
pHead
->
contLen
=
htonl
(
pReq
->
contLen
);
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_VND_DROP_TTL_TABLE
,
.
pCont
=
pReq
->
pCont
,
.
contLen
=
pReq
->
contLen
};
SEpSet
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
int32_t
code
=
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
if
(
code
!=
0
){
mError
(
"ttl time seed err. code:%d"
,
code
);
}
mError
(
"ttl time seed succ"
);
sdbRelease
(
pSdb
,
pVgroup
);
}
return
0
;
}
int32_t
mndKillTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
SArray
*
pArray
=
NULL
;
if
(
pTrans
->
stage
==
TRN_STAGE_REDO_ACTION
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录