Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2be6ff46
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2be6ff46
编写于
5月 06, 2023
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: more code
上级
37ca9b3e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
71 addition
and
5 deletion
+71
-5
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
+54
-4
未找到文件。
include/common/tgrant.h
浏览文件 @
2be6ff46
...
...
@@ -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
浏览文件 @
2be6ff46
...
...
@@ -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
浏览文件 @
2be6ff46
...
...
@@ -273,6 +273,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 257
#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
浏览文件 @
2be6ff46
...
...
@@ -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
浏览文件 @
2be6ff46
...
...
@@ -205,6 +205,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
浏览文件 @
2be6ff46
...
...
@@ -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
mndGetDnode
Data
(
SMnode
*
pMnode
,
SArray
*
pDnodeEps
);
void
mndGetDnode
Info
(
SMnode
*
pMnode
,
SArray
*
pDnodeInfo
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
2be6ff46
...
...
@@ -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,21 @@ 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
)
// debug purpose
#if 1
strncpy
(
pDnode
->
active
,
"4cssi6J+y+GSS7zes2RwBezQc/mabvN9N2maa6ksK6JJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2di72ZL6EAo0mcYiPlK2dDdmPh3SOVCm1/c="
,
TSDB_ACTIVE_KEY_LEN
);
strncpy
(
pDnode
->
connActive
,
"ovTNXauk5suSS7zes2RwBezQc/mabvN9N2maa6ksK6JJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2di72ZL6EAo0mcYiPlK2dDdmdpKzEXFi4Rs=ovTNXauk5suSS7zes2RwBezQc/mabvN9N2maa6ksK6JJWl7OxrPZ2ElaXs7Gs9nYSVpezsaz2di72ZL6EAo0mcYiPlK2dDdmdpKzEXFi4Rs="
,
TSDB_CONN_ACTIVE_KEY_LEN
);
#endif
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 +176,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 +193,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 +324,7 @@ bool mndIsDnodeOnline(SDnodeObj *pDnode, int64_t curMs) {
return
true
;
}
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnodeEps
)
{
static
void
mndGetDnodeData
(
SMnode
*
pMnode
,
SArray
*
pDnodeEps
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfEps
=
0
;
...
...
@@ -330,6 +349,29 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeEps) {
}
}
void
mndGetDnodeInfo
(
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
,
...
...
@@ -1077,7 +1119,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 +1137,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录