Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
be8f59cb
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be8f59cb
编写于
5月 11, 2023
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feat/TD-23643-3.0' of github.com:taosdata/TDengine into feat/TD-23643-3.0
上级
76dd3dbb
1cf0b485
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
61 addition
and
6 deletion
+61
-6
include/common/tgrant.h
include/common/tgrant.h
+2
-0
include/common/tmsg.h
include/common/tmsg.h
+7
-0
include/util/tdef.h
include/util/tdef.h
+3
-0
source/common/src/systable.c
source/common/src/systable.c
+2
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-0
source/dnode/mnode/impl/inc/mndDnode.h
source/dnode/mnode/impl/inc/mndDnode.h
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+44
-5
未找到文件。
include/common/tgrant.h
浏览文件 @
be8f59cb
...
...
@@ -26,7 +26,9 @@ extern "C" {
#include "tgrantCfg.h"
#endif
#ifndef GRANTS_COL_MAX_LEN
#define GRANTS_COL_MAX_LEN 128
#endif
typedef
enum
{
TSDB_GRANT_ALL
,
...
...
include/common/tmsg.h
浏览文件 @
be8f59cb
...
...
@@ -1232,6 +1232,13 @@ typedef struct {
SEp
ep
;
}
SDnodeEp
;
typedef
struct
{
int32_t
id
;
SEp
ep
;
char
active
[
TSDB_ACTIVE_KEY_LEN
];
char
connActive
[
TSDB_CONN_ACTIVE_KEY_LEN
];
}
SDnodeInfo
;
typedef
struct
{
int64_t
dnodeVer
;
SDnodeCfg
dnodeCfg
;
...
...
include/util/tdef.h
浏览文件 @
be8f59cb
...
...
@@ -267,6 +267,9 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_VALUE_LEN 256
#define TSDB_ACTIVE_KEY_LEN 109
#define TSDB_CONN_ACTIVE_KEY_LEN 109
#define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
...
...
source/common/src/systable.c
浏览文件 @
be8f59cb
...
...
@@ -35,6 +35,8 @@ static const SSysDbTableSchema dnodesSchema[] = {
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
{.
name
=
"reboot_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
true
},
{.
name
=
"note"
,
.
bytes
=
256
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"active_code"
,
.
bytes
=
108
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
{.
name
=
"c_active_code"
,
.
bytes
=
256
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
true
},
};
static
const
SSysDbTableSchema
mnodesSchema
[]
=
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
be8f59cb
...
...
@@ -206,6 +206,8 @@ typedef struct {
uint16_t
port
;
char
fqdn
[
TSDB_FQDN_LEN
];
char
ep
[
TSDB_EP_LEN
];
char
active
[
TSDB_ACTIVE_KEY_LEN
];
char
connActive
[
TSDB_CONN_ACTIVE_KEY_LEN
];
}
SDnodeObj
;
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndDnode.h
浏览文件 @
be8f59cb
...
...
@@ -29,7 +29,7 @@ void mndReleaseDnode(SMnode *pMnode, SDnodeObj *pDnode);
SEpSet
mndGetDnodeEpset
(
SDnodeObj
*
pDnode
);
int32_t
mndGetDnodeSize
(
SMnode
*
pMnode
);
bool
mndIsDnodeOnline
(
SDnodeObj
*
pDnode
,
int64_t
curMs
);
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnode
Eps
);
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnode
Info
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
be8f59cb
...
...
@@ -27,7 +27,7 @@
#include "tmisce.h"
#include "mndCluster.h"
#define TSDB_DNODE_VER_NUMBER
1
#define TSDB_DNODE_VER_NUMBER
2
#define TSDB_DNODE_RESERVE_SIZE 64
static
const
char
*
offlineReason
[]
=
{
...
...
@@ -138,6 +138,10 @@ static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pDnode
->
updateTime
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pDnode
->
port
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
active
,
TSDB_ACTIVE_KEY_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
connActive
,
TSDB_CONN_ACTIVE_KEY_LEN
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
);
...
...
@@ -161,7 +165,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_DNODE_VER_NUMBER
)
{
if
(
sver
<
1
||
sver
>
TSDB_DNODE_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
_OVER
;
}
...
...
@@ -178,6 +182,10 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pDnode
->
updateTime
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pDnode
->
port
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
,
_OVER
)
if
(
sver
>
1
)
{
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
active
,
TSDB_ACTIVE_KEY_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pDnode
->
connActive
,
TSDB_CONN_ACTIVE_KEY_LEN
,
_OVER
)
}
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
...
...
@@ -305,7 +313,7 @@ bool mndIsDnodeOnline(SDnodeObj *pDnode, int64_t curMs) {
return
true
;
}
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnodeEps
)
{
static
void
mndGetDnodeEps
(
SMnode
*
pMnode
,
SArray
*
pDnodeEps
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfEps
=
0
;
...
...
@@ -330,6 +338,29 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeEps) {
}
}
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnodeInfo
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfEps
=
0
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SDnodeObj
*
pDnode
=
NULL
;
ESdbStatus
objStatus
=
0
;
pIter
=
sdbFetchAll
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
,
&
objStatus
,
true
);
if
(
pIter
==
NULL
)
break
;
SDnodeInfo
dInfo
;
dInfo
.
id
=
pDnode
->
id
;
dInfo
.
ep
.
port
=
pDnode
->
port
;
tstrncpy
(
dInfo
.
ep
.
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
tstrncpy
(
dInfo
.
active
,
pDnode
->
active
,
TSDB_ACTIVE_KEY_LEN
);
tstrncpy
(
dInfo
.
connActive
,
pDnode
->
connActive
,
TSDB_CONN_ACTIVE_KEY_LEN
);
sdbRelease
(
pSdb
,
pDnode
);
taosArrayPush
(
pDnodeInfo
,
&
dInfo
);
}
}
static
int32_t
mndCheckClusterCfgPara
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
const
SClusterCfg
*
pCfg
)
{
if
(
pCfg
->
statusInterval
!=
tsStatusInterval
)
{
mError
(
"dnode:%d, statusInterval:%d inconsistent with cluster:%d"
,
pDnode
->
id
,
pCfg
->
statusInterval
,
...
...
@@ -536,7 +567,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
goto
_OVER
;
}
mndGetDnode
Data
(
pMnode
,
statusRsp
.
pDnodeEps
);
mndGetDnode
Eps
(
pMnode
,
statusRsp
.
pDnodeEps
);
int32_t
contLen
=
tSerializeSStatusRsp
(
NULL
,
0
,
&
statusRsp
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
...
...
@@ -1077,7 +1108,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
status
=
"offline"
;
}
char
b1
[
16
]
=
{
0
};
char
b1
[
TSDB_CONN_ACTIVE_KEY_LEN
+
2
]
=
{
0
};
STR_TO_VARSTR
(
b1
,
status
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
b1
,
false
);
...
...
@@ -1095,6 +1126,14 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
colDataSetVal
(
pColInfo
,
numOfRows
,
b
,
false
);
taosMemoryFreeClear
(
b
);
STR_TO_VARSTR
(
b1
,
pDnode
->
active
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
b1
,
false
);
STR_TO_VARSTR
(
b1
,
pDnode
->
connActive
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
b1
,
false
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pDnode
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录