Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
5cb76602
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5cb76602
编写于
2月 27, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
communication from dnode to mgmt
上级
86402cc9
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
296 addition
and
410 deletion
+296
-410
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+20
-15
src/inc/dnode.h
src/inc/dnode.h
+5
-0
src/inc/mnode.h
src/inc/mnode.h
+3
-1
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+14
-7
src/mnode/inc/mgmtChildTable.h
src/mnode/inc/mgmtChildTable.h
+1
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+1
-0
src/mnode/inc/mgmtDnodeInt.h
src/mnode/inc/mgmtDnodeInt.h
+7
-11
src/mnode/inc/mgmtTable.h
src/mnode/inc/mgmtTable.h
+3
-0
src/mnode/inc/mgmtVgroup.h
src/mnode/inc/mgmtVgroup.h
+6
-0
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+2
-2
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+2
-2
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+3
-1
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+138
-368
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+1
-1
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+28
-0
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+61
-1
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
5cb76602
...
...
@@ -31,44 +31,49 @@ void (*dnodeInitMgmtIpFp)() = NULL;
int32_t
(
*
dnodeInitMgmtFp
)()
=
NULL
;
void
(
*
dnodeProcessStatusRspFp
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
)
=
NULL
;
void
(
*
dnodeSendMsgToMnodeFp
)(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
)
=
NULL
;
void
(
*
dnodeSendRspToMnodeFp
)(
void
*
handle
,
int32_t
code
,
void
*
pCont
,
int
contLen
)
=
NULL
;
static
int32_t
(
*
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MAX
])(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
);
static
void
dnodeInitProcessShellMsg
();
static
void
dnodeSendMsgToMnodeQueueFp
(
SSchedMsg
*
sched
)
{
int8_t
msgType
=
*
(
int8_t
*
)
(
sched
->
msg
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
));
int32_t
contLen
=
*
(
int32_t
*
)
(
sched
->
msg
-
sizeof
(
int8_t
));
int8_t
*
pCont
=
sched
->
msg
;
void
*
pConn
=
NULL
;
int32_t
contLen
=
*
(
int32_t
*
)
(
sched
->
msg
-
4
);
int32_t
code
=
*
(
int32_t
*
)
(
sched
->
msg
-
8
);
int8_t
msgType
=
*
(
int8_t
*
)
(
sched
->
msg
-
9
);
void
*
handle
=
sched
->
ahandle
;
int8_t
*
pCont
=
sched
->
msg
;
mgmtProcessMsgFromDnode
(
pCont
,
contLen
,
msgType
,
pConn
);
mgmtProcessMsgFromDnode
(
pCont
,
contLen
,
handle
,
code
);
rpcFreeCont
(
sched
->
msg
);
}
void
dnodeSendMsgToMnode
(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
)
{
void
dnodeSendMsgToMnode
(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
dTrace
(
"msg:%s is sent to mnode"
,
taosMsg
[
msgType
]);
if
(
dnodeSendMsgToMnodeFp
)
{
dnodeSendMsgToMnodeFp
(
msgType
,
pCont
,
contLen
);
}
else
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
dnodeSendMsgToMnodeQueueFp
;
schedMsg
.
msg
=
pCont
;
*
(
int8_t
*
)
(
pCont
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
))
=
msgType
;
*
(
int32_t
*
)
(
pCont
-
sizeof
(
int8_t
))
=
contLen
;
schedMsg
.
fp
=
dnodeSendMsgToMnodeQueueFp
;
schedMsg
.
msg
=
pCont
;
schedMsg
.
ahandle
=
ahandle
;
*
(
int32_t
*
)
(
pCont
-
4
)
=
contLen
;
*
(
int32_t
*
)
(
pCont
-
8
)
=
TSDB_CODE_SUCCESS
;
*
(
int8_t
*
)
(
pCont
-
9
)
=
msgType
;
taosScheduleTask
(
tsDnodeMgmtQhandle
,
&
schedMsg
);
}
}
void
dnodeSendRspToMnode
(
void
*
pConn
,
int8_t
msgType
,
int32_t
code
,
void
*
pCont
,
int32_t
contLen
)
{
dTrace
(
"rsp:%s is sent to mnode"
,
taosMsg
[
msgType
]);
if
(
tsIsCluster
)
{
rpcSendResponse
(
pConn
,
code
,
pCont
,
contLen
);
if
(
dnodeSendRspToMnodeFp
)
{
dnodeSendRspToMnodeFp
(
pConn
,
code
,
pCont
,
contLen
);
}
else
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
dnodeSendMsgToMnodeFp
;
schedMsg
.
msg
=
pCont
;
*
(
int8_t
*
)
(
pCont
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
))
=
msgType
;
*
(
int32_t
*
)
(
pCont
-
sizeof
(
int8_t
))
=
contLen
;
*
(
int32_t
*
)
(
pCont
-
4
)
=
contLen
;
*
(
int32_t
*
)
(
pCont
-
8
)
=
code
;
*
(
int8_t
*
)
(
pCont
-
9
)
=
msgType
;
taosScheduleTask
(
tsDnodeMgmtQhandle
,
&
schedMsg
);
}
}
...
...
@@ -88,7 +93,7 @@ void dnodeInitMgmtIp() {
}
}
void
dnodeProcessMsgFromMgmt
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
pConn
,
int32_t
code
)
{
void
dnodeProcessMsgFromMgmt
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
handle
,
int32_t
code
)
{
if
(
msgType
<
0
||
msgType
>=
TSDB_MSG_TYPE_MAX
)
{
dError
(
"invalid msg type:%d"
,
msgType
);
}
else
{
...
...
src/inc/dnode.h
浏览文件 @
5cb76602
...
...
@@ -46,6 +46,11 @@ extern void (*dnodeParseParameterK)();
extern
int32_t
(
*
dnodeCheckSystem
)();
// dnodeSystem
extern
void
*
tsDnodeMgmtQhandle
;
void
dnodeProcessMsgFromMgmt
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
pConn
,
int32_t
code
);
// dnodeModule
extern
void
(
*
dnodeStartModules
)();
...
...
src/inc/mnode.h
浏览文件 @
5cb76602
...
...
@@ -258,11 +258,13 @@ typedef struct {
//mgmtSystem
int32_t
mgmtStartSystem
();
void
mgmtCleanUpSystem
();
void
mgmtProcessMsgFromDnode
(
int8_t
*
pCont
,
int32_t
contLen
,
int32_t
msgType
,
void
*
pConn
);
void
mgmtProcessMsgFromDnode
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
pConn
,
int32_t
code
);
extern
int32_t
(
*
mgmtInitSystem
)();
extern
void
(
*
mgmtStopSystem
)();
extern
void
(
*
mgmtCleanUpRedirect
)();
#ifdef __cplusplus
}
#endif
...
...
src/inc/taoserror.h
浏览文件 @
5cb76602
...
...
@@ -162,6 +162,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_FAILED_TO_LOCK_RESOURCES, 0, 117, "failed to lock
TAOS_DEFINE_ERROR
(
TSDB_CODE_TABLE_ID_MISMATCH
,
0
,
118
,
"table id mismatch"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QUERY_CACHE_ERASED
,
0
,
119
,
"query cache erased"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG
,
0
,
120
,
"invalid message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TABLE_TYPE
,
0
,
121
,
"invalid table typee"
)
#ifdef TAOS_ERROR_C
};
...
...
src/inc/taosmsg.h
浏览文件 @
5cb76602
...
...
@@ -240,10 +240,11 @@ typedef struct {
int16_t
numOfTags
;
int32_t
tagDataLen
;
int32_t
sqlDataLen
;
int32_t
contLen
;
uint64_t
createdTime
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
superTableId
[
TSDB_TABLE_ID_LEN
+
1
];
int8_t
data
[];
char
data
[];
}
SDCreateTableMsg
;
typedef
struct
{
...
...
@@ -325,9 +326,13 @@ typedef struct {
short
vnode
;
int32_t
sid
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_ID_LEN
];
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
}
SDRemoveTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
}
SDRemoveSuperTableMsg
;
typedef
struct
{
int32_t
vnode
;
}
SFreeVnodeMsg
;
...
...
@@ -603,8 +608,8 @@ typedef struct {
}
SSecIe
;
typedef
struct
{
int32_t
dnode
;
//the ID
of dnode
int32_t
vnode
;
//the index of vnode
uint32_t
dnode
;
//the ip
of dnode
int32_t
vnode
;
//the index of vnode
uint32_t
ip
;
}
SVPeerDesc
;
...
...
@@ -616,7 +621,7 @@ typedef struct {
typedef
struct
{
int32_t
vnode
;
SVnodeCfg
cfg
;
SVPeerDesc
vpeerDesc
[];
SVPeerDesc
vpeerDesc
[
TSDB_MAX_MPEERS
];
}
SVPeersMsg
;
typedef
struct
{
...
...
@@ -732,11 +737,13 @@ typedef struct {
}
SCreateMnodeMsg
,
SDropMnodeMsg
,
SCreateDnodeMsg
,
SDropDnodeMsg
;
typedef
struct
{
int32_t
vnode
;
int32_t
sid
;
uint32_t
dnode
;
int32_t
vnode
;
int32_t
sid
;
}
STableCfgMsg
;
typedef
struct
{
uint32_t
dnode
;
int32_t
vnode
;
}
SVpeerCfgMsg
;
...
...
src/mnode/inc/mgmtChildTable.h
浏览文件 @
5cb76602
...
...
@@ -35,7 +35,7 @@ int32_t mgmtCreateChildTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgr
int32_t
mgmtDropChildTable
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
);
int32_t
mgmtAlterChildTable
(
SDbObj
*
pDb
,
SAlterTableMsg
*
pAlter
);
int32_t
mgmtModifyChildTableTagValueByName
(
SChildTableObj
*
pTable
,
char
*
tagName
,
char
*
nContent
);
int8_t
*
mgmtBuildCreateChildTableMsg
(
SChildTableObj
*
pTable
,
SVgObj
*
pVgroup
);
SCreateTableMsg
*
mgmtBuildCreateChildTableMsg
(
SChildTableObj
*
pTable
);
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
STableMeta
*
pMeta
,
bool
usePublicIp
);
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
5cb76602
...
...
@@ -57,6 +57,7 @@ extern bool (*mgmtCheckConfigShow)(SGlobalConfig *cfg);
extern
SDnodeObj
tsDnodeObj
;
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mgmtDnodeInt.h
浏览文件 @
5cb76602
...
...
@@ -26,23 +26,19 @@ extern "C" {
extern
void
*
mgmtStatusTimer
;
int32_t
mgmtSendCreateTableMsg
(
SChildTableObj
*
pTable
,
SVgObj
*
pVgroup
);
int32_t
mgmtSendCreateNormalTableMsg
(
SNormalTableObj
*
pTable
,
SVgObj
*
pVgroup
);
void
mgmtSendCreateTableMsg
(
STableInfo
*
pTable
,
SRpcIpSet
*
ipSet
,
void
*
handle
);
void
mgmtSendRemoveTableMsg
(
STableInfo
*
pTable
,
SRpcIpSet
*
ipSet
,
void
*
handle
);
void
mgmtSendAlterStreamMsg
(
STableInfo
*
pTable
,
SRpcIpSet
*
ipSet
,
void
*
handle
);
void
mgmtSendVPeersMsg
(
SVgObj
*
pVgroup
,
int32_t
vnode
,
SRpcIpSet
*
ipSet
,
void
*
handle
);
void
mgmtSendOneFreeVnodeMsg
(
int32_t
vnode
,
SRpcIpSet
*
ipSet
,
void
*
handle
);
int
mgmtSendRemoveMeterMsgToDnode
(
STableInfo
*
pTable
,
SVgObj
*
pVgroup
);
int
mgmtSendVPeersMsg
(
SVgObj
*
pVgroup
);
int
mgmtSendFreeVnodeMsg
(
SVgObj
*
pVgroup
);
int
mgmtSendOneFreeVnodeMsg
(
SVnodeGid
*
pVnodeGid
);
char
*
taosBuildRspMsgToDnode
(
SDnodeObj
*
pObj
,
char
type
);
char
*
taosBuildReqMsgToDnode
(
SDnodeObj
*
pObj
,
char
type
);
extern
int32_t
(
*
mgmtSendSimpleRspToDnode
)(
void
*
pConn
,
int32_t
msgType
,
int32_t
code
);
extern
int32_t
(
*
mgmtSendMsgToDnode
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
);
extern
int32_t
(
*
mgmtInitDnodeInt
)();
extern
void
(
*
mgmtCleanUpDnodeInt
)();
extern
void
(
*
mgmtProcessDnodeStatus
)(
void
*
handle
,
void
*
tmrId
);
void
mgmtSendMsgToDnode
(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
void
mgmtSendRspToDnode
(
void
*
pConn
,
int8_t
msgType
,
int32_t
code
,
void
*
pCont
,
int32_t
contLen
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtTable.h
浏览文件 @
5cb76602
...
...
@@ -41,6 +41,9 @@ void mgmtCleanUpMeters();
void
mgmtAddTableIntoSuperTable
(
SSuperTableObj
*
pStable
);
void
mgmtRemoveTableFromSuperTable
(
SSuperTableObj
*
pStable
);
SDCreateTableMsg
*
mgmtBuildCreateTableMsg
(
STableInfo
*
pTable
);
SDRemoveTableMsg
*
mgmtBuildRemoveTableMsg
(
STableInfo
*
pTable
);
SDRemoveSuperTableMsg
*
mgmtBuildRemoveSuperTableMsg
(
STableInfo
*
pTable
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtVgroup.h
浏览文件 @
5cb76602
...
...
@@ -27,6 +27,7 @@ extern "C" {
int32_t
mgmtInitVgroups
();
void
mgmtCleanUpVgroups
();
SVgObj
*
mgmtGetVgroup
(
int32_t
vgId
);
SVgObj
*
mgmtGetVgroupByVnode
(
uint32_t
dnode
,
int32_t
vnode
);
SVgObj
*
mgmtCreateVgroup
(
SDbObj
*
pDb
);
int32_t
mgmtDropVgroup
(
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
...
...
@@ -41,6 +42,11 @@ SVgObj *mgmtGetAvailVgroup(SDbObj *pDb, int32_t *sid);
void
mgmtAddTableIntoVgroup
(
SVgObj
*
pVgroup
,
STableInfo
*
pTable
);
void
mgmtRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
STableInfo
*
pTable
);
SVPeersMsg
*
mgmtBuildVpeersMsg
(
SVgObj
*
pVgroup
,
int32_t
vnode
);
SRpcIpSet
mgmtGetIpSetFromVgroup
(
SVgObj
*
pVgroup
);
SRpcIpSet
mgmtGetIpSetFromIp
(
uint32_t
ip
);
#ifdef __cplusplus
}
#endif
...
...
src/mnode/src/mgmtChildTable.c
浏览文件 @
5cb76602
...
...
@@ -273,7 +273,7 @@ void mgmtCleanUpChildTables() {
sdbCloseTable
(
tsChildTableSdb
);
}
int8_t
*
mgmtBuildCreateChildTableMsg
(
SChildTableObj
*
pTable
,
SVgObj
*
pVgroup
)
{
SCreateTableMsg
*
mgmtBuildCreateChildTableMsg
(
SChildTableObj
*
pTable
)
{
// SCreateTableMsg *pCreateTable = (SCreateTableMsg *) pMsg;
// memcpy(pCreateTable->tableId, pTable->tableId, TSDB_TABLE_ID_LEN);
// memcpy(pCreateTable->superTableId, pTable->superTable->tableId, TSDB_TABLE_ID_LEN);
...
...
@@ -360,7 +360,7 @@ int32_t mgmtDropChildTable(SDbObj *pDb, SChildTableObj *pTable) {
return
TSDB_CODE_OTHERS
;
}
mgmtSendRemove
MeterMsgToDnode
((
STableInfo
*
)
pTable
,
pVgroup
);
mgmtSendRemove
TableMsg
((
STableInfo
*
)
pTable
,
pVgroup
);
sdbDeleteRow
(
tsChildTableSdb
,
pTable
);
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
5cb76602
...
...
@@ -295,7 +295,7 @@ int32_t mgmtSetDbDropping(SDbObj *pDb) {
}
}
}
mgmtSendFreeVnodeMsg
(
pVgroup
);
mgmtSendFreeVnode
s
Msg
(
pVgroup
);
pVgroup
=
pVgroup
->
next
;
}
...
...
@@ -355,7 +355,7 @@ int32_t mgmtDropDb(SDbObj *pDb) {
if
(
!
finished
)
{
SVgObj
*
pVgroup
=
pDb
->
pHead
;
while
(
pVgroup
!=
NULL
)
{
mgmtSendFreeVnodeMsg
(
pVgroup
);
mgmtSendFreeVnode
s
Msg
(
pVgroup
);
pVgroup
=
pVgroup
->
next
;
}
return
TSDB_CODE_ACTION_IN_PROGRESS
;
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
5cb76602
...
...
@@ -22,6 +22,7 @@
#include "mgmtDnode.h"
#include "mgmtBalance.h"
#include "mgmtUser.h"
#include "mgmtVgroup.h"
SDnodeObj
tsDnodeObj
;
...
...
@@ -596,4 +597,5 @@ bool mgmtCheckConfigShowImp(SGlobalConfig *cfg) {
return
true
;
}
bool
(
*
mgmtCheckConfigShow
)(
SGlobalConfig
*
cfg
)
=
mgmtCheckConfigShowImp
;
\ No newline at end of file
bool
(
*
mgmtCheckConfigShow
)(
SGlobalConfig
*
cfg
)
=
mgmtCheckConfigShowImp
;
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
5cb76602
此差异已折叠。
点击以展开。
src/mnode/src/mgmtNormalTable.c
浏览文件 @
5cb76602
...
...
@@ -387,7 +387,7 @@ int32_t mgmtDropNormalTable(SDbObj *pDb, SNormalTableObj *pTable) {
return
TSDB_CODE_OTHERS
;
}
mgmtSendRemove
MeterMsgToDnode
((
STableInfo
*
)
pTable
,
pVgroup
);
mgmtSendRemove
TableMsg
((
STableInfo
*
)
pTable
,
pVgroup
);
sdbDeleteRow
(
tsNormalTableSdb
,
pTable
);
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
5cb76602
...
...
@@ -390,3 +390,31 @@ int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, void *
return
numOfRows
;
}
SDCreateTableMsg
*
mgmtBuildCreateTableMsg
(
STableInfo
*
pTable
)
{
SDCreateTableMsg
*
pCreate
=
NULL
;
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_NORMAL_TABLE
)
{
pCreate
=
mgmtBuildCreateNormalTableMsg
((
SNormalTableObj
*
)
pTable
);
}
else
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_CHILD_TABLE
)
{
pCreate
=
mgmtBuildCreateChildTableMsg
((
SChildTableObj
*
)
pTable
);
}
else
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_STREAM_TABLE
)
{
pCreate
=
mgmtBuildCreateNormalTableMsg
((
SNormalTableObj
*
)
pTable
);
}
else
{
}
return
pCreate
;
}
SDRemoveTableMsg
*
mgmtBuildRemoveTableMsg
(
STableInfo
*
pTable
)
{
SDRemoveTableMsg
*
pRemove
=
NULL
;
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_NORMAL_TABLE
)
{
pRemove
=
mgmtBuildCreateNormalTableMsg
((
SNormalTableObj
*
)
pTable
);
}
else
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_CHILD_TABLE
)
{
pRemove
=
mgmtBuildCreateChildTableMsg
((
SChildTableObj
*
)
pTable
);
}
else
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_STREAM_TABLE
)
{
pRemove
=
mgmtBuildCreateNormalTableMsg
((
SNormalTableObj
*
)
pTable
);
}
else
{
}
return
pRemove
;
}
\ No newline at end of file
src/mnode/src/mgmtVgroup.c
浏览文件 @
5cb76602
...
...
@@ -234,7 +234,7 @@ int32_t mgmtDropVgroup(SDbObj *pDb, SVgObj *pVgroup) {
}
mTrace
(
"vgroup:%d, db:%s replica:%d is deleted"
,
pVgroup
->
vgId
,
pDb
->
name
,
pVgroup
->
numOfVnodes
);
mgmtSendFreeVnodeMsg
(
pVgroup
);
mgmtSendFreeVnode
s
Msg
(
pVgroup
);
sdbDeleteRow
(
tsVgroupSdb
,
pVgroup
);
return
0
;
...
...
@@ -521,3 +521,63 @@ void mgmtRemoveTableFromVgroup(SVgObj *pVgroup, STableInfo *pTable) {
pVgroup
->
tableList
[
pTable
->
sid
]
=
NULL
;
taosFreeId
(
pVgroup
->
idPool
,
pTable
->
sid
);
}
SVPeersMsg
*
mgmtBuildVpeersMsg
(
SVgObj
*
pVgroup
,
int32_t
vnode
)
{
SDbObj
*
pDb
=
mgmtGetDb
(
pVgroup
->
dbName
);
if
(
pDb
==
NULL
)
return
NULL
;
SVPeersMsg
*
pVPeers
=
rpcMallocCont
(
sizeof
(
SVPeersMsg
));
if
(
pVPeers
==
NULL
)
return
NULL
;
pVPeers
->
vnode
=
htonl
(
vnode
);
pVPeers
->
cfg
=
pDb
->
cfg
;
SVnodeCfg
*
pCfg
=
&
pVPeers
->
cfg
;
pCfg
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pCfg
->
maxSessions
=
htonl
(
pCfg
->
maxSessions
);
pCfg
->
cacheBlockSize
=
htonl
(
pCfg
->
cacheBlockSize
);
pCfg
->
cacheNumOfBlocks
.
totalBlocks
=
htonl
(
pCfg
->
cacheNumOfBlocks
.
totalBlocks
);
pCfg
->
daysPerFile
=
htonl
(
pCfg
->
daysPerFile
);
pCfg
->
daysToKeep1
=
htonl
(
pCfg
->
daysToKeep1
);
pCfg
->
daysToKeep2
=
htonl
(
pCfg
->
daysToKeep2
);
pCfg
->
daysToKeep
=
htonl
(
pCfg
->
daysToKeep
);
pCfg
->
commitTime
=
htonl
(
pCfg
->
commitTime
);
pCfg
->
blocksPerTable
=
htons
(
pCfg
->
blocksPerTable
);
pCfg
->
replications
=
(
char
)
pVgroup
->
numOfVnodes
;
pCfg
->
rowsInFileBlock
=
htonl
(
pCfg
->
rowsInFileBlock
);
SVPeerDesc
*
vpeerDesc
=
pVPeers
->
vpeerDesc
;
for
(
int32_t
j
=
0
;
j
<
pVgroup
->
numOfVnodes
;
++
j
)
{
vpeerDesc
[
j
].
ip
=
htonl
(
pVgroup
->
vnodeGid
[
j
].
ip
);
vpeerDesc
[
j
].
vnode
=
htonl
(
pVgroup
->
vnodeGid
[
j
].
vnode
);
}
return
pVPeers
;
}
SVgObj
*
mgmtGetVgroupByVnode
(
uint32_t
dnode
,
int32_t
vnode
)
{
if
(
vnode
<
0
||
vnode
>=
TSDB_MAX_VNODES
)
{
return
NULL
;
}
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
dnode
);
if
(
pDnode
==
NULL
)
{
return
NULL
;
}
int32_t
vgId
=
pDnode
->
vload
[
vnode
].
vgId
;
return
mgmtGetVgroup
(
vgId
);
}
SRpcIpSet
mgmtGetIpSetFromVgroup
(
SVgObj
*
pVgroup
)
{
SRpcIpSet
ipSet
=
{.
numOfIps
=
pVgroup
->
numOfVnodes
,
.
inUse
=
0
,
.
port
=
tsMgmtDnodePort
+
1
};
for
(
int
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
ipSet
.
ip
[
i
]
=
pVgroup
->
vnodeGid
[
i
].
ip
;
}
return
ipSet
;
}
SRpcIpSet
mgmtGetIpSetFromIp
(
uint32_t
ip
)
{
SRpcIpSet
ipSet
=
{.
ip
=
ip
,
.
numOfIps
=
1
,
.
inUse
=
0
,
.
port
=
tsMgmtDnodePort
+
1
};
return
ipSet
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录