Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
299e117d
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
299e117d
编写于
7月 16, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: database options 'strict' and 'cachelast' syntax adjustments
上级
7c585d8e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
41 deletion
+47
-41
source/libs/command/src/command.c
source/libs/command/src/command.c
+8
-8
tests/pytest/util/constant.py
tests/pytest/util/constant.py
+1
-1
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+9
-9
tests/script/tsim/db/create_all_options.sim
tests/script/tsim/db/create_all_options.sim
+11
-11
tests/system-test/0-others/cachelast.py
tests/system-test/0-others/cachelast.py
+17
-11
tests/system-test/6-cluster/5dnode1mnode.py
tests/system-test/6-cluster/5dnode1mnode.py
+1
-1
未找到文件。
source/libs/command/src/command.c
浏览文件 @
299e117d
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
#include "command.h"
#include "command.h"
#include "catalog.h"
#include "catalog.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "commandInt.h"
#include "commandInt.h"
#include "scheduler.h"
#include "scheduler.h"
#include "tdatablock.h"
#include "tglobal.h"
extern
SConfig
*
tsCfg
;
extern
SConfig
*
tsCfg
;
...
@@ -222,7 +222,7 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
...
@@ -222,7 +222,7 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
char
*
retentions
=
buildRetension
(
pCfg
->
pRetensions
);
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
len
+=
sprintf
(
buf2
+
VARSTR_HEADER_SIZE
,
"CREATE DATABASE `%s` BUFFER %d CACHE
LAST
%d COMP %d DURATION %dm "
"CREATE DATABASE `%s` BUFFER %d CACHE
MODEL
%d COMP %d DURATION %dm "
"FSYNC %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"FSYNC %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
"STRICT %d WAL %d VGROUPS %d SINGLE_STABLE %d"
,
"STRICT %d WAL %d VGROUPS %d SINGLE_STABLE %d"
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheLast
,
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
fsyncPeriod
,
dbFName
,
pCfg
->
buffer
,
pCfg
->
cacheLast
,
pCfg
->
compression
,
pCfg
->
daysPerFile
,
pCfg
->
fsyncPeriod
,
...
@@ -483,7 +483,7 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
...
@@ -483,7 +483,7 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
static
int32_t
execAlterCmd
(
char
*
cmd
,
char
*
value
,
bool
*
processed
)
{
static
int32_t
execAlterCmd
(
char
*
cmd
,
char
*
value
,
bool
*
processed
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
0
==
strcasecmp
(
cmd
,
COMMAND_RESET_LOG
))
{
if
(
0
==
strcasecmp
(
cmd
,
COMMAND_RESET_LOG
))
{
taosResetLog
();
taosResetLog
();
cfgDumpCfg
(
tsCfg
,
0
,
false
);
cfgDumpCfg
(
tsCfg
,
0
,
false
);
...
@@ -502,13 +502,13 @@ _return:
...
@@ -502,13 +502,13 @@ _return:
if
(
code
)
{
if
(
code
)
{
terrno
=
code
;
terrno
=
code
;
}
}
return
code
;
return
code
;
}
}
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
bool
processed
=
false
;
bool
processed
=
false
;
if
(
execAlterCmd
(
pStmt
->
config
,
pStmt
->
value
,
&
processed
))
{
if
(
execAlterCmd
(
pStmt
->
config
,
pStmt
->
value
,
&
processed
))
{
return
terrno
;
return
terrno
;
}
}
...
@@ -516,7 +516,7 @@ static int32_t execAlterLocal(SAlterLocalStmt* pStmt) {
...
@@ -516,7 +516,7 @@ static int32_t execAlterLocal(SAlterLocalStmt* pStmt) {
if
(
processed
)
{
if
(
processed
)
{
goto
_return
;
goto
_return
;
}
}
if
(
cfgSetItem
(
tsCfg
,
pStmt
->
config
,
pStmt
->
value
,
CFG_STYPE_ALTER_CMD
))
{
if
(
cfgSetItem
(
tsCfg
,
pStmt
->
config
,
pStmt
->
value
,
CFG_STYPE_ALTER_CMD
))
{
return
terrno
;
return
terrno
;
}
}
...
...
tests/pytest/util/constant.py
浏览文件 @
299e117d
...
@@ -54,7 +54,7 @@ TAOS_KEYWORDS = [
...
@@ -54,7 +54,7 @@ TAOS_KEYWORDS = [
"BOOL"
,
"EQ"
,
"LINEAR"
,
"RESET"
,
"TSERIES"
,
"BOOL"
,
"EQ"
,
"LINEAR"
,
"RESET"
,
"TSERIES"
,
"BY"
,
"EXISTS"
,
"LOCAL"
,
"RESTRICT"
,
"UMINUS"
,
"BY"
,
"EXISTS"
,
"LOCAL"
,
"RESTRICT"
,
"UMINUS"
,
"CACHE"
,
"EXPLAIN"
,
"LP"
,
"ROW"
,
"UNION"
,
"CACHE"
,
"EXPLAIN"
,
"LP"
,
"ROW"
,
"UNION"
,
"CACHE
LAST
"
,
"FAIL"
,
"LSHIFT"
,
"RP"
,
"UNSIGNED"
,
"CACHE
MODEL
"
,
"FAIL"
,
"LSHIFT"
,
"RP"
,
"UNSIGNED"
,
"CASCADE"
,
"FILE"
,
"LT"
,
"RSHIFT"
,
"UPDATE"
,
"CASCADE"
,
"FILE"
,
"LT"
,
"RSHIFT"
,
"UPDATE"
,
"CHANGE"
,
"FILL"
,
"MATCH"
,
"SCORES"
,
"UPLUS"
,
"CHANGE"
,
"FILL"
,
"MATCH"
,
"SCORES"
,
"UPLUS"
,
"CLUSTER"
,
"FLOAT"
,
"MAXROWS"
,
"SELECT"
,
"USE"
,
"CLUSTER"
,
"FLOAT"
,
"MAXROWS"
,
"SELECT"
,
"USE"
,
...
...
tests/script/tsim/db/alter_option.sim
浏览文件 @
299e117d
...
@@ -40,13 +40,13 @@ print ============= create database
...
@@ -40,13 +40,13 @@ print ============= create database
#database_option: {
#database_option: {
# | BUFFER value [3~16384, default: 96]
# | BUFFER value [3~16384, default: 96]
# | PAGES value [64~16384, default: 256]
# | PAGES value [64~16384, default: 256]
# | CACHE
LAST value [0, 1, 2, 3
]
# | CACHE
MODEL value ['node', 'last_row', 'last_value', 'both'
]
# | FSYNC value [0 ~ 180000 ms]
# | FSYNC value [0 ~ 180000 ms]
# | KEEP value [duration, 365000]
# | KEEP value [duration, 365000]
# | REPLICA value [1 | 3]
# | REPLICA value [1 | 3]
# | WAL value [1 | 2]
# | WAL value [1 | 2]
sql create database db CACHE
LAST 3
COMP 0 DURATION 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL 2 VGROUPS 6 SINGLE_STABLE 1
sql create database db CACHE
MODEL 'both'
COMP 0 DURATION 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL 2 VGROUPS 6 SINGLE_STABLE 1
sql show databases
sql show databases
print rows: $rows
print rows: $rows
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
...
@@ -102,7 +102,7 @@ endi
...
@@ -102,7 +102,7 @@ endi
if $data15_db != 0 then # comp
if $data15_db != 0 then # comp
return -1
return -1
endi
endi
if $data16_db !=
3
then # cachelast
if $data16_db !=
both
then # cachelast
return -1
return -1
endi
endi
if $data17_db != ns then # precision
if $data17_db != ns then # precision
...
@@ -336,37 +336,37 @@ print ============== modify cachelast [0, 1, 2, 3]
...
@@ -336,37 +336,37 @@ print ============== modify cachelast [0, 1, 2, 3]
sql alter database db cachemodel 'last_value'
sql alter database db cachemodel 'last_value'
sql show databases
sql show databases
print cachelast $data16_db
print cachelast $data16_db
if $data16_db !=
2
then
if $data16_db !=
last_value
then
return -1
return -1
endi
endi
sql alter database db cachemodel 'last_row'
sql alter database db cachemodel 'last_row'
sql show databases
sql show databases
print cachelast $data16_db
print cachelast $data16_db
if $data16_db !=
1
then
if $data16_db !=
last_row
then
return -1
return -1
endi
endi
sql alter database db cachemodel 'none'
sql alter database db cachemodel 'none'
sql show databases
sql show databases
print cachelast $data16_db
print cachelast $data16_db
if $data16_db !=
0
then
if $data16_db !=
none
then
return -1
return -1
endi
endi
sql alter database db cachemodel 'last_value'
sql alter database db cachemodel 'last_value'
sql show databases
sql show databases
print cachelast $data16_db
print cachelast $data16_db
if $data16_db !=
2
then
if $data16_db !=
last_value
then
return -1
return -1
endi
endi
sql alter database db cachemodel 'both'
sql alter database db cachemodel 'both'
sql show databases
sql show databases
print cachelast $data16_db
print cachelast $data16_db
if $data16_db !=
3
then
if $data16_db !=
both
then
return -1
return -1
endi
endi
sql_error alter database db cachelast 4
sql_error alter database db cachelast 4
sql_error alter database db cachelast 10
sql_error alter database db cachelast 10
sql_error alter database db cachelast
-1
sql_error alter database db cachelast
'other'
print ============== modify precision
print ============== modify precision
sql_error alter database db precision 'ms'
sql_error alter database db precision 'ms'
...
...
tests/script/tsim/db/create_all_options.sim
浏览文件 @
299e117d
...
@@ -40,7 +40,7 @@ print ============= create database with all options
...
@@ -40,7 +40,7 @@ print ============= create database with all options
# | BUFFER value [3~16384, default: 96]
# | BUFFER value [3~16384, default: 96]
# | PAGES value [64~16384, default: 256]
# | PAGES value [64~16384, default: 256]
# | PAGESIZE value [1~16384, default: 4]
# | PAGESIZE value [1~16384, default: 4]
# | CACHE
LAST value [0, 1, 2, 3, default: 0
]
# | CACHE
MODEL value ['node', 'last_row', 'last_value', 'both', default: 'node'
]
# | COMP [0 | 1 | 2, default: 2]
# | COMP [0 | 1 | 2, default: 2]
# | DURATION value [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day]
# | DURATION value [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day]
# | FSYNC value [0 ~ 180000 ms, default: 3000]
# | FSYNC value [0 ~ 180000 ms, default: 3000]
...
@@ -122,7 +122,7 @@ endi
...
@@ -122,7 +122,7 @@ endi
if $data15_db != 2 then # comp
if $data15_db != 2 then # comp
return -1
return -1
endi
endi
if $data16_db !=
0
then # cachelast
if $data16_db !=
none
then # cachelast
return -1
return -1
endi
endi
if $data17_db != ms then # precision
if $data17_db != ms then # precision
...
@@ -167,32 +167,32 @@ sql drop database db
...
@@ -167,32 +167,32 @@ sql drop database db
#endi
#endi
#sql drop database db
#sql drop database db
print ====> CACHE
LAST
value [0, 1, 2, 3, default: 0]
print ====> CACHE
MODEL
value [0, 1, 2, 3, default: 0]
sql create database db CACHE
LAST 1
sql create database db CACHE
MODEL 'last_row'
sql show databases
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data16_db !=
1
then
if $data16_db !=
last_row
then
return -1
return -1
endi
endi
sql drop database db
sql drop database db
sql create database db CACHE
LAST 2
sql create database db CACHE
MODEL 'last_value'
sql show databases
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data16_db !=
2
then
if $data16_db !=
last_value
then
return -1
return -1
endi
endi
sql drop database db
sql drop database db
sql create database db CACHE
LAST 3
sql create database db CACHE
MODEL 'both'
sql show databases
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data16_db !=
3
then
if $data16_db !=
both
then
return -1
return -1
endi
endi
sql drop database db
sql drop database db
sql_error create database db CACHE
LAST 4
sql_error create database db CACHE
MODEL 'other'
sql_error create database db CACHE
LAST -1
sql_error create database db CACHE
MODEL '-1'
print ====> COMP [0 | 1 | 2, default: 2]
print ====> COMP [0 | 1 | 2, default: 2]
sql create database db COMP 1
sql create database db COMP 1
...
...
tests/system-test/0-others/cachelast.py
浏览文件 @
299e117d
...
@@ -36,22 +36,31 @@ class TDTestCase:
...
@@ -36,22 +36,31 @@ class TDTestCase:
def
illegal_params
(
self
):
def
illegal_params
(
self
):
illegal_params
=
[
"1"
,
"0"
,
"NULL"
,
"
None"
,
"
False"
,
"True"
,
"keep"
,
"now"
,
"*"
,
","
,
"_"
,
"abc"
,
"keep"
]
illegal_params
=
[
"1"
,
"0"
,
"NULL"
,
"False"
,
"True"
,
"keep"
,
"now"
,
"*"
,
","
,
"_"
,
"abc"
,
"keep"
]
for
value
in
illegal_params
:
for
value
in
illegal_params
:
tdSql
.
error
(
"create database testdb replica 1 cache
last
'%s' "
%
value
)
tdSql
.
error
(
"create database testdb replica 1 cache
model
'%s' "
%
value
)
unexpected_numbers
=
[
-
1
,
0.0
,
3.0
,
4
,
10
,
100
]
unexpected_numbers
=
[
-
1
,
0.0
,
3.0
,
4
,
10
,
100
]
for
number
in
unexpected_numbers
:
for
number
in
unexpected_numbers
:
tdSql
.
error
(
"create database testdb replica 1 cache
last
%s "
%
number
)
tdSql
.
error
(
"create database testdb replica 1 cache
model
%s "
%
number
)
def
getCacheModelStr
(
self
,
value
):
numbers
=
{
0
:
"none"
,
1
:
"last_row"
,
2
:
"last_value"
,
3
:
"both"
}
return
numbers
.
get
(
value
,
'other'
)
def
prepare_datas
(
self
):
def
prepare_datas
(
self
):
for
i
in
range
(
4
):
for
i
in
range
(
4
):
tdSql
.
execute
(
"create database test_db_%d replica 1 cachelast %d "
%
(
i
,
i
))
str
=
self
.
getCacheModelStr
(
i
)
tdSql
.
execute
(
"use test_db_%d"
%
i
)
tdSql
.
execute
(
"create database testdb_%s replica 1 cachemodel '%s' "
%
(
str
,
str
))
tdSql
.
execute
(
"use testdb_%s"
%
str
)
tdSql
.
execute
(
"create stable st(ts timestamp , c1 int ,c2 float ) tags(ind int) "
)
tdSql
.
execute
(
"create stable st(ts timestamp , c1 int ,c2 float ) tags(ind int) "
)
tdSql
.
execute
(
"create table tb1 using st tags(1) "
)
tdSql
.
execute
(
"create table tb1 using st tags(1) "
)
tdSql
.
execute
(
"create table tb2 using st tags(2) "
)
tdSql
.
execute
(
"create table tb2 using st tags(2) "
)
...
@@ -81,10 +90,10 @@ class TDTestCase:
...
@@ -81,10 +90,10 @@ class TDTestCase:
# cache_last_set value
# cache_last_set value
for
k
,
v
in
cache_lasts
.
items
():
for
k
,
v
in
cache_lasts
.
items
():
if
k
.
split
(
"_"
)[
-
1
]
==
str
(
v
):
if
k
==
"testdb_"
+
str
(
v
):
tdLog
.
info
(
" database %s cache_last value check pass, value is %
d
"
%
(
k
,
v
)
)
tdLog
.
info
(
" database %s cache_last value check pass, value is %
s
"
%
(
k
,
v
)
)
else
:
else
:
tdLog
.
exit
(
" database %s cache_last value check fail, value is %
d
"
%
(
k
,
v
)
)
tdLog
.
exit
(
" database %s cache_last value check fail, value is %
s
"
%
(
k
,
v
)
)
# # check storage layer implementation
# # check storage layer implementation
...
@@ -132,13 +141,10 @@ class TDTestCase:
...
@@ -132,13 +141,10 @@ class TDTestCase:
def
run
(
self
):
# sourcery skip: extract-duplicate-method, remove-redundant-fstring
def
run
(
self
):
# sourcery skip: extract-duplicate-method, remove-redundant-fstring
self
.
illegal_params
()
self
.
illegal_params
()
self
.
prepare_datas
()
self
.
prepare_datas
()
self
.
check_cache_last_sets
()
self
.
check_cache_last_sets
()
self
.
restart_check_cache_last_sets
()
self
.
restart_check_cache_last_sets
()
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/6-cluster/5dnode1mnode.py
浏览文件 @
299e117d
...
@@ -123,7 +123,7 @@ class TDTestCase:
...
@@ -123,7 +123,7 @@ class TDTestCase:
tdSql
.
query
(
'show databases;'
)
tdSql
.
query
(
'show databases;'
)
tdSql
.
checkData
(
2
,
5
,
'off'
)
tdSql
.
checkData
(
2
,
5
,
'off'
)
tdSql
.
error
(
'alter database db strict '
off
''
)
tdSql
.
error
(
"alter database db strict 'off'"
)
# tdSql.execute('alter database db strict 'on'')
# tdSql.execute('alter database db strict 'on'')
# tdSql.query('show databases;')
# tdSql.query('show databases;')
# tdSql.checkData(2,5,'strict')
# tdSql.checkData(2,5,'strict')
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录