Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
a305bb42
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,发现更多精彩内容 >>
提交
a305bb42
编写于
3月 09, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add code for module dnodeMgmt
上级
39bdc75b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
181 addition
and
110 deletion
+181
-110
src/dnode/CMakeLists.txt
src/dnode/CMakeLists.txt
+2
-0
src/dnode/inc/dnodeMgmt.h
src/dnode/inc/dnodeMgmt.h
+10
-10
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+153
-92
src/dnode/src/dnodeMnode.c
src/dnode/src/dnodeMnode.c
+1
-1
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+10
-4
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+3
-3
src/util/inc/tstatus.h
src/util/inc/tstatus.h
+1
-0
未找到文件。
src/dnode/CMakeLists.txt
浏览文件 @
a305bb42
...
@@ -6,6 +6,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
...
@@ -6,6 +6,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/vnode/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/vnode/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
...
...
src/dnode/inc/dnodeMgmt.h
浏览文件 @
a305bb42
...
@@ -20,17 +20,17 @@
...
@@ -20,17 +20,17 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
int
dnodeInitMgmt
();
int
32_t
dnodeInitMgmt
();
void
dnodeCleanupMgmt
();
void
dnodeCleanupMgmt
();
void
dnodeMgmt
(
SRpcMsg
*
);
void
dnodeMgmt
(
void
*
rpcMsg
);
void
*
dnodeGetVnode
(
in
t
vgId
);
void
*
dnodeGetVnode
(
int32_
t
vgId
);
int
dnodeGetVnodeStatus
(
void
*
);
int
32_t
dnodeGetVnodeStatus
(
void
*
pVnode
);
void
*
dnodeGetVnodeRworker
(
void
*
);
void
*
dnodeGetVnodeRworker
(
void
*
pVnode
);
void
*
dnodeGetVnodeWworker
(
void
*
);
void
*
dnodeGetVnodeWworker
(
void
*
pVnode
);
void
*
dnodeGetVnodeWal
(
void
*
);
void
*
dnodeGetVnodeWal
(
void
*
pVnode
);
void
*
dnodeGetVnodeTsdb
(
void
*
);
void
*
dnodeGetVnodeTsdb
(
void
*
pVnode
);
void
dnodeReleaseVnode
(
void
*
);
void
dnodeReleaseVnode
(
void
*
pVnode
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
a305bb42
...
@@ -15,49 +15,64 @@
...
@@ -15,49 +15,64 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "os.h"
#include "
tlog
.h"
#include "
ihash
.h"
#include "taoserror.h"
#include "taoserror.h"
#include "taosmsg.h"
#include "taosmsg.h"
#include "tlog.h"
#include "trpc.h"
#include "trpc.h"
#include "
dnodeWrite
.h"
#include "
tstatus
.h"
#include "
dnodeRead
.h"
#include "
tsdb
.h"
#include "dnodeMgmt.h"
#include "dnodeMgmt.h"
#include "dnodeRead.h"
#include "dnodeWrite.h"
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
vgId
;
// global vnode group ID
int
status
;
// status: master, slave, notready, deleting
int
32_t
status
;
// status: master, slave, notready, deleting
int
refCount
;
// reference count
int
32_t
refCount
;
// reference count
int64_t
version
;
int64_t
version
;
void
*
wworker
;
void
*
wworker
;
void
*
rworker
;
void
*
rworker
;
void
*
wal
;
void
*
wal
;
void
*
tsdb
;
void
*
tsdb
;
void
*
replica
;
void
*
replica
;
void
*
events
;
void
*
events
;
void
*
cq
;
// continuous query
void
*
cq
;
// continuous query
}
SVnodeObj
;
}
SVnodeObj
;
static
int
dnodeOpenVnodes
();
static
int32_t
dnodeOpenVnodes
();
static
void
dnodeCleanupVnodes
();
static
void
dnodeCleanupVnodes
();
static
int
dnodeCreateVnode
(
int32_t
vgId
,
SCreateVnodeMsg
*
cfg
);
static
int32_t
dnodeOpenVnode
(
int32_t
vgId
);
static
int
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeRemoveVnode
(
SVnodeObj
*
pVnode
);
static
int32_t
dnodeCreateVnode
(
SCreateVnodeMsg
*
cfg
);
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
pMsg
);
static
void
(
*
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
pMsg
);
static
void
(
*
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
pMsg
);
static
void
*
tsDnodeVnodesHash
=
NULL
;
int32_t
dnodeInitMgmt
()
{
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_CREATE_VNODE
]
=
dnodeProcessCreateVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_DROP_VNODE
]
=
dnodeProcessDropVnodeMsg
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_ALTER_VNODE
]
=
dnodeProcessDropVnodeMsg
;
tsDnodeVnodesHash
=
taosInitIntHash
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeObj
),
taosHashInt
);
if
(
tsDnodeVnodesHash
==
NULL
)
{
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
int
dnodeInitMgmt
()
{
return
dnodeOpenVnodes
();
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_FREE_VNODE
]
=
dnodeProcessDropVnodeMsg
;
}
}
void
dnodeCleanupMgmt
()
{
void
dnodeCleanupMgmt
()
{
dnodeCleanupVnodes
();
taosCleanUpIntHash
(
tsDnodeVnodesHash
);
}
}
void
dnodeMgmt
(
SRpcMsg
*
p
Msg
)
{
void
dnodeMgmt
(
void
*
rpc
Msg
)
{
SRpcMsg
*
pMsg
=
rpcMsg
;
terrno
=
0
;
terrno
=
0
;
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
...
@@ -68,28 +83,29 @@ void dnodeMgmt(SRpcMsg *pMsg) {
...
@@ -68,28 +83,29 @@ void dnodeMgmt(SRpcMsg *pMsg) {
SRpcMsg
rsp
;
SRpcMsg
rsp
;
rsp
.
handle
=
pMsg
->
handle
;
rsp
.
handle
=
pMsg
->
handle
;
rsp
.
code
=
terrno
;
rsp
.
code
=
terrno
;
rsp
.
pCont
=
NULL
;
rsp
.
pCont
=
NULL
;
rpcSendResponse
(
&
rsp
);
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
// free the received message
rpcFreeCont
(
pMsg
->
pCont
);
// free the received message
}
}
void
*
dnodeGetVnode
(
int
vgId
)
{
SVnodeObj
*
pVnode
;
// retrieve the pVnode from vgId
void
*
dnodeGetVnode
(
int32_t
vgId
)
{
SVnodeObj
*
pVnode
=
taosGetIntHashData
(
tsDnodeVnodesHash
,
vgId
);
if
(
pVnode
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_VGROUP_ID
;
return
NULL
;
}
if
(
pVnode
->
status
!=
TSDB_VN_STATUS_MASTER
&&
pVnode
->
status
==
TSDB_VN_STATUS_SLAVE
)
{
// if (pVnode->status == ....) {
terrno
=
TSDB_CODE_INVALID_VNODE_STATUS
;
// terrno = ;
return
NULL
;
// return NULL;
}
// }
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
return
pVnode
;
return
pVnode
;
}
}
int
dnodeGetVnodeStatus
(
void
*
pVnode
)
{
int
32_t
dnodeGetVnodeStatus
(
void
*
pVnode
)
{
return
((
SVnodeObj
*
)
pVnode
)
->
status
;
return
((
SVnodeObj
*
)
pVnode
)
->
status
;
}
}
...
@@ -109,61 +125,53 @@ void *dnodeGetVnodeTsdb(void *pVnode) {
...
@@ -109,61 +125,53 @@ void *dnodeGetVnodeTsdb(void *pVnode) {
return
((
SVnodeObj
*
)
pVnode
)
->
tsdb
;
return
((
SVnodeObj
*
)
pVnode
)
->
tsdb
;
}
}
void
dnodeReleaseVnode
(
void
*
param
)
{
void
dnodeReleaseVnode
(
void
*
pVnode
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
param
;
atomic_sub_fetch_32
(
&
((
SVnodeObj
*
)
pVnode
)
->
refCount
,
1
);
int
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
refCount
==
0
)
dnodeRemoveVnode
(
pVnode
);
}
static
int
dnodeOpenVnode
()
{
SVnodeObj
*
pVnode
;
// create tsdb
// create wal
// allocate write worker
pVnode
->
wworker
=
dnodeAllocateWriteWorker
();
// create read queue
pVnode
->
rworker
=
dnodeAllocateReadWorker
();
// create the replica
// set the status
pVnode
->
refCount
=
1
;
return
0
;
}
static
int
dnodeOpenVnodes
()
{
return
0
;
}
}
static
void
dnodeCleanupVnode
()
{
static
int32_t
dnodeOpenVnodes
()
{
dPrint
(
"open all vnodes"
);
return
TSDB_CODE_SUCCESS
;
}
}
static
void
dnodeCleanupVnodes
()
{
static
void
dnodeCleanupVnodes
()
{
dPrint
(
"clean all vnodes"
);
}
}
static
int
dnodeCreateVnode
(
int32_t
vgId
,
SCreateVnodeMsg
*
cfg
)
{
static
int32_t
dnodeOpenVnode
(
int32_t
vgId
)
{
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
tsDirectory
,
vgId
);
SVnodeObj
*
pVnode
=
malloc
(
sizeof
(
SVnodeObj
));
void
*
pTsdb
=
tsdbOpenRepo
(
rootDir
);
if
(
pTsdb
!=
NULL
)
{
// save the vnode info in non-volatile storage
return
terrno
;
}
// add into hash, so it can be retrieved
dnodeOpenVnode
(
pVnode
);
return
0
;
SVnodeObj
vnodeObj
;
vnodeObj
.
vgId
=
vgId
;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
vnodeObj
.
wworker
=
dnodeAllocateWriteWorker
();
vnodeObj
.
rworker
=
dnodeAllocateReadWorker
();
vnodeObj
.
wal
=
NULL
;
vnodeObj
.
tsdb
=
pTsdb
;
vnodeObj
.
replica
=
NULL
;
vnodeObj
.
events
=
NULL
;
vnodeObj
.
cq
=
NULL
;
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
&
vnodeObj
);
return
TSDB_CODE_SUCCESS
;
}
}
static
void
dnodeRemoveVnode
(
SVnodeObj
*
pVnode
)
{
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
)
{
pVnode
->
status
=
TSDB_VN_STATUS_NOT_READY
;
int32_t
count
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
count
>
0
)
{
// wait refcount
}
// remove replica
// remove replica
// remove read queue
// remove read queue
...
@@ -171,26 +179,79 @@ static void dnodeRemoveVnode(SVnodeObj *pVnode) {
...
@@ -171,26 +179,79 @@ static void dnodeRemoveVnode(SVnodeObj *pVnode) {
// remove write queue
// remove write queue
dnodeFreeWriteWorker
(
pVnode
->
wworker
);
dnodeFreeWriteWorker
(
pVnode
->
wworker
);
// remove wal
// remove wal
// remove tsdb
// remove tsdb
if
(
pVnode
->
tsdb
)
{
tsdbCloseRepo
(
pVnode
->
tsdb
);
}
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
}
}
static
int
dnodeDropVnode
(
SVnodeObj
*
pVnode
)
{
static
int32_t
dnodeCreateVnode
(
SCreateVnodeMsg
*
pVnodeCfg
)
{
pVnodeCfg
->
vnode
=
htonl
(
pVnodeCfg
->
vnode
);
int
count
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
pVnodeCfg
->
cfg
.
vgId
=
htonl
(
pVnodeCfg
->
cfg
.
vgId
);
pVnodeCfg
->
cfg
.
maxSessions
=
htonl
(
pVnodeCfg
->
cfg
.
maxSessions
);
pVnodeCfg
->
cfg
.
daysPerFile
=
htonl
(
pVnodeCfg
->
cfg
.
daysPerFile
);
STsdbCfg
tsdbCfg
;
tsdbCfg
.
precision
=
pVnodeCfg
->
cfg
.
precision
;
tsdbCfg
.
tsdbId
=
pVnodeCfg
->
vnode
;
tsdbCfg
.
maxTables
=
pVnodeCfg
->
cfg
.
maxSessions
;
tsdbCfg
.
daysPerFile
=
pVnodeCfg
->
cfg
.
daysPerFile
;
tsdbCfg
.
minRowsPerFileBlock
=
-
1
;
tsdbCfg
.
maxRowsPerFileBlock
=
-
1
;
tsdbCfg
.
keep
=
-
1
;
tsdbCfg
.
maxCacheSize
=
-
1
;
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
tsDirectory
,
pVnodeCfg
->
cfg
.
vgId
);
void
*
pTsdb
=
tsdbCreateRepo
(
rootDir
,
&
tsdbCfg
,
NULL
);
if
(
pTsdb
!=
NULL
)
{
return
terrno
;
}
if
(
count
<=
0
)
dnodeRemoveVnode
(
pVnode
);
SVnodeObj
vnodeObj
;
vnodeObj
.
vgId
=
pVnodeCfg
->
cfg
.
vgId
;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
vnodeObj
.
wworker
=
dnodeAllocateWriteWorker
();
vnodeObj
.
rworker
=
dnodeAllocateReadWorker
();
vnodeObj
.
wal
=
NULL
;
vnodeObj
.
tsdb
=
pTsdb
;
vnodeObj
.
replica
=
NULL
;
vnodeObj
.
events
=
NULL
;
vnodeObj
.
cq
=
NULL
;
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
&
vnodeObj
);
return
TSDB_CODE_SUCCESS
;
}
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
)
{
pVnode
->
status
=
TSDB_VN_STATUS_NOT_READY
;
int32_t
count
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
count
>
0
)
{
// wait refcount
}
if
(
pVnode
->
tsdb
)
{
tsdbDropRepo
(
pVnode
->
tsdb
);
pVnode
->
tsdb
=
NULL
;
}
return
0
;
dnodeCleanupVnode
(
pVnode
)
;
}
}
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
pMsg
)
{
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
pMsg
)
{
// SVnodeObj *pVnode;
// SVnodeObj *pVnode;
// int vgId;
// int
32_t
vgId;
// SVPeersMsg *pCfg;
// SVPeersMsg *pCfg;
// check everything, if not ok, set terrno;
// check everything, if not ok, set terrno;
...
@@ -206,7 +267,7 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *pMsg) {
...
@@ -206,7 +267,7 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *pMsg) {
static
void
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
)
{
static
void
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
;
SVnodeObj
*
pVnode
;
int
vgId
;
int
32_t
vgId
;
// check everything, if not ok, set terrno;
// check everything, if not ok, set terrno;
...
@@ -220,7 +281,7 @@ static void dnodeProcessDropVnodeMsg(SRpcMsg *pMsg) {
...
@@ -220,7 +281,7 @@ static void dnodeProcessDropVnodeMsg(SRpcMsg *pMsg) {
static
void
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
pMsg
)
{
static
void
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
;
SVnodeObj
*
pVnode
;
int
vgId
;
int
32_t
vgId
;
// check everything, if not ok, set terrno;
// check everything, if not ok, set terrno;
...
...
src/dnode/src/dnodeMnode.c
浏览文件 @
a305bb42
...
@@ -28,7 +28,7 @@ static void *tsDnodeMnodeRpc = NULL;
...
@@ -28,7 +28,7 @@ static void *tsDnodeMnodeRpc = NULL;
int32_t
dnodeInitMnode
()
{
int32_t
dnodeInitMnode
()
{
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_DNODE_CREATE_TABLE
]
=
dnodeWrite
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_DNODE_CREATE_TABLE
]
=
dnodeWrite
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_DNODE_REMOVE_TABLE
]
=
dnodeWrite
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_DNODE_REMOVE_TABLE
]
=
dnodeWrite
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_
FREE
_VNODE
]
=
dnodeMgmt
;
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_
DROP
_VNODE
]
=
dnodeMgmt
;
SRpcInit
rpcInit
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
...
...
src/inc/taoserror.h
浏览文件 @
a305bb42
...
@@ -166,6 +166,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, 0, 120, "invalid message
...
@@ -166,6 +166,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, 0, 120, "invalid message
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TABLE_TYPE
,
0
,
121
,
"invalid table typee"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_TABLE_TYPE
,
0
,
121
,
"invalid table typee"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG_VERSION
,
0
,
122
,
"invalid version of message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_MSG_VERSION
,
0
,
122
,
"invalid version of message"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DNODE_NOT_EXIST
,
0
,
123
,
"dnode not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_DNODE_NOT_EXIST
,
0
,
123
,
"dnode not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_INVALID_VGROUP_ID
,
0
,
124
,
"invalid vgroup id"
)
#ifdef TAOS_ERROR_C
#ifdef TAOS_ERROR_C
};
};
...
...
src/inc/taosmsg.h
浏览文件 @
a305bb42
...
@@ -41,10 +41,17 @@ extern "C" {
...
@@ -41,10 +41,17 @@ extern "C" {
#define TSDB_MSG_TYPE_DNODE_CREATE_TABLE_RSP 10
#define TSDB_MSG_TYPE_DNODE_CREATE_TABLE_RSP 10
#define TSDB_MSG_TYPE_DNODE_REMOVE_TABLE 11
#define TSDB_MSG_TYPE_DNODE_REMOVE_TABLE 11
#define TSDB_MSG_TYPE_DNODE_REMOVE_TABLE_RSP 12
#define TSDB_MSG_TYPE_DNODE_REMOVE_TABLE_RSP 12
// dnodeMgmt
#define TSDB_MSG_TYPE_CREATE_VNODE 13
#define TSDB_MSG_TYPE_CREATE_VNODE 13
#define TSDB_MSG_TYPE_CREATE_VNODE_RSP 14
#define TSDB_MSG_TYPE_CREATE_VNODE_RSP 14
#define TSDB_MSG_TYPE_FREE_VNODE 15
#define TSDB_MSG_TYPE_DROP_VNODE 15
#define TSDB_MSG_TYPE_FREE_VNODE_RSP 16
#define TSDB_MSG_TYPE_DROP_VNODE_RSP 16
#define TSDB_MSG_TYPE_ALTER_VNODE 17
#define TSDB_MSG_TYPE_ALTER_VNODE_RSP 18
#define TSDB_MSG_TYPE_CONFIG_VNODE 19
#define TSDB_MSG_TYPE_CONFIG_VNODE_RSP 20
#define TSDB_MSG_TYPE_DNODE_CFG 17
#define TSDB_MSG_TYPE_DNODE_CFG 17
#define TSDB_MSG_TYPE_DNODE_CFG_RSP 18
#define TSDB_MSG_TYPE_DNODE_CFG_RSP 18
#define TSDB_MSG_TYPE_DNODE_ALTER_STREAM 19
#define TSDB_MSG_TYPE_DNODE_ALTER_STREAM 19
...
@@ -93,8 +100,7 @@ extern "C" {
...
@@ -93,8 +100,7 @@ extern "C" {
#define TSDB_MSG_TYPE_DROP_TABLE_RSP 66
#define TSDB_MSG_TYPE_DROP_TABLE_RSP 66
#define TSDB_MSG_TYPE_ALTER_TABLE 67
#define TSDB_MSG_TYPE_ALTER_TABLE 67
#define TSDB_MSG_TYPE_ALTER_TABLE_RSP 68
#define TSDB_MSG_TYPE_ALTER_TABLE_RSP 68
#define TSDB_MSG_TYPE_VNODE_CFG 69
#define TSDB_MSG_TYPE_VNODE_CFG_RSP 70
#define TSDB_MSG_TYPE_TABLE_CFG 71
#define TSDB_MSG_TYPE_TABLE_CFG 71
#define TSDB_MSG_TYPE_TABLE_CFG_RSP 72
#define TSDB_MSG_TYPE_TABLE_CFG_RSP 72
#define TSDB_MSG_TYPE_TABLE_META 73
#define TSDB_MSG_TYPE_TABLE_META 73
...
...
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
a305bb42
...
@@ -259,7 +259,7 @@ void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *p
...
@@ -259,7 +259,7 @@ void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *p
if
(
msgType
==
TSDB_MSG_TYPE_TABLE_CFG
)
{
if
(
msgType
==
TSDB_MSG_TYPE_TABLE_CFG
)
{
mgmtProcessTableCfgMsg
(
msgType
,
pCont
,
contLen
,
pConn
);
mgmtProcessTableCfgMsg
(
msgType
,
pCont
,
contLen
,
pConn
);
}
else
if
(
msgType
==
TSDB_MSG_TYPE_
VNODE_CFG
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_
CONFIG_VNODE
)
{
mgmtProcessVnodeCfgMsg
(
msgType
,
pCont
,
contLen
,
pConn
);
mgmtProcessVnodeCfgMsg
(
msgType
,
pCont
,
contLen
,
pConn
);
}
else
if
(
msgType
==
TSDB_MSG_TYPE_DNODE_CREATE_TABLE_RSP
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_DNODE_CREATE_TABLE_RSP
)
{
mgmtProcessCreateTableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
mgmtProcessCreateTableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
...
@@ -267,7 +267,7 @@ void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *p
...
@@ -267,7 +267,7 @@ void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *p
mgmtProcessRemoveTableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
mgmtProcessRemoveTableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
}
else
if
(
msgType
==
TSDB_MSG_TYPE_CREATE_VNODE_RSP
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_CREATE_VNODE_RSP
)
{
mgmtProcessCreateVnodeRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
mgmtProcessCreateVnodeRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
}
else
if
(
msgType
==
TSDB_MSG_TYPE_
FREE
_VNODE_RSP
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_
DROP
_VNODE_RSP
)
{
mgmtProcessFreeVnodeRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
mgmtProcessFreeVnodeRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
}
else
if
(
msgType
==
TSDB_MSG_TYPE_DROP_STABLE
)
{
}
else
if
(
msgType
==
TSDB_MSG_TYPE_DROP_STABLE
)
{
mgmtProcessDropStableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
mgmtProcessDropStableRsp
(
msgType
,
pCont
,
contLen
,
pConn
,
code
);
...
@@ -294,7 +294,7 @@ void mgmtSendOneFreeVnodeMsg(int32_t vnode, SRpcIpSet *ipSet, void *ahandle) {
...
@@ -294,7 +294,7 @@ void mgmtSendOneFreeVnodeMsg(int32_t vnode, SRpcIpSet *ipSet, void *ahandle) {
SFreeVnodeMsg
*
pFreeVnode
=
rpcMallocCont
(
sizeof
(
SFreeVnodeMsg
));
SFreeVnodeMsg
*
pFreeVnode
=
rpcMallocCont
(
sizeof
(
SFreeVnodeMsg
));
if
(
pFreeVnode
!=
NULL
)
{
if
(
pFreeVnode
!=
NULL
)
{
pFreeVnode
->
vnode
=
htonl
(
vnode
);
pFreeVnode
->
vnode
=
htonl
(
vnode
);
mgmtSendMsgToDnode
(
ipSet
,
TSDB_MSG_TYPE_
FREE
_VNODE
,
pFreeVnode
,
sizeof
(
SFreeVnodeMsg
),
ahandle
);
mgmtSendMsgToDnode
(
ipSet
,
TSDB_MSG_TYPE_
DROP
_VNODE
,
pFreeVnode
,
sizeof
(
SFreeVnodeMsg
),
ahandle
);
}
}
}
}
...
...
src/util/inc/tstatus.h
浏览文件 @
a305bb42
...
@@ -48,6 +48,7 @@ typedef enum _TSDB_VN_STATUS {
...
@@ -48,6 +48,7 @@ typedef enum _TSDB_VN_STATUS {
TSDB_VN_STATUS_MASTER
,
TSDB_VN_STATUS_MASTER
,
TSDB_VN_STATUS_CLOSING
,
TSDB_VN_STATUS_CLOSING
,
TSDB_VN_STATUS_DELETING
,
TSDB_VN_STATUS_DELETING
,
TSDB_VN_STATUS_NOT_READY
}
EVnodeStatus
;
}
EVnodeStatus
;
enum
_TSDB_VN_SYNC_STATUS
{
enum
_TSDB_VN_SYNC_STATUS
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录