Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
718ccf5d
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看板
提交
718ccf5d
编写于
11月 08, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/fix/TD-20264' into enh/TD-20288
上级
855bcc72
0183fe6e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
99 addition
and
14 deletion
+99
-14
include/common/tmsg.h
include/common/tmsg.h
+2
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+4
-0
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+5
-5
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+14
-4
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+11
-5
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+61
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
718ccf5d
...
...
@@ -838,6 +838,7 @@ typedef struct {
int64_t
dbId
;
int32_t
vgVersion
;
int32_t
numOfTable
;
// unit is TSDB_TABLE_NUM_UNIT
int64_t
stateTs
;
// ms
}
SUseDbReq
;
int32_t
tSerializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
);
...
...
@@ -853,6 +854,7 @@ typedef struct {
int8_t
hashMethod
;
SArray
*
pVgroupInfos
;
// Array of SVgroupInfo
int32_t
errCode
;
int64_t
stateTs
;
// ms
}
SUseDbRsp
;
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
);
...
...
include/libs/catalog/catalog.h
浏览文件 @
718ccf5d
...
...
@@ -124,6 +124,7 @@ typedef struct SDbVgVersion {
int64_t
dbId
;
int32_t
vgVersion
;
int32_t
numOfTable
;
// unit is TSDB_TABLE_NUM_UNIT
int64_t
stateTs
;
}
SDbVgVersion
;
typedef
struct
STbSVersion
{
...
...
source/common/src/tmsg.c
浏览文件 @
718ccf5d
...
...
@@ -2238,6 +2238,7 @@ int32_t tSerializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfTable
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
stateTs
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -2254,6 +2255,7 @@ int32_t tDeserializeSUseDbReq(void *buf, int32_t bufLen, SUseDbReq *pReq) {
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfTable
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
stateTs
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
@@ -2490,6 +2492,7 @@ int32_t tSerializeSUseDbRspImp(SEncoder *pEncoder, const SUseDbRsp *pRsp) {
}
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
errCode
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pRsp
->
stateTs
)
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -2555,6 +2558,7 @@ int32_t tDeserializeSUseDbRspImp(SDecoder *pDecoder, SUseDbRsp *pRsp) {
}
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
errCode
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pRsp
->
stateTs
)
<
0
)
return
-
1
;
return
0
;
}
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
718ccf5d
...
...
@@ -91,7 +91,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_SNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_VNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_VNODE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE_RSP
,
mmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE_RSP
,
mmPutMsgTo
Read
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CONNECT
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_ACCT
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
@@ -102,7 +102,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_USER
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GET_USER_AUTH
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_DNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CONFIG_DNODE
,
mmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CONFIG_DNODE
,
mmPutMsgTo
Read
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_DNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_MNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_ALTER_MNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
@@ -116,7 +116,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_USE_DB
,
mmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_USE_DB
,
mmPutMsgTo
Read
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_ALTER_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_COMPACT_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_TRIM_DB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
@@ -127,7 +127,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SPLIT_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_BALANCE_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_FUNC
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_RETRIEVE_FUNC
,
mmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_RETRIEVE_FUNC
,
mmPutMsgTo
Read
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_FUNC
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_STB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_ALTER_STB
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
@@ -151,7 +151,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_KILL_TRANS
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_KILL_QUERY
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_KILL_CONN
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_HEARTBEAT
,
mmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_HEARTBEAT
,
mmPutMsgTo
Read
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_STATUS
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SYSTABLE_RETRIEVE
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
718ccf5d
...
...
@@ -321,6 +321,7 @@ typedef struct {
int32_t
vgVersion
;
SDbCfg
cfg
;
SRWLatch
lock
;
int64_t
stateTs
;
}
SDbObj
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
718ccf5d
...
...
@@ -1182,6 +1182,7 @@ int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUs
memcpy
(
pRsp
->
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
pRsp
->
uid
=
pDb
->
uid
;
pRsp
->
vgVersion
=
pDb
->
vgVersion
;
pRsp
->
stateTs
=
pDb
->
stateTs
;
pRsp
->
vgNum
=
taosArrayGetSize
(
pRsp
->
pVgroupInfos
);
pRsp
->
hashMethod
=
pDb
->
cfg
.
hashMethod
;
pRsp
->
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
...
...
@@ -1234,6 +1235,8 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
mDebug
(
"db:%s, process usedb req vgVersion:%d stateTs:%"
PRId64
", rsp vgVersion:%d stateTs:%"
PRId64
,
usedbReq
.
db
,
usedbReq
.
vgVersion
,
usedbReq
.
stateTs
,
usedbRsp
.
vgVersion
,
usedbRsp
.
stateTs
);
code
=
0
;
}
}
...
...
@@ -1290,13 +1293,19 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
int32_t
numOfTable
=
mndGetDBTableNum
(
pDb
,
pMnode
);
if
(
pDbVgVersion
->
vgVersion
>=
pDb
->
vgVersion
&&
numOfTable
==
pDbVgVersion
->
numOfTable
)
{
mInfo
(
"db:%s, version and numOfTable not changed"
,
pDbVgVersion
->
dbFName
);
if
(
pDbVgVersion
->
vgVersion
>=
pDb
->
vgVersion
&&
numOfTable
==
pDbVgVersion
->
numOfTable
/* &&
pDbVgVersion->stateTs == pDb->stateTs */
)
{
mTrace
(
"db:%s, valid dbinfo, vgVersion:%d stateTs:%"
PRId64
" numOfTables:%d, not changed vgVersion:%d stateTs:%"
PRId64
" numOfTables:%d"
,
pDbVgVersion
->
dbFName
,
pDbVgVersion
->
vgVersion
,
pDbVgVersion
->
stateTs
,
pDbVgVersion
->
numOfTable
,
pDb
->
vgVersion
,
pDb
->
stateTs
,
numOfTable
);
mndReleaseDb
(
pMnode
,
pDb
);
continue
;
}
else
{
mInfo
(
"db:%s, vgroup version changed from %d to %d"
,
pDbVgVersion
->
dbFName
,
pDbVgVersion
->
vgVersion
,
pDb
->
vgVersion
);
mInfo
(
"db:%s, valid dbinfo, vgVersion:%d stateTs:%"
PRId64
" numOfTables:%d, changed to vgVersion:%d stateTs:%"
PRId64
" numOfTables:%d"
,
pDbVgVersion
->
dbFName
,
pDbVgVersion
->
vgVersion
,
pDbVgVersion
->
stateTs
,
pDbVgVersion
->
numOfTable
,
pDb
->
vgVersion
,
pDb
->
stateTs
,
numOfTable
);
}
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
pDb
->
cfg
.
numOfVgroups
,
sizeof
(
SVgroupInfo
));
...
...
@@ -1310,6 +1319,7 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs,
memcpy
(
usedbRsp
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
usedbRsp
.
uid
=
pDb
->
uid
;
usedbRsp
.
vgVersion
=
pDb
->
vgVersion
;
usedbRsp
.
stateTs
=
pDb
->
stateTs
;
usedbRsp
.
vgNum
=
(
int32_t
)
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
hashMethod
=
pDb
->
cfg
.
hashMethod
;
usedbRsp
.
hashPrefix
=
pDb
->
cfg
.
hashPrefix
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
718ccf5d
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mndDnode.h"
#include "mndDb.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
#include "mndQnode.h"
...
...
@@ -356,7 +357,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pDnode
->
lastAccessTime
=
curMs
;
const
STraceId
*
trace
=
&
pReq
->
info
.
traceId
;
mGTrace
(
"dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d"
,
pDnode
->
id
,
pDnode
->
accessTimes
,
needCheck
,
online
,
reboot
,
dnodeChanged
,
statusReq
.
statusSeq
);
pDnode
->
accessTimes
,
needCheck
,
online
,
reboot
,
dnodeChanged
,
statusReq
.
statusSeq
);
for
(
int32_t
v
=
0
;
v
<
taosArrayGetSize
(
statusReq
.
pVloads
);
++
v
)
{
SVnodeLoad
*
pVload
=
taosArrayGet
(
statusReq
.
pVloads
,
v
);
...
...
@@ -376,9 +377,9 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if
(
pVgroup
->
vnodeGid
[
vg
].
dnodeId
==
statusReq
.
dnodeId
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
syncState
!=
pVload
->
syncState
||
pVgroup
->
vnodeGid
[
vg
].
syncRestore
!=
pVload
->
syncRestore
)
{
m
Trace
(
"vgId:%d, role changed, old state:%s restored:%d new state:%s restored:%d"
,
pVgroup
->
vgId
,
syncStr
(
pVgroup
->
vnodeGid
[
vg
].
syncState
),
pVgroup
->
vnodeGid
[
vg
].
syncRestore
,
syncStr
(
pVload
->
syncState
),
pVload
->
syncRestore
);
m
Info
(
"vgId:%d, state changed by status msg, old state:%s restored:%d new state:%s restored:%d"
,
pVgroup
->
vgId
,
syncStr
(
pVgroup
->
vnodeGid
[
vg
].
syncState
),
pVgroup
->
vnodeGid
[
vg
].
syncRestore
,
syncStr
(
pVload
->
syncState
),
pVload
->
syncRestore
);
pVgroup
->
vnodeGid
[
vg
].
syncState
=
pVload
->
syncState
;
pVgroup
->
vnodeGid
[
vg
].
syncRestore
=
pVload
->
syncRestore
;
roleChanged
=
true
;
...
...
@@ -387,7 +388,12 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
}
}
if
(
roleChanged
)
{
// notify scheduler role has changed
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
if
(
pDb
!=
NULL
&&
pDb
->
stateTs
!=
curMs
)
{
mInfo
(
"db:%s, stateTs changed by status msg, old stateTs:%"
PRId64
" new stateTs:%"
PRId64
,
pDb
->
name
,
pDb
->
stateTs
,
curMs
);
pDb
->
stateTs
=
curMs
;
}
mndReleaseDb
(
pMnode
,
pDb
);
}
}
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
718ccf5d
...
...
@@ -139,6 +139,63 @@ static void mndIncreaseUpTime(SMnode *pMnode) {
}
}
static
void
mndSetVgroupOffline
(
SMnode
*
pMnode
,
int32_t
dnodeId
,
int64_t
curMs
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SVgObj
*
pVgroup
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
bool
roleChanged
=
false
;
for
(
int32_t
vg
=
0
;
vg
<
pVgroup
->
replica
;
++
vg
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
dnodeId
==
dnodeId
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
syncState
!=
TAOS_SYNC_STATE_ERROR
)
{
mInfo
(
"vgId:%d, state changed by offline check, old state:%s restored:%d new state:error restored:0"
,
pVgroup
->
vgId
,
syncStr
(
pVgroup
->
vnodeGid
[
vg
].
syncState
),
pVgroup
->
vnodeGid
[
vg
].
syncRestore
);
pVgroup
->
vnodeGid
[
vg
].
syncState
=
TAOS_SYNC_STATE_ERROR
;
pVgroup
->
vnodeGid
[
vg
].
syncRestore
=
0
;
roleChanged
=
true
;
}
break
;
}
}
if
(
roleChanged
)
{
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
if
(
pDb
!=
NULL
&&
pDb
->
stateTs
!=
curMs
)
{
mInfo
(
"db:%s, stateTs changed by offline check, old newTs:%"
PRId64
" newTs:%"
PRId64
,
pDb
->
name
,
pDb
->
stateTs
,
curMs
);
pDb
->
stateTs
=
curMs
;
}
mndReleaseDb
(
pMnode
,
pDb
);
}
sdbRelease
(
pSdb
,
pVgroup
);
}
}
static
void
mndCheckDnodeOffline
(
SMnode
*
pMnode
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int64_t
curMs
=
taosGetTimestampMs
();
void
*
pIter
=
NULL
;
while
(
1
)
{
SDnodeObj
*
pDnode
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
if
(
!
online
)
{
mInfo
(
"dnode:%d, in offline state"
,
pDnode
->
id
);
mndSetVgroupOffline
(
pMnode
,
pDnode
->
id
,
curMs
);
}
sdbRelease
(
pSdb
,
pDnode
);
}
}
static
void
*
mndThreadFp
(
void
*
param
)
{
SMnode
*
pMnode
=
param
;
int64_t
lastTime
=
0
;
...
...
@@ -174,6 +231,10 @@ static void *mndThreadFp(void *param) {
if
(
sec
%
tsUptimeInterval
==
0
)
{
mndIncreaseUpTime
(
pMnode
);
}
if
(
sec
%
(
tsStatusInterval
*
5
)
==
0
)
{
mndCheckDnodeOffline
(
pMnode
);
}
}
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录