Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8900a846
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8900a846
编写于
5月 11, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/data_format
上级
c3cf7f52
be141a2e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
340 addition
and
20 deletion
+340
-20
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+32
-15
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+2
-2
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+2
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+4
-0
tests/script/tsim/stable/alter1.sim
tests/script/tsim/stable/alter1.sim
+168
-0
tests/script/tsim/tmq/topic.sim
tests/script/tsim/tmq/topic.sim
+93
-0
tests/script/tsim/user/privilege2.sim
tests/script/tsim/user/privilege2.sim
+38
-0
未找到文件。
source/common/src/tglobal.c
浏览文件 @
8900a846
...
@@ -351,7 +351,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
...
@@ -351,7 +351,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
}
}
static
int32_t
taosAddServerCfg
(
SConfig
*
pCfg
)
{
static
int32_t
taosAddServerCfg
(
SConfig
*
pCfg
)
{
if
(
cfgAddInt32
(
pCfg
,
"supportVnodes"
,
256
,
0
,
6553
6
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"supportVnodes"
,
256
,
0
,
409
6
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfDistinctRes"
,
tsMaxNumOfDistinctResults
,
10
*
10000
,
10000
*
10000
,
0
)
!=
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
8900a846
...
@@ -832,6 +832,8 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp) {
...
@@ -832,6 +832,8 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp) {
}
}
static
int32_t
mndCheckAlterStbReq
(
SMAlterStbReq
*
pAlter
)
{
static
int32_t
mndCheckAlterStbReq
(
SMAlterStbReq
*
pAlter
)
{
if
(
pAlter
->
commentLen
!=
0
)
return
0
;
if
(
pAlter
->
numOfFields
<
1
||
pAlter
->
numOfFields
!=
(
int32_t
)
taosArrayGetSize
(
pAlter
->
pFields
))
{
if
(
pAlter
->
numOfFields
<
1
||
pAlter
->
numOfFields
!=
(
int32_t
)
taosArrayGetSize
(
pAlter
->
pFields
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
return
-
1
;
...
@@ -839,15 +841,6 @@ static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) {
...
@@ -839,15 +841,6 @@ static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) {
for
(
int32_t
i
=
0
;
i
<
pAlter
->
numOfFields
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pAlter
->
numOfFields
;
++
i
)
{
SField
*
pField
=
taosArrayGet
(
pAlter
->
pFields
,
i
);
SField
*
pField
=
taosArrayGet
(
pAlter
->
pFields
,
i
);
if
(
pField
->
type
<=
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
if
(
pField
->
bytes
<=
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
if
(
pField
->
name
[
0
]
==
0
)
{
if
(
pField
->
name
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
return
-
1
;
...
@@ -890,6 +883,23 @@ static int32_t mndAllocStbSchemas(const SStbObj *pOld, SStbObj *pNew) {
...
@@ -890,6 +883,23 @@ static int32_t mndAllocStbSchemas(const SStbObj *pOld, SStbObj *pNew) {
return
0
;
return
0
;
}
}
static
int32_t
mndUpdateStbComment
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
char
*
pComment
,
int32_t
commentLen
)
{
if
(
commentLen
>
0
)
{
pNew
->
commentLen
=
commentLen
;
pNew
->
comment
=
taosMemoryCalloc
(
1
,
commentLen
);
if
(
pNew
->
comment
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
pNew
->
comment
,
pComment
,
commentLen
);
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
return
0
;
}
static
int32_t
mndAddSuperTableTag
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
SArray
*
pFields
,
int32_t
ntags
)
{
static
int32_t
mndAddSuperTableTag
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
SArray
*
pFields
,
int32_t
ntags
)
{
if
(
pOld
->
numOfTags
+
ntags
>
TSDB_MAX_TAGS
)
{
if
(
pOld
->
numOfTags
+
ntags
>
TSDB_MAX_TAGS
)
{
terrno
=
TSDB_CODE_MND_TOO_MANY_TAGS
;
terrno
=
TSDB_CODE_MND_TOO_MANY_TAGS
;
...
@@ -908,12 +918,12 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
...
@@ -908,12 +918,12 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
for
(
int32_t
i
=
0
;
i
<
ntags
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
ntags
;
i
++
)
{
SField
*
pField
=
taosArrayGet
(
pFields
,
i
);
SField
*
pField
=
taosArrayGet
(
pFields
,
i
);
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pField
->
name
)
>
0
)
{
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pField
->
name
)
>
=
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_COLUMN_ALREADY_EXIST
;
return
-
1
;
return
-
1
;
}
}
if
(
mndFindSuperTableTagIndex
(
pOld
,
pField
->
name
)
>
0
)
{
if
(
mndFindSuperTableTagIndex
(
pOld
,
pField
->
name
)
>
=
0
)
{
terrno
=
TSDB_CODE_MND_TAG_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_TAG_ALREADY_EXIST
;
return
-
1
;
return
-
1
;
}
}
...
@@ -1034,12 +1044,12 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
...
@@ -1034,12 +1044,12 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
for
(
int32_t
i
=
0
;
i
<
ncols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
ncols
;
i
++
)
{
SField
*
pField
=
taosArrayGet
(
pFields
,
i
);
SField
*
pField
=
taosArrayGet
(
pFields
,
i
);
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pField
->
name
)
>
0
)
{
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pField
->
name
)
>
=
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_COLUMN_ALREADY_EXIST
;
return
-
1
;
return
-
1
;
}
}
if
(
mndFindSuperTableTagIndex
(
pOld
,
pField
->
name
)
>
0
)
{
if
(
mndFindSuperTableTagIndex
(
pOld
,
pField
->
name
)
>
=
0
)
{
terrno
=
TSDB_CODE_MND_TAG_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_TAG_ALREADY_EXIST
;
return
-
1
;
return
-
1
;
}
}
...
@@ -1193,32 +1203,39 @@ static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAlterStbReq *
...
@@ -1193,32 +1203,39 @@ static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAlterStbReq *
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
NULL
;
STrans
*
pTrans
=
NULL
;
SField
*
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
)
;
SField
*
pField0
=
NULL
;
switch
(
pAlter
->
alterType
)
{
switch
(
pAlter
->
alterType
)
{
case
TSDB_ALTER_TABLE_ADD_TAG
:
case
TSDB_ALTER_TABLE_ADD_TAG
:
code
=
mndAddSuperTableTag
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
code
=
mndAddSuperTableTag
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
break
;
break
;
case
TSDB_ALTER_TABLE_DROP_TAG
:
case
TSDB_ALTER_TABLE_DROP_TAG
:
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
code
=
mndDropSuperTableTag
(
pOld
,
&
stbObj
,
pField0
->
name
);
code
=
mndDropSuperTableTag
(
pOld
,
&
stbObj
,
pField0
->
name
);
break
;
break
;
case
TSDB_ALTER_TABLE_UPDATE_TAG_NAME
:
case
TSDB_ALTER_TABLE_UPDATE_TAG_NAME
:
code
=
mndAlterStbTagName
(
pOld
,
&
stbObj
,
pAlter
->
pFields
);
code
=
mndAlterStbTagName
(
pOld
,
&
stbObj
,
pAlter
->
pFields
);
break
;
break
;
case
TSDB_ALTER_TABLE_UPDATE_TAG_BYTES
:
case
TSDB_ALTER_TABLE_UPDATE_TAG_BYTES
:
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
code
=
mndAlterStbTagBytes
(
pOld
,
&
stbObj
,
pField0
);
code
=
mndAlterStbTagBytes
(
pOld
,
&
stbObj
,
pField0
);
break
;
break
;
case
TSDB_ALTER_TABLE_ADD_COLUMN
:
case
TSDB_ALTER_TABLE_ADD_COLUMN
:
code
=
mndAddSuperTableColumn
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
code
=
mndAddSuperTableColumn
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
break
;
break
;
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
code
=
mndDropSuperTableColumn
(
pOld
,
&
stbObj
,
pField0
->
name
);
code
=
mndDropSuperTableColumn
(
pOld
,
&
stbObj
,
pField0
->
name
);
break
;
break
;
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
:
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
:
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
code
=
mndAlterStbColumnBytes
(
pOld
,
&
stbObj
,
pField0
);
code
=
mndAlterStbColumnBytes
(
pOld
,
&
stbObj
,
pField0
);
break
;
break
;
case
TSDB_ALTER_TABLE_UPDATE_OPTIONS
:
code
=
mndUpdateStbComment
(
pOld
,
&
stbObj
,
pAlter
->
comment
,
pAlter
->
commentLen
);
break
;
default:
default:
terrno
=
TSDB_CODE_
MND_INVALID_STB_OPTION
;
terrno
=
TSDB_CODE_
OPS_NOT_SUPPORT
;
break
;
break
;
}
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
8900a846
...
@@ -507,7 +507,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
...
@@ -507,7 +507,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
}
}
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_READ_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_ALL_DB
)
{
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_READ_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_ALL_DB
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"*"
)
!=
0
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"
1.
*"
)
!=
0
)
{
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
dbname
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
dbname
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
...
@@ -521,7 +521,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
...
@@ -521,7 +521,7 @@ static int32_t mndProcessAlterUserReq(SNodeMsg *pReq) {
}
}
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_WRITE_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_ALL_DB
)
{
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_WRITE_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_REMOVE_ALL_DB
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"*"
)
!=
0
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"
1.
*"
)
!=
0
)
{
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
dbname
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
dbname
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
...
...
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
8900a846
...
@@ -241,7 +241,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
...
@@ -241,7 +241,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
alterReq
.
alterType
=
TSDB_ALTER_USER_REMOVE_ALL_DB
;
alterReq
.
alterType
=
TSDB_ALTER_USER_REMOVE_ALL_DB
;
strcpy
(
alterReq
.
user
,
"u3"
);
strcpy
(
alterReq
.
user
,
"u3"
);
strcpy
(
alterReq
.
pass
,
"1"
);
strcpy
(
alterReq
.
pass
,
"1"
);
strcpy
(
alterReq
.
dbname
,
"*"
);
strcpy
(
alterReq
.
dbname
,
"
1.
*"
);
int32_t
contLen
=
tSerializeSAlterUserReq
(
NULL
,
0
,
&
alterReq
);
int32_t
contLen
=
tSerializeSAlterUserReq
(
NULL
,
0
,
&
alterReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
@@ -257,7 +257,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
...
@@ -257,7 +257,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
alterReq
.
alterType
=
TSDB_ALTER_USER_REMOVE_ALL_DB
;
alterReq
.
alterType
=
TSDB_ALTER_USER_REMOVE_ALL_DB
;
strcpy
(
alterReq
.
user
,
"u3"
);
strcpy
(
alterReq
.
user
,
"u3"
);
strcpy
(
alterReq
.
pass
,
"1"
);
strcpy
(
alterReq
.
pass
,
"1"
);
strcpy
(
alterReq
.
dbname
,
"*"
);
strcpy
(
alterReq
.
dbname
,
"
1.
*"
);
int32_t
contLen
=
tSerializeSAlterUserReq
(
NULL
,
0
,
&
alterReq
);
int32_t
contLen
=
tSerializeSAlterUserReq
(
NULL
,
0
,
&
alterReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
...
tests/script/jenkins/basic.txt
浏览文件 @
8900a846
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
./test.sh -f tsim/user/pass_alter.sim
./test.sh -f tsim/user/pass_alter.sim
./test.sh -f tsim/user/pass_len.sim
./test.sh -f tsim/user/pass_len.sim
./test.sh -f tsim/user/user_len.sim
./test.sh -f tsim/user/user_len.sim
./test.sh -f tsim/user/privilege1.sim
./test.sh -f tsim/user/privilege2.sim
# ---- db
# ---- db
./test.sh -f tsim/db/create_all_options.sim
./test.sh -f tsim/db/create_all_options.sim
...
@@ -75,8 +77,10 @@
...
@@ -75,8 +77,10 @@
./test.sh -f tsim/tmq/basic3Of2Cons.sim
./test.sh -f tsim/tmq/basic3Of2Cons.sim
./test.sh -f tsim/tmq/basic4Of2Cons.sim
./test.sh -f tsim/tmq/basic4Of2Cons.sim
./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim
./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim
./test.sh -f tsim/tmq/topic.sim
# --- stable
# --- stable
./test.sh -f tsim/stable/alter1.sim
./test.sh -f tsim/stable/disk.sim
./test.sh -f tsim/stable/disk.sim
./test.sh -f tsim/stable/dnode3.sim
./test.sh -f tsim/stable/dnode3.sim
./test.sh -f tsim/stable/metrics.sim
./test.sh -f tsim/stable/metrics.sim
...
...
tests/script/tsim/stable/alter1.sim
0 → 100644
浏览文件 @
8900a846
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ========== create stable
sql create database db
sql use db
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd"
sql show db.stables
if $rows != 1 then
return -1
endi
if $data[0][3] != 3 then
return -1
endi
if $data[0][4] != 3 then
return -1
endi
if $data[0][6] != abd then
return -1
endi
print ========== add column
sql_error alter table db.stb add column ts int
sql_error alter table db.stb add column c1 int
sql_error alter table db.stb add column c2 int
sql_error alter table db.stb add column t1 int
sql_error alter table db.stb add column t2 int
sql_error alter table db.stb add column t3 int
sql alter table db.stb add column c3 int
sql alter table db.stb add column c4 bigint
sql alter table db.stb add column c5 binary(12)
sql show db.stables
if $rows != 1 then
return -1
endi
if $data[0][3] != 6 then
return -1
endi
if $data[0][4] != 3 then
return -1
endi
print ========== drop column
sql_error alter table db.stb drop column ts
sql_error alter table db.stb drop column c6
sql_error alter table db.stb drop column c7
sql_error alter table db.stb drop column t1
sql_error alter table db.stb drop column t2
sql_error alter table db.stb drop column t3
sql alter table db.stb drop column c1
sql alter table db.stb drop column c4
sql show db.stables
if $rows != 1 then
return -1
endi
if $data[0][3] != 4 then
return -1
endi
if $data[0][4] != 3 then
return -1
endi
print ========== update column
sql_error alter table db.stb MODIFY column ts binary(20)
sql_error alter table db.stb MODIFY column c6 binary(20)
sql_error alter table db.stb MODIFY column t1 binary(20)
sql_error alter table db.stb MODIFY column t3 binary(20)
sql_error alter table db.stb MODIFY column c2 binary(3)
sql alter table db.stb MODIFY column c2 binary(32)
sql show db.stables
if $rows != 1 then
return -1
endi
if $data[0][3] != 4 then
return -1
endi
if $data[0][4] != 3 then
return -1
endi
print ========== rename column
sql_error alter table db.stb rename column ts tx
sql_error alter table db.stb rename column c2 cx
print ========== add tag
sql_error alter table db.stb add tag ts int
sql_error alter table db.stb add tag c2 int
sql_error alter table db.stb add tag t1 int
sql_error alter table db.stb add tag t2 int
sql_error alter table db.stb add tag t3 int
sql alter table db.stb add tag t4 bigint
sql alter table db.stb add tag c1 int
sql alter table db.stb add tag t5 binary(12)
sql show db.stables
if $rows != 1 then
return -1
endi
#ts c2 c3 c5
if $data[0][3] != 4 then
return -1
endi
#t1 t2 t3 t4 c1 t5
if $data[0][4] != 6 then
return -1
endi
print ========== drop tag
sql_error alter table db.stb drop tag ts
sql_error alter table db.stb drop tag c2
sql_error alter table db.stb drop tag c3
sql_error alter table db.stb drop tag tx
sql alter table db.stb drop tag c1
sql alter table db.stb drop tag t5
sql show db.stables
if $rows != 1 then
return -1
endi
#ts c2 c3 c5
if $data[0][3] != 4 then
return -1
endi
#t1 t2 t3 t4
if $data[0][4] != 4 then
return -1
endi
print ========== update tag
sql_error alter table db.stb MODIFY tag ts binary(20)
sql_error alter table db.stb MODIFY tag c2 binary(20)
sql_error alter table db.stb MODIFY tag t1 binary(20)
sql_error alter table db.stb MODIFY tag tx binary(20)
sql alter table db.stb MODIFY tag t3 binary(32)
sql show db.stables
if $rows != 1 then
return -1
endi
if $data[0][3] != 4 then
return -1
endi
if $data[0][4] != 4 then
return -1
endi
print ========== rename tag
#t1 t2 t3 t4
sql_error alter table db.stb rename tag ts tx
sql_error alter table db.stb rename tag c2 cx
sql alter table db.stb rename tag t1 tx
print ========== alter common
sql alter table db.stb comment 'abcde' ;
sql show db.stables;
if $data[0][6] != abcde then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/tmq/topic.sim
0 → 100644
浏览文件 @
8900a846
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
#system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
system sh/exec.sh -n dnode1 -s start
#---- global parameters start ----#
$dbName = db
$vgroups = 1
$stbPrefix = stb
$ctbPrefix = ctb
$ntbPrefix = ntb
$stbNum = 1
$ctbNum = 10
$ntbNum = 10
$rowsPerCtb = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
#---- global parameters end ----#
sql connect
print == create database $dbName vgroups $vgroups
sql create database $dbName vgroups $vgroups
#wait database ready
$loop_cnt = 0
check_db_ready:
if $loop_cnt == 10 then
print ====> database not ready!
return -1
endi
sql show databases
print ==> rows: $rows
print ==> $data(db)[0] $data(db)[1] $data(db)[2] $data(db)[3] $data(db)[4] $data(db)[5] $data(db)[6] $data(db)[7] $data(db)[8] $data(db)[9] $data(db)[10] $data(db)[11] $data(db)[12]
print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $data(db)[18] $data(db)[19] $data(db)[20]
if $data(db)[19] != nostrict then
sleep 100
$loop_cnt = $loop_cnt + 1
goto check_db_ready
endi
sql use $dbName
print == create super table
sql create table $stbPrefix (ts timestamp, c1 int, c2 float, c3 binary(16)) tags (t1 int)
sql show stables
if $rows != 1 then
return -1
endi
print == create child table, normal table and insert data
$i = 0
while $i < $ctbNum
$ctb = $ctbPrefix . $i
$ntb = $ntbPrefix . $i
sql create table $ctb using $stbPrefix tags( $i )
sql create table $ntb (ts timestamp, c1 int, c2 float, c3 binary(16))
$i = $i + 1
endw
print == create topics from super table
sql create topic topic_stb_column as select ts, c3 from stb
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb
print == create topics from child table
sql create topic topic_ctb_column as select ts, c3 from ctb0
sql create topic topic_ctb_all as select * from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0
print == create topics from normal table
sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
print == show topics
sql show topics
if $rows != 9 then
return -1
endi
print == drop topic
sql drop topic topic_stb_column
sql drop topic topic_ctb_column
sql drop topic topic_ntb_column
print == show topics
sql show topics
if $rows != 6 then
return -1
endi
tests/script/tsim/user/privilege2.sim
0 → 100644
浏览文件 @
8900a846
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print =============== show users
sql create database d1 vgroups 1;
sql create database d2 vgroups 1;
sql create database d3 vgroups 1;
sql show databases
if $rows != 5 then
return -1
endi
print =============== create users
sql create user user1 PASS 'taosdata'
sql create user user2 PASS 'taosdata'
sql show users
if $rows != 3 then
return -1
endi
sql GRANT read ON d1.* to user1;
sql GRANT write ON d2.* to user1;
print =============== re connect
sql close
sleep 2500
print user user1 login
sql connect user1
sql_error drop database d1;
sql_error drop database d2;
sql_error create stable d1.st (ts timestamp, i int) tags (j int)
sql create stable d2.st (ts timestamp, i int) tags (j int)
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录