Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
833dde31
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看板
提交
833dde31
编写于
3月 09, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-3130
上级
72f94210
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
1214 addition
and
11 deletion
+1214
-11
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+2
-2
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+3
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+6
-4
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-0
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+2
-2
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+0
-3
tests/script/general/db/topic1.sim
tests/script/general/db/topic1.sim
+849
-0
tests/script/general/db/topic2.sim
tests/script/general/db/topic2.sim
+351
-0
未找到文件。
src/dnode/src/dnodeMWrite.c
浏览文件 @
833dde31
src/dnode/src/dnodeShell.c
浏览文件 @
833dde31
...
@@ -47,8 +47,11 @@ int32_t dnodeInitShell() {
...
@@ -47,8 +47,11 @@ int32_t dnodeInitShell() {
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_DNODE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_DNODE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_DNODE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_DNODE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_TP
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_TP
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_ALTER_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_ALTER_DB
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_ALTER_TP
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_TABLE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_CREATE_TABLE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_TABLE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_DROP_TABLE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_ALTER_TABLE
]
=
dnodeDispatchToMWriteQueue
;
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_CM_ALTER_TABLE
]
=
dnodeDispatchToMWriteQueue
;
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
833dde31
...
@@ -912,7 +912,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
...
@@ -912,7 +912,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
int8_t
update
=
pAlter
->
update
;
int8_t
update
=
pAlter
->
update
;
int8_t
cacheLastRow
=
pAlter
->
cacheLastRow
;
int8_t
cacheLastRow
=
pAlter
->
cacheLastRow
;
int8_t
dbType
=
pAlter
->
dbType
;
int8_t
dbType
=
pAlter
->
dbType
;
int16_t
partitions
=
pAlter
->
partitions
;
int16_t
partitions
=
htons
(
pAlter
->
partitions
)
;
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
...
@@ -1031,8 +1031,8 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
...
@@ -1031,8 +1031,8 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
}
}
if
(
dbType
>=
0
&&
dbType
!=
pDb
->
cfg
.
dbType
)
{
if
(
dbType
>=
0
&&
dbType
!=
pDb
->
cfg
.
dbType
)
{
m
Error
(
"db:%s, can't alter dbType option"
,
pDb
->
nam
e
);
m
Debug
(
"db:%s, dbType:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
dbType
,
dbTyp
e
);
terrno
=
TSDB_CODE_MND_INVALID_DB_OPTION
;
newCfg
.
dbType
=
dbType
;
}
}
if
(
partitions
>=
0
&&
partitions
!=
pDb
->
cfg
.
partitions
)
{
if
(
partitions
>=
0
&&
partitions
!=
pDb
->
cfg
.
partitions
)
{
...
@@ -1067,6 +1067,8 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
...
@@ -1067,6 +1067,8 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
}
}
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
mDebug
(
"db:%s, type:%d do alter operation"
,
pDb
->
name
,
pDb
->
cfg
.
dbType
);
SDbCfg
newCfg
=
mnodeGetAlterDbOption
(
pDb
,
pAlter
);
SDbCfg
newCfg
=
mnodeGetAlterDbOption
(
pDb
,
pAlter
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
return
terrno
;
return
terrno
;
...
@@ -1099,7 +1101,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
...
@@ -1099,7 +1101,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
)
{
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
)
{
SAlterDbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SAlterDbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"db:%s, alter db msg is received from thandle:%p
"
,
pAlter
->
db
,
pMsg
->
rpcMsg
.
handl
e
);
mDebug
(
"db:%s, alter db msg is received from thandle:%p
, dbType:%d"
,
pAlter
->
db
,
pMsg
->
rpcMsg
.
handle
,
pAlter
->
dbTyp
e
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pAlter
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pAlter
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
{
if
(
pMsg
->
pDb
==
NULL
)
{
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
833dde31
...
@@ -109,6 +109,7 @@ static char *mnodeGetShowType(int32_t showType) {
...
@@ -109,6 +109,7 @@ static char *mnodeGetShowType(int32_t showType) {
case
TSDB_MGMT_TABLE_VNODES
:
return
"show vnodes"
;
case
TSDB_MGMT_TABLE_VNODES
:
return
"show vnodes"
;
case
TSDB_MGMT_TABLE_CLUSTER
:
return
"show clusters"
;
case
TSDB_MGMT_TABLE_CLUSTER
:
return
"show clusters"
;
case
TSDB_MGMT_TABLE_STREAMTABLES
:
return
"show streamtables"
;
case
TSDB_MGMT_TABLE_STREAMTABLES
:
return
"show streamtables"
;
case
TSDB_MGMT_TABLE_TP
:
return
"show topics"
;
default:
return
"undefined"
;
default:
return
"undefined"
;
}
}
}
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
833dde31
...
@@ -459,8 +459,8 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi
...
@@ -459,8 +459,8 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi
maxVgroupsPerDb
=
MIN
(
maxVgroupsPerDb
,
TSDB_MAX_VNODES_PER_DB
);
maxVgroupsPerDb
=
MIN
(
maxVgroupsPerDb
,
TSDB_MAX_VNODES_PER_DB
);
}
}
if
(
pDb
->
cfg
.
dbType
==
TSDB_DB_TYPE_TOPIC
&&
pDb
->
cfg
.
partitions
>
0
)
{
if
(
pDb
->
cfg
.
dbType
==
TSDB_DB_TYPE_TOPIC
)
{
maxVgroupsPerDb
=
pDb
->
cfg
.
partitions
;
maxVgroupsPerDb
=
TSDB_MAX_DB_PARTITON_OPTION
;
}
}
int32_t
code
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
int32_t
code
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
...
...
src/query/src/qParserImpl.c
浏览文件 @
833dde31
...
@@ -944,12 +944,9 @@ void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo) {
...
@@ -944,12 +944,9 @@ void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo) {
memset
(
&
pDBInfo
->
precision
,
0
,
sizeof
(
SStrToken
));
memset
(
&
pDBInfo
->
precision
,
0
,
sizeof
(
SStrToken
));
}
}
void
setDefaultCreateTopicOption
(
SCreateDbInfo
*
pDBInfo
)
{
void
setDefaultCreateTopicOption
(
SCreateDbInfo
*
pDBInfo
)
{
setDefaultCreateDbOption
(
pDBInfo
);
setDefaultCreateDbOption
(
pDBInfo
);
pDBInfo
->
dbType
=
TSDB_DB_TYPE_TOPIC
;
pDBInfo
->
dbType
=
TSDB_DB_TYPE_TOPIC
;
pDBInfo
->
partitions
=
TSDB_DEFAULT_DB_PARTITON_OPTION
;
pDBInfo
->
partitions
=
TSDB_DEFAULT_DB_PARTITON_OPTION
;
}
}
tests/script/general/db/topic1.sim
0 → 100644
浏览文件 @
833dde31
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 100
system sh/cfg.sh -n dnode1 -c partitions -v 4
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ====step1 create with default para
sql create topic t1;
sql use t1;
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
if $data02 != 4 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 < 1 then
return -1
endi
#numofvgroups
if $data03 < 1 then
return -1
endi
sql show t1.vgroups;
if $rows < 1 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
if $data04 < 1 then
return -1
endi
sql show t1.tables;
if $rows < 1 then
return -1
endi
sql drop topic t1
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
sql_error use t1;
sql_error show t1.vgroups;
sql_error show t1.stables;
sql_error show t1.tables;
print ====step2 create with giving para
sql create topic t1 partitions 6;
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
if $data02 != 6 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 != 6 then
return -1
endi
#numofvgroups
if $data03 != 6 then
return -1
endi
sql show t1.vgroups;
if $rows != 6 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
if $data00 != ps then
return -1
endi
if $data04 != 6 then
return -1
endi
sql show t1.tables;
if $rows != 6 then
return -1
endi
sql describe t1.ps;
if $data00 != off then
return -1
endi
if $data10 != content then
return -1
endi
if $data20 != pid then
return -1
endi
sql describe t1.p1;
if $data00 != off then
return -1
endi
if $data10 != content then
return -1
endi
if $data20 != pid then
return -1
endi
sql drop topic t1
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
sql_error show t1.vgroups;
sql_error show t1.stables;
sql_error show t1.tables;
sql_error create topic t1 partitions -1;
sql_error create topic t1 partitions 0;
sql_error create topic t1 partitions 10001;
print =============step3 create with db para
sql create topic db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1
sql show databases
if $data00 != db then
return -1
endi
if $data02 != 4 then
return -1
endi
if $data03 != 4 then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data06 != 10 then
return -1
endi
if $data07 != 20,20,20 then
return -1
endi
if $data08 != 2 then
return -1
endi
if $data09 != 4 then
return -1
endi
sql drop topic db;
sql create topic db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 partitions 7
sql show databases
if $data00 != db then
return -1
endi
if $data02 != 7 then
return -1
endi
if $data03 != 7 then
return -1
endi
if $data04 != 1 then
return -1
endi
if $data06 != 10 then
return -1
endi
if $data07 != 20,20,20 then
return -1
endi
if $data08 != 2 then
return -1
endi
if $data09 != 4 then
return -1
endi
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != db then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != db then
return -1
endi
#tables
if $data02 != 7 then
return -1
endi
#numofvgroups
sql show db.vgroups;
if $rows != 7 then
return -1
endi
sql show db.stables;
if $rows != 1 then
return -1
endi
sql show db.tables;
if $rows != 7 then
return -1
endi
print ============== step name
sql_error alter database db name d1
sql_error alter database db name d2
sql_error alter topic db name d1
sql_error alter topic db name d2
print ============== step ntables
sql_error alter database db ntables -1
sql_error alter database db ntables 0
sql_error alter database db ntables 1
sql_error alter database db ntables 10
sql_error alter topic db ntables -1
sql_error alter topic db ntables 0
sql_error alter topic db ntables 1
sql_error alter topic db ntables 10
print ============== step vgroups
sql_error alter database db vgroups -1
sql_error alter database db vgroups 0
sql_error alter database db vgroups 1
sql_error alter database db vgroups 10
sql_error alter topic db vgroups -1
sql_error alter topic db vgroups 0
sql_error alter topic db vgroups 1
sql_error alter topic db vgroups 10
print ============== step replica
sql_error alter database db replica 2
sql_error alter database db replica 3
sql_error alter database db replica 0
sql_error alter topic db replica 2
sql_error alter topic db replica 3
sql_error alter topic db replica 0
sql alter database db replica 1
sql show databases
print replica $data4_db
if $data4_db != 1 then
return -1
endi
sql show topics
if $rows != 0 then
return -1
endi
print ============== step quorum
sql show databases
print quorum $data5_db
if $data5_db != 1 then
return -1
endi
sql_error alter topic db quorum 1
sql alter database db quorum 1
sql show databases
print quorum $data5_db
if $data5_db != 1 then
return -1
endi
sql_error alter database db quorum 2
sql_error alter database db quorum 3
sql_error alter topic db quorum 2
sql_error alter topic db quorum 3
sql_error alter database db quorum 0
sql_error alter database db quorum 4
sql_error alter database db quorum 5
sql_error alter database db quorum -1
sql_error alter topic db quorum 0
sql_error alter topic db quorum 4
sql_error alter topic db quorum 5
sql_error alter topic db quorum -1
print ============== step days
sql_error alter database db days 0
sql_error alter database db days 1
sql_error alter database db days 2
sql_error alter database db days 10
sql_error alter database db days 50
sql_error alter database db days 100
sql_error alter topic db days 0
sql_error alter topic db days 1
sql_error alter topic db days 2
sql_error alter topic db days 10
sql_error alter topic db days 50
sql_error alter topic db days 100
print ============== step keep
sql show databases
print keep $data7_db
if $data7_db != 20,20,20 then
return -1
endi
sql_error topic db keep 20
sql alter database db keep 20
sql show databases
print keep $data7_db
if $data7_db != 20,20,20 then
return -1
endi
sql_error topic db keep 30
sql alter database db keep 30
sql show databases
print keep $data7_db
if $data7_db != 20,20,30 then
return -1
endi
sql_error alter database db keep 40
sql alter database db keep 40
sql show databases
print keep $data7_db
if $data7_db != 20,20,40 then
return -1
endi
sql alter database db keep 40
sql alter database db keep 30
sql alter database db keep 20
sql_error alter database db keep 10
sql_error alter database db keep 9
sql_error alter database db keep 1
sql alter database db keep 0
sql alter database db keep -1
sql_error alter database db keep 365001
sql_error alter topic db keep 40
sql_error alter topic db keep 30
sql_error alter topic db keep 20
sql_error alter topic db keep 10
sql_error alter topic db keep 9
sql_error alter topic db keep 1
sql_error alter topic db keep 0
sql_error alter topic db keep -1
sql_error alter topic db keep 365001
print ============== step cache
sql_error alter database db cache 60
sql_error alter database db cache 50
sql_error alter database db cache 20
sql_error alter database db cache 3
sql_error alter database db cache 129
sql_error alter database db cache 300
sql_error alter database db cache 0
sql_error alter database db cache -1
sql_error alter topic db cache 60
sql_error alter topic db cache 50
sql_error alter topic db cache 20
sql_error alter topic db cache 3
sql_error alter topic db cache 129
sql_error alter topic db cache 300
sql_error alter topic db cache 0
sql_error alter topic db cache -1
print ============== step blocks
sql show databases
print blocks $data9_db
if $data9_db != 4 then
return -1
endi
sql_error alter topic db blocks 10
sql alter database db blocks 10
sql show databases
print blocks $data9_db
if $data9_db != 10 then
return -1
endi
sql_error alter topic db blocks 20
sql alter database db blocks 20
sql show databases
print blocks $data9_db
if $data9_db != 20 then
return -1
endi
sql_error alter topic db blocks 20
sql alter database db blocks 30
sql show databases
print blocks $data9_db
if $data9_db != 30 then
return -1
endi
sql alter database db blocks 40
sql alter database db blocks 30
sql alter database db blocks 20
sql alter database db blocks 10
sql_error alter database db blocks 2
sql_error alter database db blocks 1
sql alter database db blocks 0
sql_error alter database db blocks -1
sql_error alter database db blocks 10001
sql_error alter topic db blocks 40
sql_error alter topic db blocks 30
sql_error alter topic db blocks 20
sql_error alter topic db blocks 10
sql_error alter topic db blocks 2
sql_error alter topic db blocks 1
sql_error alter topic db blocks 0
sql_error alter topic db blocks -1
sql_error alter topic db blocks 10001
print ============== step minrows
sql_error alter database db minrows 1
sql_error alter database db minrows 100
sql_error alter database db minrows 1000
sql_error alter topic db minrows 1
sql_error alter topic db minrows 100
sql_error alter topic db minrows 1000
print ============== step maxrows
sql_error alter database db maxrows 1
sql_error alter database db maxrows 100
sql_error alter database db maxrows 1000
sql_error alter topic db maxrows 1
sql_error alter topic db maxrows 100
sql_error alter topic db maxrows 1000
print ============== step wallevel
sql show databases
print wallevel $data12_db
if $data12_db != 1 then
return -1
endi
sql_error alter topic db wal 1
sql alter database db wal 1
sql show databases
print wal $data12_db
if $data12_db != 1 then
return -1
endi
sql alter database db wal 1
sql alter database db wal 2
sql alter database db wal 1
sql alter database db wal 2
sql alter database db wal 0
sql_error alter database db wal 3
sql_error alter database db wal 4
sql_error alter database db wal -1
sql_error alter database db wal 1000
sql_error alter topic db wal 1
sql_error alter topic db wal 2
sql_error alter topic db wal 1
sql_error alter topic db wal 2
sql_error alter topic db wal 0
sql_error alter topic db wal 3
sql_error alter topic db wal 4
sql_error alter topic db wal -1
sql_error alter topic db wal 1000
print ============== step fsync
sql alter database db fsync 0
sql alter database db fsync 1
sql alter database db fsync 3600
sql alter database db fsync 18000
sql alter database db fsync 180000
sql_error alter database db fsync 180001
sql_error alter database db fsync -1
sql_error alter topic db fsync 0
sql_error alter topic db fsync 1
sql_error alter topic db fsync 3600
sql_error alter topic db fsync 18000
sql_error alter topic db fsync 180000
sql_error alter topic db fsync 180001
sql_error alter topic db fsync -1
print ============== step comp
sql show databases
print comp $data14_db
if $data14_db != 2 then
return -1
endi
sql_error alter topic db comp 1
sql alter database db comp 1
sql show databases
print comp $data14_db
if $data14_db != 1 then
return -1
endi
sql_error alter topic db comp 2
sql alter database db comp 2
sql show databases
print comp $data14_db
if $data14_db != 2 then
return -1
endi
sql_error alter topic db comp 0
sql alter database db comp 0
sql show databases
print comp $data14_db
if $data14_db != 0 then
return -1
endi
sql_error alter database db comp 3
sql_error alter database db comp 4
sql_error alter database db comp 5
sql_error alter database db comp -1
sql_error alter topic db comp 3
sql_error alter topic db comp 4
sql_error alter topic db comp 5
sql_error alter topic db comp -1
print ============== step precision
sql_error alter database db prec 'us'
sql_error alter topic db prec 'us'
print ============== step status
sql_error alter database db status 'delete'
sql_error alter topic db status 'delete'
print ============== step drop
sql drop database db
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
print ============== step db1
sql create database d1
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
sql alter database d1 fsync 0
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
sql drop database db
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
print ============== step db2
sql create topic d1
sql show topics;
if $rows != 1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
sql alter database d1 fsync 0
sql show topics;
if $rows != 1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
sql drop database db
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
print ============== step db3
sql create topic d1
sql show topics;
if $rows != 1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
sql alter topic d1 partitions 2
sql show topics;
if $rows != 1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
sql drop database db
sql show topics;
if $rows != 0 then
return -1
endi
sql show databases;
if $rows != 0 then
return -1
endi
print ============== step partitons
sql create partiton t1 partitons 5
sql_error alter database t1 partitons -1
sql_error alter database t1 partitons 0
sql_error alter database t1 partitons 1
sql_error alter database t1 partitons 2
sql_error alter database t1 partitons 3
sql_error alter database t1 partitons 100
sql_error alter database t1 partitons 1000
sql_error alter database t1 partitons 10000
sql_error alter topic t1 partitons -1
sql_error alter topic t1 partitons 0
sql_error alter database t1 partitons 10000
sql alter topic t1 partitons 1
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 != 6 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows < 6 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
sql show t1.tables;
if $rows < 6 then
return -1
endi
sql alter topic t1 partitons 2
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 != 6 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows < 6 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
sql show t1.tables;
if $rows < 6 then
return -1
endi
sql alter topic t1 partitons 3
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 != 6 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows < 6 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
sql show t1.tables;
if $rows < 6 then
return -1
endi
sql alter topic t1 partitons 20
sql show topics;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
sql show databases;
if $rows != 1 then
return -1
endi
if $data00 != t1 then
return -1
endi
#tables
if $data02 != 6 then
return -1
endi
#numofvgroups
sql show t1.vgroups;
if $rows < 6 then
return -1
endi
sql show t1.stables;
if $rows != 1 then
return -1
endi
sql show t1.tables;
if $rows < 6 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/general/db/topic2.sim
0 → 100644
浏览文件 @
833dde31
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect
print ==== step1
sql create topic t1 partitions 2;
sql show t1.tables
if $rows != 2 then
return -1
endi
if $data00 != p1 then
return -1
endi
if $data10 != p2 then
return -1
endi
sql show t1.vgroups
if $rows != 2 then
return -1
endi
sql insert into t1.p1 values(now, '1');
sql insert into t1.p1 values(now, '2');
sql insert into t1.p1 values(now, '3');
sql insert into t1.p1 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p1 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p1 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '1');
sql insert into t1.p2 values(now, '2');
sql insert into t1.p2 values(now, '3');
sql insert into t1.p2 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p2 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p3 values(now, '1');
sql_error insert into t1.p3 values(now, '2');
sql_error insert into t1.p3 values(now, '3');
sql_error insert into t1.p3 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p3 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p3 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql select * from t1.p1 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p2 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
print ==== step2
sql alter topic t1 partitions 4;
sql show t1.tables
if $rows != 4 then
return -1
endi
if $data00 != p1 then
return -1
endi
if $data10 != p2 then
return -1
endi
if $data10 != p3 then
return -1
endi
if $data10 != p4 then
return -1
endi
sql show t1.vgroups
if $rows != 4 then
return -1
endi
sql insert into t1.p1 values(now, '1');
sql insert into t1.p1 values(now, '2');
sql insert into t1.p1 values(now, '3');
sql insert into t1.p1 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p1 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p1 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '1');
sql insert into t1.p2 values(now, '2');
sql insert into t1.p2 values(now, '3');
sql insert into t1.p2 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p2 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p3 values(now, '1');
sql insert into t1.p3 values(now, '2');
sql insert into t1.p3 values(now, '3');
sql insert into t1.p3 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p3 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p3 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p4 values(now, '1');
sql insert into t1.p4 values(now, '2');
sql insert into t1.p4 values(now, '3');
sql insert into t1.p4 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p4 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p4 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p5 values(now, '1');
sql_error insert into t1.p5 values(now, '2');
sql_error insert into t1.p5 values(now, '3');
sql_error insert into t1.p5 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p5 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p5 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql select * from t1.p1 order by off desc
if $rows != 42 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p2 order by off desc
if $rows != 42 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p3 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p3 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
print ==== step3
sql alter topic t1 partitions 1;
sql show t1.tables
if $rows != 1 then
return -1
endi
if $data00 != p1 then
return -1
endi
sql show t1.vgroups
if $rows != 1 then
return -1
endi
sql insert into t1.p1 values(now, '1');
sql insert into t1.p1 values(now, '2');
sql insert into t1.p1 values(now, '3');
sql insert into t1.p1 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p1 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p1 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p2 values(now, '1');
sql_error insert into t1.p2 values(now, '2');
sql_error insert into t1.p2 values(now, '3');
sql_error insert into t1.p2 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p2 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p2 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p3 values(now, '1');
sql_error insert into t1.p3 values(now, '2');
sql_error insert into t1.p3 values(now, '3');
sql_error insert into t1.p3 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p3 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p3 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p4 values(now, '1');
sql_error insert into t1.p4 values(now, '2');
sql_error insert into t1.p4 values(now, '3');
sql_error insert into t1.p4 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p4 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p4 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p5 values(now, '1');
sql_error insert into t1.p5 values(now, '2');
sql_error insert into t1.p5 values(now, '3');
sql_error insert into t1.p5 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql_error insert into t1.p5 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql_error insert into t1.p5 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql select * from t1.p1 order by off desc
if $rows != 63 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql_error select * from t1.p2 order by off desc
sql_error select * from t1.p3 order by off desc
sql_error select * from t1.p4 order by off desc
print ==== step4
sql alter topic t1 partitions 3;
sql show t1.tables
if $rows != 3 then
return -1
endi
if $data00 != p1 then
return -1
endi
if $data00 != p2 then
return -1
endi
if $data00 != p3 then
return -1
endi
sql show t1.vgroups
if $rows != 3 then
return -1
endi
sql insert into t1.p1 values(now, '1');
sql insert into t1.p1 values(now, '2');
sql insert into t1.p1 values(now, '3');
sql insert into t1.p1 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p1 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p1 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '1');
sql insert into t1.p2 values(now, '2');
sql insert into t1.p2 values(now, '3');
sql insert into t1.p2 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p2 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p2 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p3 values(now, '1');
sql insert into t1.p3 values(now, '2');
sql insert into t1.p3 values(now, '3');
sql insert into t1.p3 values(now, '4')(now, '5')(now, '6')(now, '7')(now, '8')(now, '9');
sql insert into t1.p3 values(now, '14')(now, '15')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p3 values(now, '24')(now, '25')(now, '16')(now, '17')(now, '18')(now, '19');
sql insert into t1.p4 values(now, '1');
sql insert into t1.p5 values(now, '1');
sql insert into t1.p6 values(now, '1');
sql_error select * from t1.p4 order by off desc
sql_error select * from t1.p5 order by off desc
sql_error select * from t1.p6 order by off desc
sql select * from t1.p1 order by off desc
if $rows != 84 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p1 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.p1 order by off desc
if $rows != 21 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select * from t1.ps order by off desc
if $rows != 126 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录