Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
20ed725b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
20ed725b
编写于
7月 24, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2757 from taosdata/feature/vnode
Feature/vnode
上级
b1a77eda
9eee4231
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
352 addition
and
96 deletion
+352
-96
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+4
-4
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+4
-4
src/inc/taoserror.h
src/inc/taoserror.h
+11
-6
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/inc/tbalance.h
src/inc/tbalance.h
+1
-1
src/mnode/src/mnodeBalance.c
src/mnode/src/mnodeBalance.c
+1
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+12
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+95
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-1
tests/script/tmp/mnodes.sim
tests/script/tmp/mnodes.sim
+15
-55
tests/script/unique/cluster/alter.sim
tests/script/unique/cluster/alter.sim
+174
-0
tests/test/c/CMakeLists.txt
tests/test/c/CMakeLists.txt
+2
-2
tests/test/c/insertPerRow.c
tests/test/c/insertPerRow.c
+23
-13
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+6
-6
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
20ed725b
...
...
@@ -358,7 +358,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
case
TSDB_SQL_CFG_DNODE
:
{
const
char
*
msg2
=
"invalid configure options or values, such as resetlog / debugFlag 135 / balance 'vnode:
1
-dnode:2' / monitor 1 "
;
const
char
*
msg2
=
"invalid configure options or values, such as resetlog / debugFlag 135 / balance 'vnode:
2
-dnode:2' / monitor 1 "
;
const
char
*
msg3
=
"invalid dnode ep"
;
/* validate the ip address */
...
...
@@ -4700,10 +4700,10 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
}
else
if
((
strncasecmp
(
cfgOptions
[
tokenBalance
].
name
,
pOptionToken
->
z
,
pOptionToken
->
n
)
==
0
)
&&
(
cfgOptions
[
tokenBalance
].
len
==
pOptionToken
->
n
))
{
SSQLToken
*
pValToken
=
&
pOptions
->
a
[
2
];
int32_t
vnodeI
ndex
=
0
;
int32_t
dnodeI
ndex
=
0
;
int32_t
vnodeI
d
=
0
;
int32_t
dnodeI
d
=
0
;
strdequote
(
pValToken
->
z
);
bool
parseOk
=
taosCheckBalanceCfgOptions
(
pValToken
->
z
,
&
vnodeI
ndex
,
&
dnodeIndex
);
bool
parseOk
=
taosCheckBalanceCfgOptions
(
pValToken
->
z
,
&
vnodeI
d
,
&
dnodeId
);
if
(
!
parseOk
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
// options value is invalid
}
...
...
src/common/inc/tglobal.h
浏览文件 @
20ed725b
...
...
@@ -174,7 +174,7 @@ bool taosCheckGlobalCfg();
void
taosSetAllDebugFlag
();
bool
taosCfgDynamicOptions
(
char
*
msg
);
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
char
*
fqdn
,
uint16_t
*
port
);
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeI
ndex
,
int32_t
*
dnodeIndex
);
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeI
d
,
int32_t
*
dnodeId
);
#ifdef __cplusplus
}
...
...
src/common/src/tglobal.c
浏览文件 @
20ed725b
...
...
@@ -1315,7 +1315,7 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
* alter dnode 1 balance "vnode:1-dnode:2"
*/
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeI
ndex
,
int32_t
*
dnodeIndex
)
{
bool
taosCheckBalanceCfgOptions
(
const
char
*
option
,
int32_t
*
vnodeI
d
,
int32_t
*
dnodeId
)
{
int
len
=
strlen
(
option
);
if
(
strncasecmp
(
option
,
"vnode:"
,
6
)
!=
0
)
{
return
false
;
...
...
@@ -1331,9 +1331,9 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeIndex, int32_t
return
false
;
}
*
vnodeI
ndex
=
strtol
(
option
+
6
,
NULL
,
10
);
*
dnodeI
ndex
=
strtol
(
option
+
pos
+
6
,
NULL
,
10
);
if
(
*
vnodeI
ndex
<=
1
||
*
dnodeIndex
<=
0
)
{
*
vnodeI
d
=
strtol
(
option
+
6
,
NULL
,
10
);
*
dnodeI
d
=
strtol
(
option
+
pos
+
6
,
NULL
,
10
);
if
(
*
vnodeI
d
<=
1
||
*
dnodeId
<=
0
)
{
return
false
;
}
...
...
src/inc/taoserror.h
浏览文件 @
20ed725b
...
...
@@ -120,12 +120,17 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_NOT_THERE, 0, 0x0323, "sdb object
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SDB_INVAID_META_ROW
,
0
,
0x0324
,
"sdb invalid meta row"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_SDB_INVAID_KEY_TYPE
,
0
,
0x0325
,
"sdb invalid key type"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ALREADY_EXIST
,
0
,
0x0330
,
"mnode dnode already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_EXIST
,
0
,
0x0331
,
"mnode dnode not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
0
,
0x0332
,
"mnode vgroup not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_REMOVE_MASTER
,
0
,
0x0333
,
"mnode cant not remove master"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_ENOUGH_DNODES
,
0
,
0x0334
,
"mnode no enough dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT
,
0
,
0x0335
,
"mnode cluster cfg inconsistent"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_ALREADY_EXIST
,
0
,
0x0330
,
"dnode already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_EXIST
,
0
,
0x0331
,
"dnode not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_EXIST
,
0
,
0x0332
,
"vgroup not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_REMOVE_MASTER
,
0
,
0x0333
,
"cant not remove master"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_ENOUGH_DNODES
,
0
,
0x0334
,
"no enough dnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT
,
0
,
0x0335
,
"cluster cfg inconsistent"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION
,
0
,
0x0336
,
"invalid dnode cfg option"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BALANCE_ENABLED
,
0
,
0x0337
,
"balance already enabled"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_NOT_IN_DNODE
,
0
,
0x0338
,
"vgroup not in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
0
,
0x0339
,
"vgroup already in dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DNODE_NOT_FREE
,
0
,
0x033A
,
"dnode not avaliable"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_ACCT_ALREADY_EXIST
,
0
,
0x0340
,
"mnode accounts already exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_ACCT
,
0
,
0x0341
,
"mnode invalid account"
)
...
...
src/inc/taosmsg.h
浏览文件 @
20ed725b
...
...
@@ -149,6 +149,7 @@ enum _mgmt_table {
#define TSDB_ALTER_TABLE_ADD_COLUMN 5
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
#define TSDB_ALTER_TABLE_CHANGE_COLUMN 7
#define TSDB_FILL_NONE 0
#define TSDB_FILL_NULL 1
...
...
src/inc/tbalance.h
浏览文件 @
20ed725b
...
...
@@ -29,7 +29,7 @@ void balanceAsyncNotify();
void
balanceSyncNotify
();
void
balanceReset
();
int32_t
balanceAllocVnodes
(
struct
SVgObj
*
pVgroup
);
int32_t
balance
CfgDnode
(
struct
SDnodeObj
*
pDnode
,
const
char
*
option
);
int32_t
balance
AlterDnode
(
struct
SDnodeObj
*
pDnode
,
int32_t
vnodeId
,
int32_t
dnodeId
);
int32_t
balanceDropDnode
(
struct
SDnodeObj
*
pDnode
);
#ifdef __cplusplus
...
...
src/mnode/src/mnodeBalance.c
浏览文件 @
20ed725b
...
...
@@ -28,7 +28,7 @@ void balanceCleanUp() {}
void
balanceAsyncNotify
()
{}
void
balanceSyncNotify
()
{}
void
balanceReset
()
{}
int32_t
balance
CfgDnode
(
struct
SDnodeObj
*
pDnode
,
const
char
*
option
)
{
return
TSDB_CODE_SYN_NOT_ENABLED
;
}
int32_t
balance
AlterDnode
(
struct
SDnodeObj
*
pDnode
,
int32_t
vnodeId
,
int32_t
dnodeId
)
{
return
TSDB_CODE_SYN_NOT_ENABLED
;
}
int32_t
balanceAllocVnodes
(
SVgObj
*
pVgroup
)
{
void
*
pIter
=
NULL
;
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
20ed725b
...
...
@@ -295,10 +295,19 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
}
SRpcEpSet
epSet
=
mnodeGetEpSetFromIp
(
pDnode
->
dnodeEp
);
mnodeDecDnodeRef
(
pDnode
);
if
(
strncasecmp
(
pCmCfgDnode
->
config
,
"balance"
,
7
)
==
0
)
{
return
balanceCfgDnode
(
pDnode
,
pCmCfgDnode
->
config
+
8
);
int32_t
vnodeId
=
0
;
int32_t
dnodeId
=
0
;
bool
parseOk
=
taosCheckBalanceCfgOptions
(
pCmCfgDnode
->
config
+
8
,
&
vnodeId
,
&
dnodeId
);
if
(
!
parseOk
)
{
mnodeDecDnodeRef
(
pDnode
);
return
TSDB_CODE_MND_INVALID_DNODE_CFG_OPTION
;
}
int32_t
code
=
balanceAlterDnode
(
pDnode
,
vnodeId
,
dnodeId
);
mnodeDecDnodeRef
(
pDnode
);
return
code
;
}
else
{
SMDCfgDnodeMsg
*
pMdCfgDnode
=
rpcMallocCont
(
sizeof
(
SMDCfgDnodeMsg
));
strcpy
(
pMdCfgDnode
->
ep
,
pCmCfgDnode
->
ep
);
...
...
@@ -314,6 +323,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
mInfo
(
"dnode:%s, is configured by %s"
,
pCmCfgDnode
->
ep
,
pMsg
->
pUser
->
user
);
dnodeSendMsgToDnode
(
&
epSet
,
&
rpcMdCfgDnodeMsg
);
mnodeDecDnodeRef
(
pDnode
);
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
20ed725b
...
...
@@ -1223,6 +1223,55 @@ static int32_t mnodeDropSuperTableColumn(SMnodeMsg *pMsg, char *colName) {
return
code
;
}
static
int32_t
mnodeChangeSuperTableColumnCb
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
SSuperTableObj
*
pStable
=
(
SSuperTableObj
*
)
pMsg
->
pTable
;
mLInfo
(
"app:%p:%p, stable %s, change column result:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
tstrerror
(
code
));
return
code
;
}
static
int32_t
mnodeChangeSuperTableColumn
(
SMnodeMsg
*
pMsg
,
char
*
oldName
,
char
*
newName
)
{
SSuperTableObj
*
pStable
=
(
SSuperTableObj
*
)
pMsg
->
pTable
;
int32_t
col
=
mnodeFindSuperTableColumnIndex
(
pStable
,
oldName
);
if
(
col
<
0
)
{
mError
(
"app:%p:%p, stable:%s, change column, oldName: %s, newName: %s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
oldName
,
newName
);
return
TSDB_CODE_MND_FIELD_NOT_EXIST
;
}
// int32_t rowSize = 0;
uint32_t
len
=
strlen
(
newName
);
if
(
len
>=
TSDB_COL_NAME_LEN
)
{
return
TSDB_CODE_MND_COL_NAME_TOO_LONG
;
}
if
(
mnodeFindSuperTableColumnIndex
(
pStable
,
newName
)
>=
0
)
{
return
TSDB_CODE_MND_FIELD_ALREAY_EXIST
;
}
// update
SSchema
*
schema
=
(
SSchema
*
)
(
pStable
->
schema
+
col
);
tstrncpy
(
schema
->
name
,
newName
,
sizeof
(
schema
->
name
));
mInfo
(
"app:%p:%p, stable %s, start to modify column %s to %s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
oldName
,
newName
);
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsSuperTableSdb
,
.
pObj
=
pStable
,
.
pMsg
=
pMsg
,
.
cb
=
mnodeChangeSuperTableColumnCb
};
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
// show super tables
static
int32_t
mnodeGetShowSuperTableMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
...
...
@@ -1977,6 +2026,48 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
return
code
;
}
static
int32_t
mnodeChangeNormalTableColumn
(
SMnodeMsg
*
pMsg
,
char
*
oldName
,
char
*
newName
)
{
SChildTableObj
*
pTable
=
(
SChildTableObj
*
)
pMsg
->
pTable
;
int32_t
col
=
mnodeFindNormalTableColumnIndex
(
pTable
,
oldName
);
if
(
col
<
0
)
{
mError
(
"app:%p:%p, ctable:%s, change column, oldName: %s, newName: %s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
oldName
,
newName
);
return
TSDB_CODE_MND_FIELD_NOT_EXIST
;
}
// int32_t rowSize = 0;
uint32_t
len
=
strlen
(
newName
);
if
(
len
>=
TSDB_COL_NAME_LEN
)
{
return
TSDB_CODE_MND_COL_NAME_TOO_LONG
;
}
if
(
mnodeFindNormalTableColumnIndex
(
pTable
,
newName
)
>=
0
)
{
return
TSDB_CODE_MND_FIELD_ALREAY_EXIST
;
}
// update
SSchema
*
schema
=
(
SSchema
*
)
(
pTable
->
schema
+
col
);
tstrncpy
(
schema
->
name
,
newName
,
sizeof
(
schema
->
name
));
mInfo
(
"app:%p:%p, ctable %s, start to modify column %s to %s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
oldName
,
newName
);
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsChildTableSdb
,
.
pObj
=
pTable
,
.
pMsg
=
pMsg
,
.
cb
=
mnodeAlterNormalTableColumnCb
};
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
static
int32_t
mnodeSetSchemaFromNormalTable
(
SSchema
*
pSchema
,
SChildTableObj
*
pTable
)
{
int32_t
numOfCols
=
pTable
->
numOfColumns
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
...
...
@@ -2596,6 +2687,8 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
code
=
mnodeAddSuperTableColumn
(
pMsg
,
pAlter
->
schema
,
1
);
}
else
if
(
pAlter
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
)
{
code
=
mnodeDropSuperTableColumn
(
pMsg
,
pAlter
->
schema
[
0
].
name
);
}
else
if
(
pAlter
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
{
code
=
mnodeChangeSuperTableColumn
(
pMsg
,
pAlter
->
schema
[
0
].
name
,
pAlter
->
schema
[
1
].
name
);
}
else
{
}
}
else
{
...
...
@@ -2606,6 +2699,8 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
code
=
mnodeAddNormalTableColumn
(
pMsg
,
pAlter
->
schema
,
1
);
}
else
if
(
pAlter
->
type
==
TSDB_ALTER_TABLE_DROP_COLUMN
)
{
code
=
mnodeDropNormalTableColumn
(
pMsg
,
pAlter
->
schema
[
0
].
name
);
}
else
if
(
pAlter
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
{
code
=
mnodeChangeNormalTableColumn
(
pMsg
,
pAlter
->
schema
[
0
].
name
,
pAlter
->
schema
[
1
].
name
);
}
else
{
}
}
...
...
tests/script/jenkins/basic.txt
浏览文件 @
20ed725b
...
...
@@ -249,6 +249,7 @@ cd ../../../debug; make
./test.sh -f unique/big/maxvnodes.sim
./test.sh -f unique/big/tcp.sim
./test.sh -f unique/cluster/alter.sim
./test.sh -f unique/cluster/balance1.sim
./test.sh -f unique/cluster/balance2.sim
./test.sh -f unique/cluster/balance3.sim
...
...
@@ -325,7 +326,7 @@ cd ../../../debug; make
#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim
./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim
./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
#
./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim
...
...
tests/script/tmp/mnodes.sim
浏览文件 @
20ed725b
...
...
@@ -4,10 +4,6 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode3 -c walLevel -v 2
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
...
...
@@ -16,64 +12,28 @@ system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c http -v 1
system sh/cfg.sh -n dnode2 -c http -v 1
system sh/cfg.sh -n dnode3 -c http -v 1
system sh/cfg.sh -n dnode1 -c mDebugFlag -v 143
system sh/cfg.sh -n dnode2 -c mDebugFlag -v 143
system sh/cfg.sh -n dnode3 -c mDebugFlag -v 143
system sh/cfg.sh -n dnode1 -c sdbDebugFlag -v 143
system sh/cfg.sh -n dnode2 -c sdbDebugFlag -v 143
system sh/cfg.sh -n dnode3 -c sdbDebugFlag -v 143
system sh/cfg.sh -n dnode1 -c sdebugFlag -v 143
system sh/cfg.sh -n dnode2 -c sdebugFlag -v 143
system sh/cfg.sh -n dnode3 -c sdebugFlag -v 143
system sh/cfg.sh -n dnode1 -c rpcDebugFlag -v 135
system sh/cfg.sh -n dnode2 -c rpcDebugFlag -v 135
system sh/cfg.sh -n dnode3 -c rpcDebugFlag -v 135
system sh/cfg.sh -n dnode1 -c tsdbDebugFlag -v 131
system sh/cfg.sh -n dnode2 -c tsdbDebugFlag -v 131
system sh/cfg.sh -n dnode3 -c tsdbDebugFlag -v 131
system sh/cfg.sh -n dnode1 -c mqttDebugFlag -v 131
system sh/cfg.sh -n dnode2 -c mqttDebugFlag -v 131
system sh/cfg.sh -n dnode3 -c mqttDebugFlag -v 131
system sh/cfg.sh -n dnode1 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c qdebugFlag -v 131
system sh/cfg.sh -n dnode1 -c cDebugFlag -v 135
system sh/cfg.sh -n dnode2 -c cDebugFlag -v 135
system sh/cfg.sh -n dnode3 -c cDebugFlag -v 135
system sh/cfg.sh -n dnode1 -c udebugFlag -v 131
system sh/cfg.sh -n dnode2 -c udebugFlag -v 131
system sh/cfg.sh -n dnode3 -c udebugFlag -v 131
system sh/cfg.sh -n dnode1 -c http -v 0
system sh/cfg.sh -n dnode2 -c http -v 0
system sh/cfg.sh -n dnode3 -c http -v 0
system sh/cfg.sh -n dnode1 -c
wdebugFlag -v 131
system sh/cfg.sh -n dnode2 -c
wdebugFlag -v 131
system sh/cfg.sh -n dnode3 -c
wdebugFlag -v 131
system sh/cfg.sh -n dnode1 -c
maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode2 -c
maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode3 -c
maxTablesPerVnode -v 20000
system sh/cfg.sh -n dnode1 -c
maxTablesPerVnode -v 1000000
system sh/cfg.sh -n dnode2 -c
maxTablesPerVnode -v 1000000
system sh/cfg.sh -n dnode3 -c
maxTablesPerVnode -v 1000000
system sh/cfg.sh -n dnode1 -c
replica -v 3
system sh/cfg.sh -n dnode2 -c
replica -v 3
system sh/cfg.sh -n dnode3 -c
replica -v 3
print ============== deploy
system sh/exec.sh -n dnode1 -s start
sleep
2
001
system sh/exec.sh -n dnode1 -s start
sleep
5
001
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
print =============== step1
$x = 0
...
...
@@ -112,8 +72,8 @@ print $data0_3 $data2_3
$x = $x + 1
sleep
2
000
if $x == 1000 then
sleep
5
000
if $x == 1000
00
then
return -1
endi
...
...
tests/script/unique/cluster/alter.sim
0 → 100644
浏览文件 @
20ed725b
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c role -v 1
system sh/cfg.sh -n dnode2 -c role -v 2
system sh/cfg.sh -n dnode3 -c role -v 2
system sh/cfg.sh -n dnode4 -c role -v 2
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode3 -c wallevel -v 2
system sh/cfg.sh -n dnode4 -c wallevel -v 2
system sh/cfg.sh -n dnode1 -c balance -v 0
system sh/cfg.sh -n dnode2 -c balance -v 0
system sh/cfg.sh -n dnode3 -c balance -v 0
system sh/cfg.sh -n dnode4 -c balance -v 0
print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sleep 3000
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sleep 3000
print ========== step2
sql create database d1
sql create table d1.t1 (t timestamp, i int)
sql insert into d1.t1 values(now+1s, 15)
sql insert into d1.t1 values(now+2s, 14)
sql insert into d1.t1 values(now+3s, 13)
sql insert into d1.t1 values(now+4s, 12)
sql insert into d1.t1 values(now+5s, 11)
print ========== step3
sleep 2000
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start
sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_1 != 0 then
return -1
endi
if $data2_2 != 1 then
return -1
endi
if $data2_3 != 0 then
return -1
endi
if $data2_4 != 0 then
return -1
endi
print ========== step4
sql alter dnode 2 balance "vnode:2-dnode:3"
$x = 0
show4:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_2 != 0 then
goto show4
endi
if $data2_3 != 1 then
goto show4
endi
if $data2_4 != 0 then
goto show4
endi
print ========== step5
sql alter dnode 3 balance "vnode:2-dnode:4"
$x = 0
show5:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_2 != 0 then
goto show5
endi
if $data2_3 != 0 then
goto show5
endi
if $data2_4 != 1 then
goto show5
endi
print ========== step6
sql alter dnode 4 balance "vnode:2-dnode:2"
$x = 0
show6:
$x = $x + 1
sleep 2000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
print dnode3 openVnodes $data2_3
print dnode4 openVnodes $data2_4
if $data2_2 != 1 then
goto show6
endi
if $data2_3 != 0 then
goto show6
endi
if $data2_4 != 0 then
goto show6
endi
print ========== step7
sql select * from d1.t1 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 11 then
return -1
endi
if $data11 != 12 then
return -1
endi
if $data21 != 13 then
return -1
endi
if $data31 != 14 then
return -1
endi
if $data41 != 15 then
return -1
endi
print ========== step8
sql_error sql alter dnode 4 balance "vnode:2-dnode:5"
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
\ No newline at end of file
tests/test/c/CMakeLists.txt
浏览文件 @
20ed725b
...
...
@@ -10,8 +10,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
#add_executable(insertPerTable insertPerTable.c)
#target_link_libraries(insertPerTable taos_static pthread)
#
add_executable(insertPerRow insertPerRow.c)
#
target_link_libraries(insertPerRow taos_static pthread)
add_executable
(
insertPerRow insertPerRow.c
)
target_link_libraries
(
insertPerRow taos_static pthread
)
#add_executable(importOneRow importOneRow.c)
#target_link_libraries(importOneRow taos_static pthread)
...
...
tests/test/c/insertPerRow.c
浏览文件 @
20ed725b
...
...
@@ -44,14 +44,16 @@ void createDbAndTable();
void
insertData
();
int32_t
randomData
[
MAX_RANDOM_POINTS
];
int64_t
rowsPerTable
=
10000
;
int64_t
rowsPerTable
=
10000
00000
;
int64_t
pointsPerTable
=
1
;
int64_t
numOfThreads
=
1
;
int64_t
numOfTablesPerThread
=
2
00
;
int64_t
numOfThreads
=
1
0
;
int64_t
numOfTablesPerThread
=
1
00
;
char
dbName
[
32
]
=
"db"
;
char
stableName
[
64
]
=
"st"
;
int32_t
cache
=
16
;
int32_t
tables
=
5000
;
int32_t
cache
=
1
;
int32_t
replica
=
3
;
int32_t
days
=
10
;
int32_t
interval
=
1000
;
int
main
(
int
argc
,
char
*
argv
[])
{
shellParseArgument
(
argc
,
argv
);
...
...
@@ -77,7 +79,7 @@ void createDbAndTable() {
exit
(
1
);
}
sprintf
(
qstr
,
"create database if not exists %s cache %d
maxtables %d"
,
dbName
,
cache
,
table
s
);
sprintf
(
qstr
,
"create database if not exists %s cache %d
replica %d days %d"
,
dbName
,
cache
,
replica
,
day
s
);
pSql
=
taos_query
(
con
,
qstr
);
int32_t
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
...
...
@@ -239,7 +241,7 @@ void *syncTest(void *param) {
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
int64_t
start
=
1430000000000
;
int
64_t
int
erval
=
1000
;
// 1000 ms
interval
=
1000
;
// 1000 ms
char
*
sql
=
qstr
;
char
inserStr
[]
=
"insert into"
;
...
...
@@ -309,10 +311,14 @@ void printHelp() {
printf
(
"%s%s%s%"
PRId64
"
\n
"
,
indent
,
indent
,
"Number of threads to be used, default is "
,
numOfThreads
);
printf
(
"%s%s
\n
"
,
indent
,
"-n"
);
printf
(
"%s%s%s%"
PRId64
"
\n
"
,
indent
,
indent
,
"Number of tables per thread, default is "
,
numOfTablesPerThread
);
printf
(
"%s%s
\n
"
,
indent
,
"-
tables
"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Database parameters
tables, default is "
,
tables
);
printf
(
"%s%s
\n
"
,
indent
,
"-
replica
"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Database parameters
replica, default is "
,
replica
);
printf
(
"%s%s
\n
"
,
indent
,
"-cache"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Database parameters cache, default is "
,
cache
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Database parameters replica, default is "
,
cache
);
printf
(
"%s%s
\n
"
,
indent
,
"-days"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Database parameters days, default is "
,
days
);
printf
(
"%s%s
\n
"
,
indent
,
"-interval"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"Interval of each rows in ms, default is "
,
interval
);
exit
(
EXIT_SUCCESS
);
}
...
...
@@ -336,10 +342,14 @@ void shellParseArgument(int argc, char *argv[]) {
numOfThreads
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-n"
)
==
0
)
{
numOfTablesPerThread
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-
tables
"
)
==
0
)
{
tables
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-
replica
"
)
==
0
)
{
replica
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-cache"
)
==
0
)
{
cache
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-days"
)
==
0
)
{
days
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-interval"
)
==
0
)
{
interval
=
atoi
(
argv
[
++
i
]);
}
else
{
}
}
...
...
@@ -349,7 +359,7 @@ void shellParseArgument(int argc, char *argv[]) {
pPrint
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
pPrint
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
pPrint
(
"%scache:%"
PRId32
"%s"
,
GREEN
,
cache
,
NC
);
pPrint
(
"%stables:%"
PRId32
"%s"
,
GREEN
,
tables
,
NC
);
pPrint
(
"%stables:%"
PRId32
"%s"
,
GREEN
,
replica
,
NC
);
pPrint
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
pPrint
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
pPrint
(
"%sstart to run%s"
,
GREEN
,
NC
);
...
...
tests/tsim/src/simExe.c
浏览文件 @
20ed725b
...
...
@@ -670,12 +670,12 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
ret
=
taos_errno
(
pSql
);
if
(
ret
==
TSDB_CODE_MND_TABLE_ALREADY_EXIST
||
ret
==
TSDB_CODE_MND_DB_ALREADY_EXIST
)
{
simDebug
(
"script:%s, taos:%p, %s success, ret:%d:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
,
tstrerror
(
ret
));
simDebug
(
"script:%s, taos:%p, %s success, ret:%d:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
));
ret
=
0
;
break
;
}
else
if
(
ret
!=
0
)
{
simDebug
(
"script:%s, taos:%p, %s failed, ret:%d:%s, error:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
,
tstrerror
(
ret
),
taos_errstr
(
pSql
));
script
->
fileName
,
script
->
taos
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
),
taos_errstr
(
pSql
));
if
(
line
->
errorJump
==
SQL_JUMP_TRUE
)
{
script
->
linePos
=
line
->
jump
;
...
...
@@ -691,7 +691,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
}
if
(
ret
)
{
sprintf
(
script
->
error
,
"lineNum:%d. sql:%s failed, ret:%d:%s"
,
line
->
lineNum
,
rest
,
ret
,
tstrerror
(
ret
));
sprintf
(
script
->
error
,
"lineNum:%d. sql:%s failed, ret:%d:%s"
,
line
->
lineNum
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
));
return
false
;
}
...
...
@@ -821,7 +821,7 @@ bool simExecuteRestFulSqlCommand(SScript *script, char *rest) {
ret
=
simExecuteRestFulCommand
(
script
,
command
);
if
(
ret
==
TSDB_CODE_MND_TABLE_ALREADY_EXIST
||
ret
==
TSDB_CODE_MND_DB_ALREADY_EXIST
)
{
simDebug
(
"script:%s, taos:%p, %s success, ret:%d:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
,
tstrerror
(
ret
));
simDebug
(
"script:%s, taos:%p, %s success, ret:%d:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
));
ret
=
0
;
break
;
}
else
if
(
ret
!=
0
)
{
...
...
@@ -957,12 +957,12 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
simDebug
(
"script:%s, taos:%p, %s execute, expect failed, so success, ret:%d:%s"
,
script
->
fileName
,
script
->
taos
,
rest
,
ret
,
tstrerror
(
ret
));
script
->
fileName
,
script
->
taos
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
));
script
->
linePos
++
;
return
true
;
}
sprintf
(
script
->
error
,
"lineNum:%d. sql:%s expect failed, but success, ret:%d:%s"
,
line
->
lineNum
,
rest
,
ret
,
tstrerror
(
ret
));
sprintf
(
script
->
error
,
"lineNum:%d. sql:%s expect failed, but success, ret:%d:%s"
,
line
->
lineNum
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
));
return
false
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录