Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
107518ee
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
107518ee
编写于
3月 31, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-17]
上级
5fb1dd5e
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
160 addition
and
91 deletion
+160
-91
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+85
-64
src/dnode/src/dnodeMnode.c
src/dnode/src/dnodeMnode.c
+6
-0
src/mnode/src/mgmtDServer.c
src/mnode/src/mgmtDServer.c
+31
-4
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+15
-10
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+10
-3
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+1
-0
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+1
-1
src/util/inc/tstatus.h
src/util/inc/tstatus.h
+2
-3
src/util/src/tstatus.c
src/util/src/tstatus.c
+2
-2
src/util/src/tutil.c
src/util/src/tutil.c
+2
-1
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+3
-3
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+2
-0
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
107518ee
...
...
@@ -30,24 +30,24 @@
#include "dnodeWrite.h"
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
refCount
;
// reference count
int8_t
dirty
;
int8_t
status
;
// status: master, slave, notready, deleting
int64_t
version
;
void
*
wworker
;
void
*
rworker
;
void
*
wal
;
void
*
tsdb
;
void
*
replica
;
void
*
events
;
void
*
cq
;
// continuous query
int32_t
vgId
;
// global vnode group ID
int32_t
refCount
;
// reference count
EVnodeStatus
status
;
// status: master, slave, notready, deleting
int64_t
version
;
void
*
wworker
;
void
*
rworker
;
void
*
wal
;
void
*
tsdb
;
void
*
replica
;
void
*
events
;
void
*
cq
;
// continuous query
}
SVnodeObj
;
static
int32_t
dnodeOpenVnodes
();
static
void
dnodeCleanupVnodes
();
static
int32_t
dnodeOpenVnode
(
int32_t
vnode
,
char
*
rootDir
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
);
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
cfg
);
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDoDropVnode
(
SVnodeObj
*
pVnode
);
...
...
@@ -89,9 +89,14 @@ int32_t dnodeInitMgmt() {
dError
(
"failed to init dnode timer"
);
return
-
1
;
}
taosTmrReset
(
dnodeSendStatusMsg
,
500
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
int32_t
code
=
dnodeOpenVnodes
();
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
-
1
;
}
return
dnodeOpenVnodes
();
taosTmrReset
(
dnodeSendStatusMsg
,
500
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
return
TSDB_CODE_SUCCESS
;
}
void
dnodeCleanupMgmt
()
{
...
...
@@ -140,7 +145,9 @@ void *dnodeGetVnode(int32_t vgId) {
return
NULL
;
}
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
dTrace
(
"pVnode:%p, vgroup:%d, get vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
return
pVnode
;
}
...
...
@@ -166,10 +173,24 @@ void *dnodeGetVnodeTsdb(void *pVnode) {
void
dnodeReleaseVnode
(
void
*
pVnodeRaw
)
{
SVnodeObj
*
pVnode
=
pVnodeRaw
;
int32_t
count
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
count
==
0
&&
pVnode
->
dirty
)
{
dnodeDoDropVnode
(
pVnode
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
{
if
(
refCount
<=
0
)
{
dPrint
(
"pVnode:%p, vgroup:%d, drop vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dnodeDoDropVnode
(
pVnode
);
}
else
{
dTrace
(
"pVnode:%p, vgroup:%d, vnode will be dropped until refCount:%d is 0"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
}
}
else
if
(
pVnode
->
status
==
TSDB_VN_STATUS_CLOSING
)
{
if
(
refCount
<=
0
)
{
dPrint
(
"pVnode:%p, vgroup:%d, cleanup vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dnodeDoCleanupVnode
(
pVnode
);
}
else
{
dTrace
(
"pVnode:%p, vgroup:%d, vnode will cleanup until refCount:%d is 0"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
}
}
else
{
dTrace
(
"pVnode:%p, vgroup:%d, release vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
}
}
...
...
@@ -210,42 +231,42 @@ static void dnodeCleanupVnodes() {
}
static
int32_t
dnodeOpenVnode
(
int32_t
vnode
,
char
*
rootDir
)
{
SVnodeObj
vnodeObj
=
{
0
};
vnodeObj
.
vgId
=
vnode
;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
(
char
*
)(
&
vnodeObj
));
char
tsdbDir
[
TSDB_FILENAME_LEN
];
sprintf
(
tsdbDir
,
"%s/tsdb"
,
rootDir
);
void
*
pTsdb
=
tsdbOpenRepo
(
tsdbDir
);
if
(
pTsdb
==
NULL
)
{
dError
(
"failed to open tsdb in vnode:%d %s, reason:%s"
,
vnode
,
tsdbDir
,
tstrerror
(
terrno
));
dError
(
"pVnode:%p, vgroup:%d, failed to open tsdb in %s, reason:%s"
,
pVnode
,
pVnode
->
vgId
,
tsdbDir
,
tstrerror
(
terrno
));
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
return
terrno
;
}
//STsdbRepoInfo *tsdbInfo = tsdbGetStatus(pTsdb);
SVnodeObj
vnodeObj
=
{
0
};
vnodeObj
.
vgId
=
vnode
;
//tsdbInfo->tsdbCfg.tsdbId;
vnodeObj
.
status
=
TSDB_VN_STATUS_NOT_READY
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
vnodeObj
.
wal
=
NULL
;
vnodeObj
.
tsdb
=
pTsdb
;
vnodeObj
.
replica
=
NULL
;
vnodeObj
.
events
=
NULL
;
vnodeObj
.
cq
=
NULL
;
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
(
char
*
)(
&
vnodeObj
));
pVnode
->
wal
=
NULL
;
pVnode
->
tsdb
=
pTsdb
;
pVnode
->
replica
=
NULL
;
pVnode
->
events
=
NULL
;
pVnode
->
cq
=
NULL
;
pVnode
->
wworker
=
dnodeAllocateWriteWorker
(
pVnode
);
pVnode
->
rworker
=
dnodeAllocateReadWorker
(
pVnode
);
dTrace
(
"open vnode:%d in %s"
,
pVnode
->
vgId
,
rootDir
);
//TODO: jude status while replca is not null
if
(
pVnode
->
replica
==
NULL
)
{
pVnode
->
status
=
TSDB_VN_STATUS_MASTER
;
}
dTrace
(
"pVnode:%p, vgroup:%d, vnode is opened in %s"
,
pVnode
,
pVnode
->
vgId
,
rootDir
);
return
TSDB_CODE_SUCCESS
;
}
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
}
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
)
{
dTrace
(
"pVnode:%p, vgroup:%d, cleanup vnode"
,
pVnode
,
pVnode
->
vgId
);
// remove replica
// remove read queue
...
...
@@ -263,8 +284,11 @@ static void dnodeCleanupVnode(SVnodeObj *pVnode) {
tsdbCloseRepo
(
pVnode
->
tsdb
);
pVnode
->
tsdb
=
NULL
;
}
}
dTrace
(
"cleanup vnode:%d"
,
pVnode
->
vgId
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
)
{
pVnode
->
status
=
TSDB_VN_STATUS_CLOSING
;
dnodeReleaseVnode
(
pVnode
);
}
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
pVnodeCfg
)
{
...
...
@@ -311,7 +335,7 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
SVnodeObj
vnodeObj
=
{
0
};
vnodeObj
.
vgId
=
pVnodeCfg
->
cfg
.
vgId
;
vnodeObj
.
status
=
TSDB_VN_STATUS_
NOT_READY
;
vnodeObj
.
status
=
TSDB_VN_STATUS_
CREATING
;
vnodeObj
.
refCount
=
1
;
vnodeObj
.
version
=
0
;
vnodeObj
.
wal
=
NULL
;
...
...
@@ -323,32 +347,27 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
taosAddIntHash
(
tsDnodeVnodesHash
,
vnodeObj
.
vgId
,
(
char
*
)(
&
vnodeObj
));
pVnode
->
wworker
=
dnodeAllocateWriteWorker
(
pVnode
);
pVnode
->
rworker
=
dnodeAllocateReadWorker
(
pVnode
);
if
(
pVnode
->
replica
==
NULL
)
{
pVnode
->
status
=
TSDB_VN_STATUS_MASTER
;
}
dPrint
(
"vgroup:%d, vnode:%d is created"
,
pVnode
->
vgId
,
pVnode
->
vgId
);
return
TSDB_CODE_SUCCESS
;
}
static
void
dnodeDoDropVnode
(
SVnodeObj
*
pVnode
)
{
if
(
pVnode
->
tsdb
)
{
tsdbDropRepo
(
pVnode
->
tsdb
);
pVnode
->
tsdb
=
NULL
;
}
dnodeCleanupVnode
(
pVnode
);
dnodeDoCleanupVnode
(
pVnode
);
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
tsVnodeDir
,
pVnode
->
vgId
);
dPrint
(
"pVnode:%p, vgroup:%d, drop file:%s from disk"
,
pVnode
,
pVnode
->
vgId
,
rootDir
);
// rmdir(rootDir);
}
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
)
{
pVnode
->
status
=
TSDB_VN_STATUS_NOT_READY
;
pVnode
->
dirty
=
true
;
int32_t
count
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
if
(
count
>
0
)
{
dTrace
(
"vgroup:%d, vnode will be dropped until refcount:%d is 0"
,
pVnode
->
vgId
,
count
);
return
;
}
dnodeDoDropVnode
(
pVnode
);
pVnode
->
status
=
TSDB_VN_STATUS_DELETING
;
dnodeReleaseVnode
(
pVnode
);
}
static
void
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
...
...
@@ -359,7 +378,7 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
pCreate
->
cfg
.
maxSessions
=
htonl
(
pCreate
->
cfg
.
maxSessions
);
pCreate
->
cfg
.
daysPerFile
=
htonl
(
pCreate
->
cfg
.
daysPerFile
);
dTrace
(
"vgroup:%d, start to create vnode
:%d in dnode"
,
pCreate
->
cfg
.
vgId
,
pCreate
->
cfg
.
vgId
);
dTrace
(
"vgroup:%d, start to create vnode
in dnode"
,
pCreate
->
cfg
.
vgId
);
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pCreate
->
cfg
.
vgId
);
if
(
pVnodeObj
!=
NULL
)
{
...
...
@@ -378,13 +397,13 @@ static void dnodeProcessDropVnodeMsg(SRpcMsg *rpcMsg) {
SMDDropVnodeMsg
*
pDrop
=
rpcMsg
->
pCont
;
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
dTrace
(
"vgroup:%d, start to drop vnode in dnode"
,
pDrop
->
vgId
);
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pDrop
->
vgId
);
if
(
pVnodeObj
!=
NULL
)
{
dPrint
(
"pVnode:%p, vgroup:%d, start to drop vnode in dnode"
,
pVnodeObj
,
pDrop
->
vgId
);
dnodeDropVnode
(
pVnodeObj
);
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
else
{
dTrace
(
"vgroup:%d, failed drop vnode in dnode, vgroup not exist"
,
pDrop
->
vgId
);
rpcRsp
.
code
=
TSDB_CODE_INVALID_VGROUP_ID
;
}
...
...
@@ -403,8 +422,10 @@ static void dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) {
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pCreate
->
cfg
.
vgId
);
if
(
pVnodeObj
!=
NULL
)
{
dPrint
(
"pVnode:%p, vgroup:%d, start to alter vnode in dnode"
,
pVnodeObj
,
pCreate
->
cfg
.
vgId
);
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
}
else
{
dTrace
(
"vgroup:%d, alter vnode msg received, start to create vnode"
,
pCreate
->
cfg
.
vgId
);
rpcRsp
.
code
=
dnodeCreateVnode
(
pCreate
);;
}
...
...
@@ -432,7 +453,8 @@ static void dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
static
void
dnodeBuildVloadMsg
(
char
*
pNode
,
void
*
param
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
pNode
;
if
(
pVnode
->
dirty
)
return
;
dPrint
(
"===> pVnode:%p, vgroup:%d status:%s"
,
pVnode
,
pVnode
->
vgId
,
taosGetVnodeStatusStr
(
pVnode
->
status
));
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
return
;
SDMStatusMsg
*
pStatus
=
param
;
if
(
pStatus
->
openVnodes
>=
TSDB_MAX_VNODES
)
return
;
...
...
@@ -528,4 +550,3 @@ void dnodeUpdateDnodeId(int32_t dnodeId) {
dnodeSaveDnodeId
();
}
}
src/dnode/src/dnodeMnode.c
浏览文件 @
107518ee
...
...
@@ -79,6 +79,12 @@ static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) {
return
;
}
if
(
pMsg
->
pCont
==
NULL
)
{
rspMsg
.
code
=
TSDB_CODE_INVALID_MSG_LEN
;
rpcSendResponse
(
&
rspMsg
);
return
;
}
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
...
...
src/mnode/src/mgmtDServer.c
浏览文件 @
107518ee
...
...
@@ -32,11 +32,11 @@
#include "mgmtTable.h"
#include "mgmtVgroup.h"
static
void
mgmtProcessMsgFromDnode
(
SRpcMsg
*
rpcMsg
);
static
int
mgmtDServerRetrieveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
static
void
(
*
mgmtProcessDnodeMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
rpcMsg
);
static
void
*
tsMgmtDServerRpc
;
static
void
*
tsMgmtDServerQhandle
=
NULL
;
int32_t
mgmtInitDServer
()
{
SRpcInit
rpcInit
=
{
0
};
...
...
@@ -56,11 +56,18 @@ int32_t mgmtInitDServer() {
return
-
1
;
}
tsMgmtDServerQhandle
=
taosInitScheduler
(
tsMaxShellConns
,
1
,
"MS"
);
mPrint
(
"server connection to dnode is opened"
);
return
0
;
}
void
mgmtCleanupDServer
()
{
if
(
tsMgmtDServerQhandle
)
{
taosCleanUpScheduler
(
tsMgmtDServerQhandle
);
tsMgmtDServerQhandle
=
NULL
;
}
if
(
tsMgmtDServerRpc
)
{
rpcClose
(
tsMgmtDServerRpc
);
tsMgmtDServerRpc
=
NULL
;
...
...
@@ -72,14 +79,34 @@ void mgmtAddDServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
mgmtProcessDnodeMsgFp
[
msgType
]
=
fp
;
}
static
void
mgmtProcessDServerRequest
(
SSchedMsg
*
sched
)
{
SRpcMsg
*
pMsg
=
sched
->
msg
;
(
*
mgmtProcessDnodeMsgFp
[
pMsg
->
msgType
])(
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
free
(
pMsg
);
}
static
void
mgmtAddToDServerQueue
(
SRpcMsg
*
pMsg
)
{
SSchedMsg
schedMsg
;
schedMsg
.
msg
=
pMsg
;
schedMsg
.
fp
=
mgmtProcessDServerRequest
;
taosScheduleTask
(
tsMgmtDServerQhandle
,
&
schedMsg
);
}
static
void
mgmtProcessMsgFromDnode
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
->
pCont
==
NULL
)
{
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_INVALID_MSG_LEN
);
return
;
}
if
(
mgmtProcessDnodeMsgFp
[
rpcMsg
->
msgType
])
{
(
*
mgmtProcessDnodeMsgFp
[
rpcMsg
->
msgType
])(
rpcMsg
);
SRpcMsg
*
pMsg
=
malloc
(
sizeof
(
SRpcMsg
));
memcpy
(
pMsg
,
rpcMsg
,
sizeof
(
SRpcMsg
));
mgmtAddToDServerQueue
(
pMsg
);
}
else
{
mError
(
"%s is not processed in dserver"
,
taosMsg
[
rpcMsg
->
msgType
]);
rpcFreeCont
(
rpcMsg
->
pCont
);
}
rpcFreeCont
(
rpcMsg
->
pCont
);
}
static
int
mgmtDServerRetrieveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
107518ee
...
...
@@ -144,19 +144,24 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
SDMStatusMsg
*
pStatus
=
rpcMsg
->
pCont
;
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
privateIp
=
htonl
(
pStatus
->
privateIp
);
pStatus
->
publicIp
=
htonl
(
pStatus
->
publicIp
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
);
SDnodeObj
*
pDnode
=
NULL
;
if
(
pStatus
->
dnodeId
==
0
)
{
pDnode
=
mgmtGetDnodeByIp
(
htonl
(
pStatus
->
privateIp
)
);
pDnode
=
mgmtGetDnodeByIp
(
pStatus
->
privateIp
);
if
(
pDnode
==
NULL
)
{
mTrace
(
"dnode not created, privateIp:%s"
,
taosIpStr
(
htonl
(
pStatus
->
privateIp
)
));
mTrace
(
"dnode not created, privateIp:%s"
,
taosIpStr
(
pStatus
->
privateIp
));
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_DNODE_NOT_EXIST
);
return
;
}
}
else
{
pDnode
=
mgmtGetDnode
(
pStatus
->
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%d, not exist, privateIp:%s"
,
taosIpStr
(
pStatus
->
dnodeId
),
pStatus
->
dnodeName
);
mError
(
"dnode:%d, not exist, privateIp:%s"
,
pStatus
->
dnodeId
,
taosIpStr
(
pStatus
->
privateIp
)
);
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_DNODE_NOT_EXIST
);
return
;
}
...
...
@@ -169,16 +174,16 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
return
;
}
pDnode
->
privateIp
=
htonl
(
pStatus
->
privateIp
)
;
pDnode
->
publicIp
=
htonl
(
pStatus
->
publicIp
)
;
pDnode
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
)
;
pDnode
->
numOfCores
=
htons
(
pStatus
->
numOfCores
)
;
pDnode
->
privateIp
=
pStatus
->
privateIp
;
pDnode
->
publicIp
=
pStatus
->
publicIp
;
pDnode
->
lastReboot
=
pStatus
->
lastReboot
;
pDnode
->
numOfCores
=
pStatus
->
numOfCores
;
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
)
;
pDnode
->
numOfTotalVnodes
=
pStatus
->
numOfTotalVnodes
;
if
(
pStatus
->
dnodeId
==
0
)
{
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s
,
"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
}
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
...
...
@@ -191,7 +196,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pDnode
->
vload
[
j
].
vgId
);
if
(
pVgroup
==
NULL
)
{
SRpcIpSet
ipSet
=
mgmtGetIpSetFromIp
(
pDnode
->
privateIp
);
mPrint
(
"dnode:%d, v
node
:%d not exist in mnode, drop it"
,
pDnode
->
dnodeId
,
pDnode
->
vload
[
j
].
vgId
);
mPrint
(
"dnode:%d, v
group
:%d not exist in mnode, drop it"
,
pDnode
->
dnodeId
,
pDnode
->
vload
[
j
].
vgId
);
mgmtSendDropVnodeMsg
(
pDnode
->
vload
[
j
].
vgId
,
&
ipSet
,
NULL
);
}
}
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
107518ee
...
...
@@ -131,6 +131,10 @@ void mgmtAddToShellQueue(SQueuedMsg *queuedMsg) {
}
static
void
mgmtProcessMsgFromShell
(
SRpcMsg
*
rpcMsg
)
{
if
(
rpcMsg
==
NULL
||
rpcMsg
->
pCont
==
NULL
)
{
return
;
}
if
(
!
mgmtInServerStatus
())
{
mgmtProcessMsgWhileNotReady
(
rpcMsg
);
rpcFreeCont
(
rpcMsg
->
pCont
);
...
...
@@ -221,14 +225,17 @@ static void mgmtProcessShowMsg(SQueuedMsg *pMsg) {
.
handle
=
pMsg
->
thandle
,
.
pCont
=
pShowRsp
,
.
contLen
=
sizeof
(
SCMShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
,
.
code
=
code
,
.
msgType
=
0
.
code
=
code
};
rpcSendResponse
(
&
rpcRsp
);
}
else
{
mError
(
"show:%p, type:%s, failed to get meta, reason:%s"
,
pShow
,
taosGetShowTypeStr
(
pShowMsg
->
type
),
tstrerror
(
code
));
mgmtFreeQhandle
(
pShow
);
rpcFreeCont
(
pShowRsp
);
SRpcMsg
rpcRsp
=
{
.
handle
=
pMsg
->
thandle
,
.
code
=
code
};
rpcSendResponse
(
&
rpcRsp
);
}
}
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
107518ee
...
...
@@ -490,6 +490,7 @@ void mgmtDropAllUsers(SAcctObj *pAcct) {
SUserObj
*
pUser
=
NULL
;
while
(
1
)
{
pLastNode
=
pNode
;
pNode
=
sdbFetchRow
(
tsUserSdb
,
pNode
,
(
void
**
)
&
pUser
);
if
(
pUser
==
NULL
)
break
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
107518ee
...
...
@@ -602,7 +602,7 @@ static void mgmtSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle) {
}
static
void
mgmtProcessDropVnodeRsp
(
SRpcMsg
*
rpcMsg
)
{
mTrace
(
"drop vnode
msg
is received"
);
mTrace
(
"drop vnode
rsp
is received"
);
if
(
rpcMsg
->
handle
==
NULL
)
return
;
SQueuedMsg
*
queueMsg
=
rpcMsg
->
handle
;
...
...
src/util/inc/tstatus.h
浏览文件 @
107518ee
...
...
@@ -41,14 +41,13 @@ enum _TSDB_DB_STATUS {
};
typedef
enum
_TSDB_VN_STATUS
{
TSDB_VN_STATUS_OFFLINE
,
TSDB_VN_STATUS_CREATING
,
TSDB_VN_STATUS_NOT_READY
,
TSDB_VN_STATUS_UNSYNCED
,
TSDB_VN_STATUS_SLAVE
,
TSDB_VN_STATUS_MASTER
,
TSDB_VN_STATUS_CREATING
,
TSDB_VN_STATUS_CLOSING
,
TSDB_VN_STATUS_DELETING
,
TSDB_VN_STATUS_NOT_READY
}
EVnodeStatus
;
enum
_TSDB_VN_SYNC_STATUS
{
...
...
src/util/src/tstatus.c
浏览文件 @
107518ee
...
...
@@ -40,11 +40,11 @@ char* taosGetDbStatusStr(int32_t dbStatus) {
char
*
taosGetVnodeStatusStr
(
int32_t
vnodeStatus
)
{
switch
(
vnodeStatus
)
{
case
TSDB_VN_STATUS_OFFLINE
:
return
"offline"
;
case
TSDB_VN_STATUS_CREATING
:
return
"creating"
;
case
TSDB_VN_STATUS_NOT_READY
:
return
"not_ready"
;
case
TSDB_VN_STATUS_UNSYNCED
:
return
"unsynced"
;
case
TSDB_VN_STATUS_SLAVE
:
return
"slave"
;
case
TSDB_VN_STATUS_MASTER
:
return
"master"
;
case
TSDB_VN_STATUS_CREATING
:
return
"creating"
;
case
TSDB_VN_STATUS_CLOSING
:
return
"closing"
;
case
TSDB_VN_STATUS_DELETING
:
return
"deleting"
;
default:
return
"undefined"
;
...
...
src/util/src/tutil.c
浏览文件 @
107518ee
...
...
@@ -583,7 +583,8 @@ char *taosIpStr(uint32_t ipInt) {
static
int
ipStrIndex
=
0
;
char
*
ipStr
=
ipStrArray
[(
ipStrIndex
++
)
%
3
];
sprintf
(
ipStr
,
"0x%x:%u.%u.%u.%u"
,
ipInt
,
ipInt
&
0xFF
,
(
ipInt
>>
8
)
&
0xFF
,
(
ipInt
>>
16
)
&
0xFF
,
(
uint8_t
)(
ipInt
>>
24
));
//sprintf(ipStr, "0x%x:%u.%u.%u.%u", ipInt, ipInt & 0xFF, (ipInt >> 8) & 0xFF, (ipInt >> 16) & 0xFF, (uint8_t)(ipInt >> 24));
sprintf
(
ipStr
,
"%u.%u.%u.%u"
,
ipInt
&
0xFF
,
(
ipInt
>>
8
)
&
0xFF
,
(
ipInt
>>
16
)
&
0xFF
,
(
uint8_t
)(
ipInt
>>
24
));
return
ipStr
;
}
...
...
tests/script/sh/deploy.sh
浏览文件 @
107518ee
...
...
@@ -90,9 +90,9 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG
echo
"publicIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"internalIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"privateIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"mDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"mDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 135"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
...
...
tests/script/tmp/prepare.sim
0 → 100644
浏览文件 @
107518ee
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录