Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9ec58c6a
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
9ec58c6a
编写于
4月 01, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/2.0tsdb
上级
33f6755a
f1a90648
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
244 addition
and
71 deletion
+244
-71
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+1
-1
src/dnode/src/dnodeMClient.c
src/dnode/src/dnodeMClient.c
+3
-1
src/dnode/src/dnodeMain.c
src/dnode/src/dnodeMain.c
+8
-10
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+14
-19
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+1
-0
src/mnode/src/mgmtBalance.c
src/mnode/src/mgmtBalance.c
+27
-37
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+14
-0
src/mnode/src/mgmtMain.c
src/mnode/src/mgmtMain.c
+2
-0
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+2
-2
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+2
-1
tests/script/unique/account/paras.sim
tests/script/unique/account/paras.sim
+111
-0
tests/script/unique/account/usage.sim
tests/script/unique/account/usage.sim
+57
-0
tests/script/unique/testSuite.sim
tests/script/unique/testSuite.sim
+2
-0
未找到文件。
src/client/src/tscSystem.c
浏览文件 @
9ec58c6a
...
@@ -93,7 +93,7 @@ int32_t tscInitRpc(const char *user, const char *secret) {
...
@@ -93,7 +93,7 @@ int32_t tscInitRpc(const char *user, const char *secret) {
rpcInit
.
sessions
=
tsMaxMgmtConnections
;
rpcInit
.
sessions
=
tsMaxMgmtConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
2000
;
rpcInit
.
idleTime
=
2000
;
rpcInit
.
user
=
"root"
;
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
secret
=
secretEncrypt
;
rpcInit
.
secret
=
secretEncrypt
;
...
...
src/dnode/src/dnodeMClient.c
浏览文件 @
9ec58c6a
...
@@ -128,7 +128,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -128,7 +128,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
}
}
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
if
(
tsDnodeMClientRpc
)
{
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsDnodeMnodeIpList
,
rpcMsg
);
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsDnodeMnodeIpList
,
rpcMsg
);
}
}
}
static
bool
dnodeReadMnodeIpList
()
{
static
bool
dnodeReadMnodeIpList
()
{
...
...
src/dnode/src/dnodeMain.c
浏览文件 @
9ec58c6a
...
@@ -37,7 +37,6 @@ static void dnodeSetRunStatus(SDnodeRunStatus status);
...
@@ -37,7 +37,6 @@ static void dnodeSetRunStatus(SDnodeRunStatus status);
static
void
signal_handler
(
int32_t
signum
,
siginfo_t
*
sigInfo
,
void
*
context
);
static
void
signal_handler
(
int32_t
signum
,
siginfo_t
*
sigInfo
,
void
*
context
);
static
void
dnodeCheckDataDirOpenned
(
char
*
dir
);
static
void
dnodeCheckDataDirOpenned
(
char
*
dir
);
static
SDnodeRunStatus
tsDnodeRunStatus
=
TSDB_DNODE_RUN_STATUS_STOPPED
;
static
SDnodeRunStatus
tsDnodeRunStatus
=
TSDB_DNODE_RUN_STATUS_STOPPED
;
void
(
*
dnodeParseParameterKFp
)()
=
NULL
;
int32_t
main
(
int32_t
argc
,
char
*
argv
[])
{
int32_t
main
(
int32_t
argc
,
char
*
argv
[])
{
// Set global configuration file
// Set global configuration file
...
@@ -57,25 +56,24 @@ int32_t main(int32_t argc, char *argv[]) {
...
@@ -57,25 +56,24 @@ int32_t main(int32_t argc, char *argv[]) {
printf
(
"buildinfo: %s
\n
"
,
buildinfo
);
printf
(
"buildinfo: %s
\n
"
,
buildinfo
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
else
if
(
strcmp
(
argv
[
i
],
"-k"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-k"
)
==
0
)
{
if
(
dnodeParseParameterKFp
)
{
grantParseParameter
();
dnodeParseParameterKFp
();
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
#ifdef TAOS_MEM_CHECK
#ifdef TAOS_MEM_CHECK
}
else
if
(
strcmp
(
argv
[
i
],
"--alloc-random-fail"
)
==
0
)
{
else
if
(
strcmp
(
argv
[
i
],
"--alloc-random-fail"
)
==
0
)
{
if
((
i
<
argc
-
1
)
&&
(
argv
[
i
+
1
][
0
]
!=
'-'
))
{
if
((
i
<
argc
-
1
)
&&
(
argv
[
i
+
1
][
0
]
!=
'-'
))
{
taosSetAllocMode
(
TAOS_ALLOC_MODE_RANDOM_FAIL
,
argv
[
++
i
],
true
);
taosSetAllocMode
(
TAOS_ALLOC_MODE_RANDOM_FAIL
,
argv
[
++
i
],
true
);
}
else
{
}
else
{
taosSetAllocMode
(
TAOS_ALLOC_MODE_RANDOM_FAIL
,
NULL
,
true
);
taosSetAllocMode
(
TAOS_ALLOC_MODE_RANDOM_FAIL
,
NULL
,
true
);
}
}
}
else
if
(
strcmp
(
argv
[
i
],
"--detect-mem-leak"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"--detect-mem-leak"
)
==
0
)
{
if
((
i
<
argc
-
1
)
&&
(
argv
[
i
+
1
][
0
]
!=
'-'
))
{
if
((
i
<
argc
-
1
)
&&
(
argv
[
i
+
1
][
0
]
!=
'-'
))
{
taosSetAllocMode
(
TAOS_ALLOC_MODE_DETECT_LEAK
,
argv
[
++
i
],
true
);
taosSetAllocMode
(
TAOS_ALLOC_MODE_DETECT_LEAK
,
argv
[
++
i
],
true
);
}
else
{
}
else
{
taosSetAllocMode
(
TAOS_ALLOC_MODE_DETECT_LEAK
,
NULL
,
true
);
taosSetAllocMode
(
TAOS_ALLOC_MODE_DETECT_LEAK
,
NULL
,
true
);
}
}
#endif
}
}
#endif
}
}
/* Set termination handler. */
/* Set termination handler. */
...
@@ -180,9 +178,9 @@ static void dnodeCleanUpSystem() {
...
@@ -180,9 +178,9 @@ static void dnodeCleanUpSystem() {
tclearModuleStatus
(
TSDB_MOD_MGMT
);
tclearModuleStatus
(
TSDB_MOD_MGMT
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_STOPPED
);
dnodeCleanupShell
();
dnodeCleanupShell
();
dnodeCleanupMClient
();
dnodeCleanupMnode
();
dnodeCleanupMnode
();
dnodeCleanupMgmt
();
dnodeCleanupMgmt
();
dnodeCleanupMClient
();
dnodeCleanupWrite
();
dnodeCleanupWrite
();
dnodeCleanupRead
();
dnodeCleanupRead
();
dnodeCleanUpModules
();
dnodeCleanUpModules
();
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
9ec58c6a
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
#include "dnodeRead.h"
#include "dnodeRead.h"
#include "dnodeWrite.h"
#include "dnodeWrite.h"
typedef
enum
{
CLOSE_TSDB
,
DROP_TSDB
}
ECloseTsdbFlag
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
vgId
;
// global vnode group ID
int32_t
refCount
;
// reference count
int32_t
refCount
;
// reference count
...
@@ -47,10 +49,9 @@ static int32_t dnodeOpenVnodes();
...
@@ -47,10 +49,9 @@ static int32_t dnodeOpenVnodes();
static
void
dnodeCleanupVnodes
();
static
void
dnodeCleanupVnodes
();
static
int32_t
dnodeOpenVnode
(
int32_t
vnode
,
char
*
rootDir
);
static
int32_t
dnodeOpenVnode
(
int32_t
vnode
,
char
*
rootDir
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeCleanupVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
,
ECloseTsdbFlag
dropFlag
);
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
cfg
);
static
int32_t
dnodeCreateVnode
(
SMDCreateVnodeMsg
*
cfg
);
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
);
static
void
dnodeDoDropVnode
(
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
);
...
@@ -178,14 +179,14 @@ void dnodeReleaseVnode(void *pVnodeRaw) {
...
@@ -178,14 +179,14 @@ void dnodeReleaseVnode(void *pVnodeRaw) {
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
{
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
{
if
(
refCount
<=
0
)
{
if
(
refCount
<=
0
)
{
dPrint
(
"pVnode:%p, vgroup:%d, drop vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dPrint
(
"pVnode:%p, vgroup:%d, drop vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dnodeDo
DropVnode
(
pVnode
);
dnodeDo
CleanupVnode
(
pVnode
,
DROP_TSDB
);
}
else
{
}
else
{
dTrace
(
"pVnode:%p, vgroup:%d, vnode will be dropped until refCount:%d is 0"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
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
)
{
}
else
if
(
pVnode
->
status
==
TSDB_VN_STATUS_CLOSING
)
{
if
(
refCount
<=
0
)
{
if
(
refCount
<=
0
)
{
dPrint
(
"pVnode:%p, vgroup:%d, cleanup vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dPrint
(
"pVnode:%p, vgroup:%d, cleanup vnode, refCount:%d"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dnodeDoCleanupVnode
(
pVnode
);
dnodeDoCleanupVnode
(
pVnode
,
CLOSE_TSDB
);
}
else
{
}
else
{
dTrace
(
"pVnode:%p, vgroup:%d, vnode will cleanup until refCount:%d is 0"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
dTrace
(
"pVnode:%p, vgroup:%d, vnode will cleanup until refCount:%d is 0"
,
pVnode
,
pVnode
->
vgId
,
refCount
);
}
}
...
@@ -264,7 +265,7 @@ static int32_t dnodeOpenVnode(int32_t vnode, char *rootDir) {
...
@@ -264,7 +265,7 @@ static int32_t dnodeOpenVnode(int32_t vnode, char *rootDir) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
)
{
static
void
dnodeDoCleanupVnode
(
SVnodeObj
*
pVnode
,
ECloseTsdbFlag
closeFlag
)
{
dTrace
(
"pVnode:%p, vgroup:%d, cleanup vnode"
,
pVnode
,
pVnode
->
vgId
);
dTrace
(
"pVnode:%p, vgroup:%d, cleanup vnode"
,
pVnode
,
pVnode
->
vgId
);
// remove replica
// remove replica
...
@@ -281,7 +282,12 @@ static void dnodeDoCleanupVnode(SVnodeObj *pVnode) {
...
@@ -281,7 +282,12 @@ static void dnodeDoCleanupVnode(SVnodeObj *pVnode) {
// remove tsdb
// remove tsdb
if
(
pVnode
->
tsdb
)
{
if
(
pVnode
->
tsdb
)
{
if
(
closeFlag
==
DROP_TSDB
)
{
tsdbDropRepo
(
pVnode
->
tsdb
);
}
else
if
(
closeFlag
==
CLOSE_TSDB
)
{
tsdbCloseRepo
(
pVnode
->
tsdb
);
tsdbCloseRepo
(
pVnode
->
tsdb
);
}
taosDeleteIntHash
(
tsDnodeVnodesHash
,
pVnode
->
vgId
);
pVnode
->
tsdb
=
NULL
;
pVnode
->
tsdb
=
NULL
;
}
}
}
}
...
@@ -351,20 +357,10 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
...
@@ -351,20 +357,10 @@ static int32_t dnodeCreateVnode(SMDCreateVnodeMsg *pVnodeCfg) {
pVnode
->
status
=
TSDB_VN_STATUS_MASTER
;
pVnode
->
status
=
TSDB_VN_STATUS_MASTER
;
}
}
dPrint
(
"
vgroup:%d, vnode:%d is created"
,
pVnode
->
vgId
,
pVnode
->
vgId
);
dPrint
(
"
pVnode:%p, vgroup:%d, vnode:%d is created"
,
pVnode
,
pVnode
->
vgId
,
pVnode
->
vgId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
void
dnodeDoDropVnode
(
SVnodeObj
*
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
)
{
static
void
dnodeDropVnode
(
SVnodeObj
*
pVnode
)
{
pVnode
->
status
=
TSDB_VN_STATUS_DELETING
;
pVnode
->
status
=
TSDB_VN_STATUS_DELETING
;
dnodeReleaseVnode
(
pVnode
);
dnodeReleaseVnode
(
pVnode
);
...
@@ -383,7 +379,7 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -383,7 +379,7 @@ static void dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pCreate
->
cfg
.
vgId
);
SVnodeObj
*
pVnodeObj
=
(
SVnodeObj
*
)
taosGetIntHashData
(
tsDnodeVnodesHash
,
pCreate
->
cfg
.
vgId
);
if
(
pVnodeObj
!=
NULL
)
{
if
(
pVnodeObj
!=
NULL
)
{
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
rpcRsp
.
code
=
TSDB_CODE_SUCCESS
;
dPrint
(
"
vgroup:%d, vnode is already exist"
,
pCreate
->
cfg
.
vgId
);
dPrint
(
"
pVnode:%p, vgroup:%d, vnode is already exist"
,
pVnodeObj
,
pCreate
->
cfg
.
vgId
);
}
else
{
}
else
{
rpcRsp
.
code
=
dnodeCreateVnode
(
pCreate
);
rpcRsp
.
code
=
dnodeCreateVnode
(
pCreate
);
}
}
...
@@ -453,7 +449,6 @@ static void dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
...
@@ -453,7 +449,6 @@ static void dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
static
void
dnodeBuildVloadMsg
(
char
*
pNode
,
void
*
param
)
{
static
void
dnodeBuildVloadMsg
(
char
*
pNode
,
void
*
param
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
pNode
;
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
pNode
;
dPrint
(
"===> pVnode:%p, vgroup:%d status:%s"
,
pVnode
,
pVnode
->
vgId
,
taosGetVnodeStatusStr
(
pVnode
->
status
));
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
return
;
if
(
pVnode
->
status
==
TSDB_VN_STATUS_DELETING
)
return
;
SDMStatusMsg
*
pStatus
=
param
;
SDMStatusMsg
*
pStatus
=
param
;
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
9ec58c6a
...
@@ -24,6 +24,7 @@ extern "C" {
...
@@ -24,6 +24,7 @@ extern "C" {
int32_t
mgmtInitDnodes
();
int32_t
mgmtInitDnodes
();
void
mgmtCleanUpDnodes
();
void
mgmtCleanUpDnodes
();
int32_t
mgmtGetDnodesNum
();
int32_t
mgmtGetDnodesNum
();
void
*
mgmtGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
);
SDnodeObj
*
mgmtGetDnode
(
int32_t
dnodeId
);
SDnodeObj
*
mgmtGetDnode
(
int32_t
dnodeId
);
SDnodeObj
*
mgmtGetDnodeByIp
(
uint32_t
ip
);
SDnodeObj
*
mgmtGetDnodeByIp
(
uint32_t
ip
);
...
...
src/mnode/src/mgmtBalance.c
浏览文件 @
9ec58c6a
...
@@ -18,47 +18,37 @@
...
@@ -18,47 +18,37 @@
#include "mgmtBalance.h"
#include "mgmtBalance.h"
#include "mgmtDnode.h"
#include "mgmtDnode.h"
int32_t
(
*
mgmtInitBalanceFp
)()
=
NULL
;
int32_t
mgmtInitBalance
()
{
return
0
;
}
void
(
*
mgmtCleanupBalanceFp
)()
=
NULL
;
void
mgmtCleanupBalance
()
{}
void
(
*
mgmtStartBalanceTimerFp
)(
int32_t
afterMs
)
=
NULL
;
void
mgmtStartBalanceTimer
(
int32_t
afterMs
)
{}
int32_t
(
*
mgmtAllocVnodesFp
)(
SVgObj
*
pVgroup
)
=
NULL
;
int32_t
mgmtInitBalance
()
{
int32_t
mgmtAllocVnodes
(
SVgObj
*
pVgroup
)
{
if
(
mgmtInitBalanceFp
)
{
void
*
pNode
=
NULL
;
return
(
*
mgmtInitBalanceFp
)();
SDnodeObj
*
pDnode
=
NULL
;
}
else
{
SDnodeObj
*
pSelDnode
=
NULL
;
return
0
;
float
vnodeUsage
=
1
.
0
;
}
}
while
(
1
)
{
pNode
=
mgmtGetNextDnode
(
pNode
,
&
pDnode
);
void
mgmtCleanupBalance
()
{
if
(
pDnode
==
NULL
)
break
;
if
(
mgmtCleanupBalanceFp
)
{
if
(
pDnode
->
numOfTotalVnodes
<=
0
)
continue
;
(
*
mgmtCleanupBalanceFp
)();
if
(
pDnode
->
openVnodes
==
pDnode
->
numOfTotalVnodes
)
continue
;
float
usage
=
(
float
)
pDnode
->
openVnodes
/
pDnode
->
numOfTotalVnodes
;
if
(
usage
<=
vnodeUsage
)
{
pSelDnode
=
pDnode
;
vnodeUsage
=
usage
;
}
}
}
void
mgmtStartBalanceTimer
(
int32_t
afterMs
)
{
if
(
mgmtStartBalanceTimerFp
)
{
(
*
mgmtStartBalanceTimerFp
)(
afterMs
);
}
}
}
int32_t
mgmtAllocVnodes
(
SVgObj
*
pVgroup
)
{
if
(
pSelDnode
==
NULL
)
{
if
(
mgmtAllocVnodesFp
)
{
mError
(
"failed to alloc vnode to vgroup"
,
pDnode
->
dnodeId
);
return
(
*
mgmtAllocVnodesFp
)(
pVgroup
)
;
return
TSDB_CODE_NO_ENOUGH_DNODES
;
}
}
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
1
);
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pSelDnode
->
dnodeId
;
if
(
pDnode
==
NULL
)
return
TSDB_CODE_OTHERS
;
pVgroup
->
vnodeGid
[
0
].
privateIp
=
pSelDnode
->
privateIp
;
pVgroup
->
vnodeGid
[
0
].
publicIp
=
pSelDnode
->
publicIp
;
if
(
pDnode
->
openVnodes
<
pDnode
->
numOfTotalVnodes
)
{
mTrace
(
"dnode:%d, alloc one vnode to vgroup"
,
pSelDnode
->
dnodeId
);
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pDnode
->
dnodeId
;
pVgroup
->
vnodeGid
[
0
].
privateIp
=
pDnode
->
privateIp
;
pVgroup
->
vnodeGid
[
0
].
publicIp
=
pDnode
->
publicIp
;
mTrace
(
"dnode:%d, alloc one vnode to vgroup"
,
pDnode
->
dnodeId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
mError
(
"dnode:%d, failed to alloc vnode to vgroup"
,
pDnode
->
dnodeId
);
return
TSDB_CODE_NO_ENOUGH_DNODES
;
}
}
}
src/mnode/src/mgmtDnode.c
浏览文件 @
9ec58c6a
...
@@ -32,6 +32,7 @@ static void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg);
...
@@ -32,6 +32,7 @@ static void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg);
extern
int32_t
clusterInit
();
extern
int32_t
clusterInit
();
extern
void
clusterCleanUp
();
extern
void
clusterCleanUp
();
extern
int32_t
clusterGetDnodesNum
();
extern
int32_t
clusterGetDnodesNum
();
extern
void
*
clusterGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
);
extern
SDnodeObj
*
clusterGetDnode
(
int32_t
dnodeId
);
extern
SDnodeObj
*
clusterGetDnode
(
int32_t
dnodeId
);
extern
SDnodeObj
*
clusterGetDnodeByIp
(
uint32_t
ip
);
extern
SDnodeObj
*
clusterGetDnodeByIp
(
uint32_t
ip
);
static
SDnodeObj
tsDnodeObj
=
{
0
};
static
SDnodeObj
tsDnodeObj
=
{
0
};
...
@@ -98,6 +99,19 @@ int32_t mgmtGetDnodesNum() {
...
@@ -98,6 +99,19 @@ int32_t mgmtGetDnodesNum() {
#endif
#endif
}
}
void
*
mgmtGetNextDnode
(
void
*
pNode
,
SDnodeObj
**
pDnode
)
{
#ifdef _CLUSTER
return
(
*
clusterGetNextDnode
)(
pNode
,
pDnode
);
#else
if
(
*
pDnode
==
NULL
)
{
*
pDnode
=
&
tsDnodeObj
;
}
else
{
*
pDnode
=
NULL
;
}
return
*
pDnode
;
#endif
}
void
mgmtProcessCfgDnodeMsg
(
SQueuedMsg
*
pMsg
)
{
void
mgmtProcessCfgDnodeMsg
(
SQueuedMsg
*
pMsg
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
thandle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
0
,
.
msgType
=
0
};
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
thandle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
0
,
.
msgType
=
0
};
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
return
;
if
(
mgmtCheckRedirect
(
pMsg
->
thandle
))
return
;
...
...
src/mnode/src/mgmtMain.c
浏览文件 @
9ec58c6a
...
@@ -126,6 +126,8 @@ int32_t mgmtStartSystem() {
...
@@ -126,6 +126,8 @@ int32_t mgmtStartSystem() {
mError
(
"failed to init dnode balance"
)
mError
(
"failed to init dnode balance"
)
}
}
grantReset
(
TSDB_GRANT_ALL
,
0
);
mPrint
(
"TDengine mgmt is initialized successfully"
);
mPrint
(
"TDengine mgmt is initialized successfully"
);
return
0
;
return
0
;
...
...
tests/script/sh/deploy.sh
浏览文件 @
9ec58c6a
...
@@ -90,9 +90,9 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG
...
@@ -90,9 +90,9 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG
echo
"publicIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"publicIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"internalIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"internalIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"privateIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"privateIp
$NODE_IP
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"dDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"mDebugFlag 199"
>>
$TAOS_CFG
echo
"mDebugFlag 199"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
99
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 135"
>>
$TAOS_CFG
echo
"rpcDebugFlag 135"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
...
...
tests/script/tmp/prepare.sim
浏览文件 @
9ec58c6a
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/deploy.sh -n dnode2 -m 192.168.0.1 -i 192.168.0.2
\ No newline at end of file
tests/script/unique/account/paras.sim
0 → 100644
浏览文件 @
9ec58c6a
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/exec_up.sh -n dnode1 -s start
sql connect
print =============== show accounts
sql show accounts
if $rows != 1 then
return -1
endi
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != root then
return -1
endi
if $data02 != 3/10 then
return -1
endi
if $data03 != 0/64 then
return -1
endi
if $data04 != 0/2147483647 then
return -1
endi
if $data05 != 0/1000 then
return -1
endi
if $data06 != 0.000/unlimited then
return -1
endi
print =============== create account
sql create account hou pass "hou" tseries 80000 storage 10737418240 streams 10 qtime 3600 dbs 3 users 3 conns 10
sql show accounts
if $rows != 2 then
return -1
endi
print $data10 $data11 $data12 $data13 $data14 $data15 $data16
if $data10 != hou then
return -1
endi
if $data12 != 2/3 then
return -1
endi
if $data13 != 0/3 then
return -1
endi
if $data14 != 0/80000 then
return -1
endi
if $data15 != 0/10 then
return -1
endi
if $data16 != 0.000/10.000 then
return -1
endi
print =============== alter account
sql alter account hou pass "hou" tseries 8000 streams 10 dbs 5 users 5
sql show accounts
if $rows != 2 then
return -1
endi
print $data10 $data11 $data12 $data13 $data14 $data15 $data16
if $data10 != hou then
return -1
endi
if $data12 != 2/5 then
return -1
endi
if $data13 != 0/5 then
return -1
endi
if $data14 != 0/8000 then
return -1
endi
if $data15 != 0/10 then
return -1
endi
if $data16 != 0.000/10.000 then
return -1
endi
print =============== alter account
sql create account hou pass "hou" tseries 8000 streams 10 dbs 5 users 6
sql show accounts
if $rows != 2 then
return -1
endi
print $data10 $data11 $data12 $data13 $data14 $data15 $data16
if $data10 != hou then
return -1
endi
if $data12 != 2/6 then
return -1
endi
if $data13 != 0/5 then
return -1
endi
if $data14 != 0/8000 then
return -1
endi
if $data15 != 0/10 then
return -1
endi
if $data16 != 0.000/10.000 then
return -1
endi
tests/script/unique/account/usage.sim
0 → 100644
浏览文件 @
9ec58c6a
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/exec_up.sh -n dnode1 -s start
sql connect
print =============== show accounts
print =============== create account
sql alter account root pass "taosdata" tseries 8000 streams 10 dbs 5 users 5
sql show accounts
print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != root then
return -1
endi
if $data02 != 3/5 then
return -1
endi
if $data03 != 0/5 then
return -1
endi
if $data04 != 0/8000 then
return -1
endi
if $data05 != 0/10 then
return -1
endi
print =============== check usage account
sql create database d1
sql create database d2
sql create database d3
sql create database d4
sql create database d5
sql create table d1.t1 (ts timestamp, i int);
sql create user u1 pass "u1"
sql show accounts
print $data10 $data11 $data12 $data13 $data14 $data15 $data16
if $data00 != root then
return -1
endi
if $data02 != 4/5 then
return -1
endi
if $data03 != 5/5 then
return -1
endi
if $data04 != 1/8000 then
return -1
endi
if $data05 != 0/10 then
return -1
endi
print =============== check grant
sql_error create database d6
\ No newline at end of file
tests/script/unique/testSuite.sim
浏览文件 @
9ec58c6a
#################################
#################################
run unique/account/basic.sim
run unique/account/basic.sim
run unique/account/paras.sim
run unique/account/usage.sim
##################################
##################################
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录