Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a324b654
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
a324b654
编写于
6月 01, 2022
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.6' into cases/TS-1579-V26
上级
3aa44a8d
5942b589
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
163 addition
and
14 deletion
+163
-14
src/client/src/tscDelete.c
src/client/src/tscDelete.c
+4
-0
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+20
-10
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-3
src/tsdb/src/tsdbDelete.c
src/tsdb/src/tsdbDelete.c
+1
-1
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-0
tests/pytest/multilevel/addAnotherDir.py
tests/pytest/multilevel/addAnotherDir.py
+65
-0
tests/pytest/multilevel/addAnotherLevel.py
tests/pytest/multilevel/addAnotherLevel.py
+64
-0
tests/pytest/tsdb/delete.py
tests/pytest/tsdb/delete.py
+6
-0
未找到文件。
src/client/src/tscDelete.c
浏览文件 @
a324b654
...
@@ -198,6 +198,10 @@ int32_t executeDelete(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
...
@@ -198,6 +198,10 @@ int32_t executeDelete(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
SSubqueryState
*
pState
=
&
pSql
->
subState
;
SSubqueryState
*
pState
=
&
pSql
->
subState
;
int32_t
numOfSub
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
int32_t
numOfSub
=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
;
if
(
numOfSub
==
0
)
{
tscInfo
(
":CDEL SQL:%p tablename=%s numOfVgroups is zero, maybe empty table."
,
pSql
,
pTableMetaInfo
->
name
.
tname
);
return
TSDB_CODE_FAILED
;
}
ret
=
doInitSubState
(
pSql
,
numOfSub
);
ret
=
doInitSubState
(
pSql
,
numOfSub
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
a324b654
...
@@ -2087,7 +2087,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -2087,7 +2087,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
switch
(
tag_state
)
{
switch
(
tag_state
)
{
case
tag_common
:
case
tag_common
:
if
(
back_slash
==
true
)
{
if
(
back_slash
==
true
)
{
if
(
*
cur
!=
','
&&
*
cur
!=
'='
&&
*
cur
!=
' '
)
{
if
(
*
cur
!=
','
&&
*
cur
!=
'='
&&
*
cur
!=
' '
&&
*
cur
!=
'n'
)
{
tscError
(
"SML:0x%"
PRIx64
" tag value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
tag_state
,
*
cur
);
tscError
(
"SML:0x%"
PRIx64
" tag value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
tag_state
,
*
cur
);
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
goto
error
;
...
@@ -2152,7 +2152,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -2152,7 +2152,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
break
;
break
;
case
tag_lqoute
:
case
tag_lqoute
:
if
(
back_slash
==
true
)
{
if
(
back_slash
==
true
)
{
if
(
*
cur
!=
','
&&
*
cur
!=
'='
&&
*
cur
!=
' '
)
{
if
(
*
cur
!=
','
&&
*
cur
!=
'='
&&
*
cur
!=
' '
&&
*
cur
!=
'n'
)
{
tscError
(
"SML:0x%"
PRIx64
" tag value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
tag_state
,
*
cur
);
tscError
(
"SML:0x%"
PRIx64
" tag value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
tag_state
,
*
cur
);
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
goto
error
;
...
@@ -2223,7 +2223,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -2223,7 +2223,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
switch
(
val_state
)
{
switch
(
val_state
)
{
case
val_common
:
case
val_common
:
if
(
back_slash
==
true
)
{
if
(
back_slash
==
true
)
{
if
(
*
cur
!=
'\\'
&&
*
cur
!=
'"'
)
{
if
(
*
cur
!=
'\\'
&&
*
cur
!=
'"'
&&
*
cur
!=
'n'
)
{
tscError
(
"SML:0x%"
PRIx64
" field value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
val_state
,
*
cur
);
tscError
(
"SML:0x%"
PRIx64
" field value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
val_state
,
*
cur
);
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
goto
error
;
...
@@ -2318,7 +2318,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -2318,7 +2318,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
break
;
break
;
case
val_lqoute
:
case
val_lqoute
:
if
(
back_slash
==
true
)
{
if
(
back_slash
==
true
)
{
if
(
*
cur
!=
'\\'
&&
*
cur
!=
'"'
)
{
if
(
*
cur
!=
'\\'
&&
*
cur
!=
'"'
&&
*
cur
!=
'n'
)
{
tscError
(
"SML:0x%"
PRIx64
" field value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
val_state
,
*
cur
);
tscError
(
"SML:0x%"
PRIx64
" field value: state(%d), incorrect character(%c) escaped"
,
info
->
id
,
val_state
,
*
cur
);
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
ret
=
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
goto
error
;
goto
error
;
...
@@ -2488,12 +2488,15 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
...
@@ -2488,12 +2488,15 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
if
(
isField
)
{
if
(
isField
)
{
capacity
=
64
;
capacity
=
64
;
*
pKVs
=
malloc
(
capacity
*
sizeof
(
TAOS_SML_KV
));
*
pKVs
=
malloc
(
capacity
*
sizeof
(
TAOS_SML_KV
));
memset
(
*
pKVs
,
0
,
capacity
*
sizeof
(
TAOS_SML_KV
));
// leave space for timestamp;
// leave space for timestamp;
pkv
=
*
pKVs
;
pkv
=
*
pKVs
;
pkv
++
;
pkv
++
;
*
num_kvs
=
1
;
// ts fixed column
}
else
{
}
else
{
capacity
=
8
;
capacity
=
8
;
*
pKVs
=
malloc
(
capacity
*
sizeof
(
TAOS_SML_KV
));
*
pKVs
=
malloc
(
capacity
*
sizeof
(
TAOS_SML_KV
));
memset
(
*
pKVs
,
0
,
capacity
*
sizeof
(
TAOS_SML_KV
));
pkv
=
*
pKVs
;
pkv
=
*
pKVs
;
}
}
...
@@ -2554,7 +2557,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
...
@@ -2554,7 +2557,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
*
pKVs
=
more_kvs
;
*
pKVs
=
more_kvs
;
//move pKV points to next TAOS_SML_KV block
//move pKV points to next TAOS_SML_KV block
if
(
isField
)
{
if
(
isField
)
{
pkv
=
*
pKVs
+
*
num_kvs
+
1
;
pkv
=
*
pKVs
+
*
num_kvs
;
// first ts column reserved
}
else
{
}
else
{
pkv
=
*
pKVs
+
*
num_kvs
;
pkv
=
*
pKVs
+
*
num_kvs
;
}
}
...
@@ -2576,7 +2579,7 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t
...
@@ -2576,7 +2579,7 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t
tsField
->
key
=
malloc
(
strlen
(
ts
->
key
)
+
1
);
tsField
->
key
=
malloc
(
strlen
(
ts
->
key
)
+
1
);
memcpy
(
tsField
->
key
,
ts
->
key
,
strlen
(
ts
->
key
)
+
1
);
memcpy
(
tsField
->
key
,
ts
->
key
,
strlen
(
ts
->
key
)
+
1
);
memcpy
(
tsField
->
value
,
ts
->
value
,
ts
->
length
);
memcpy
(
tsField
->
value
,
ts
->
value
,
ts
->
length
);
(
*
smlData
)
->
fieldNum
=
(
*
smlData
)
->
fieldNum
+
1
;
//(*smlData)->fieldNum = (*smlData)->fieldNum + 1; // already reserved for first ts column
free
(
ts
->
key
);
free
(
ts
->
key
);
free
(
ts
->
value
);
free
(
ts
->
value
);
...
@@ -2634,14 +2637,21 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
...
@@ -2634,14 +2637,21 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInf
//=========================================================================
//=========================================================================
void
destroySmlDataPoint
(
TAOS_SML_DATA_POINT
*
point
)
{
void
destroySmlDataPoint
(
TAOS_SML_DATA_POINT
*
point
)
{
TAOS_SML_KV
*
pkv
;
for
(
int
i
=
0
;
i
<
point
->
tagNum
;
++
i
)
{
for
(
int
i
=
0
;
i
<
point
->
tagNum
;
++
i
)
{
free
((
point
->
tags
+
i
)
->
key
);
pkv
=
point
->
tags
+
i
;
free
((
point
->
tags
+
i
)
->
value
);
if
(
pkv
->
key
)
free
(
pkv
->
key
);
if
(
pkv
->
value
)
free
(
pkv
->
value
);
}
}
free
(
point
->
tags
);
free
(
point
->
tags
);
for
(
int
i
=
0
;
i
<
point
->
fieldNum
;
++
i
)
{
for
(
int
i
=
0
;
i
<
point
->
fieldNum
;
++
i
)
{
free
((
point
->
fields
+
i
)
->
key
);
pkv
=
point
->
fields
+
i
;
free
((
point
->
fields
+
i
)
->
value
);
if
(
pkv
->
key
)
free
(
pkv
->
key
);
if
(
pkv
->
value
)
free
(
pkv
->
value
);
}
}
free
(
point
->
fields
);
free
(
point
->
fields
);
free
(
point
->
stableName
);
free
(
point
->
stableName
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
a324b654
...
@@ -3921,9 +3921,7 @@ void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGr
...
@@ -3921,9 +3921,7 @@ void* createQInfoFromQueryNode(SQueryInfo* pQueryInfo, STableGroupInfo* pTableGr
}
else
if
(
pQueryAttr
->
pExpr2
!=
NULL
)
{
}
else
if
(
pQueryAttr
->
pExpr2
!=
NULL
)
{
pEx
=
pQueryAttr
->
pExpr2
;
pEx
=
pQueryAttr
->
pExpr2
;
num
=
pQueryAttr
->
numOfExpr2
;
num
=
pQueryAttr
->
numOfExpr2
;
}
}
else
{
if
(
num
<
pQueryAttr
->
numOfOutput
)
{
pEx
=
pQueryAttr
->
pExpr1
;
pEx
=
pQueryAttr
->
pExpr1
;
num
=
pQueryAttr
->
numOfOutput
;
num
=
pQueryAttr
->
numOfOutput
;
}
}
...
...
src/tsdb/src/tsdbDelete.c
浏览文件 @
a324b654
...
@@ -125,7 +125,7 @@ static int tsdbDeleteImplCommon(STsdbRepo *pRepo, SControlDataInfo* pCtlInfo) {
...
@@ -125,7 +125,7 @@ static int tsdbDeleteImplCommon(STsdbRepo *pRepo, SControlDataInfo* pCtlInfo) {
pRepo
->
deleteState
=
TSDB_NO_DELETE
;
pRepo
->
deleteState
=
TSDB_NO_DELETE
;
tsem_post
(
&
(
pRepo
->
readyToCommit
));
tsem_post
(
&
(
pRepo
->
readyToCommit
));
tsdbInfo
(
"vgId:%d :SDEL delete over, no meta or data file"
,
REPO_ID
(
pRepo
));
tsdbInfo
(
"vgId:%d :SDEL delete over, no meta or data file"
,
REPO_ID
(
pRepo
));
return
-
1
;
return
TSDB_CODE_SUCCESS
;
}
}
SArray
*
aUpdates
=
taosArrayInit
(
10
,
sizeof
(
STable
*
));
SArray
*
aUpdates
=
taosArrayInit
(
10
,
sizeof
(
STable
*
));
...
...
tests/parallel_test/cases.task
浏览文件 @
a324b654
...
@@ -270,6 +270,7 @@
...
@@ -270,6 +270,7 @@
24,,script,./test.sh -f general/connection/test_old_data.sim
24,,script,./test.sh -f general/connection/test_old_data.sim
24,,script,./test.sh -f general/cache/restart_metrics.sim
24,,script,./test.sh -f general/cache/restart_metrics.sim
24,,script,./test.sh -f general/alter/insert2.sim
24,,script,./test.sh -f general/alter/insert2.sim
24,,pytest,python3 test.py -f multilevel/addAnotherLevel.py
24,,pytest,python3 test.py -f tag_lite/datatype-without-alter.py
24,,pytest,python3 test.py -f tag_lite/datatype-without-alter.py
23,,script,./test.sh -f general/parser/select_from_cache_disk.sim
23,,script,./test.sh -f general/parser/select_from_cache_disk.sim
23,,script,./test.sh -f general/parser/mixed_blocks.sim
23,,script,./test.sh -f general/parser/mixed_blocks.sim
...
@@ -319,6 +320,7 @@
...
@@ -319,6 +320,7 @@
20,,pytest,python3 test.py -f table/create.py
20,,pytest,python3 test.py -f table/create.py
19,,script,./test.sh -f unique/stable/dnode2.sim
19,,script,./test.sh -f unique/stable/dnode2.sim
19,,script,./test.sh -f general/db/vnodes.sim
19,,script,./test.sh -f general/db/vnodes.sim
19,,pytest,python3 test.py -f multilevel/addAnotherDir.py
19,,pytest,python3 test.py -f tools/taosdumpTest3.py
19,,pytest,python3 test.py -f tools/taosdumpTest3.py
19,,pytest,python3 test.py -f query/udf.py
19,,pytest,python3 test.py -f query/udf.py
19,,pytest,python3 test.py -f import_merge/importLastTPO.py
19,,pytest,python3 test.py -f import_merge/importLastTPO.py
...
...
tests/pytest/multilevel/addAnotherDir.py
0 → 100644
浏览文件 @
a324b654
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
cfg
=
{
'monitor'
:
1
,
'/mnt/data1 0 1'
:
'dataDir'
}
tdSql
.
createDir
(
'/mnt/data1'
)
tdLog
.
info
(
"================= step1"
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
deploy
(
1
,
cfg
)
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"create database db"
)
tdSql
.
execute
(
"create table db.tb (ts timestamp, f1 int)"
)
sql
=
"insert into db.tb values "
ts
=
1622390400000
for
i
in
range
(
1000
):
sql
+=
"(%d, %d)"
%
(
ts
+
i
,
i
)
tdSql
.
execute
(
sql
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
cfg
(
1
,
'dataDir'
,
'/mnt/data2 0 0'
)
tdSql
.
createDir
(
'/mnt/data2'
)
tdDnodes
.
start
(
1
)
tdSql
.
query
(
"select * from db.tb"
)
tdSql
.
checkRows
(
1000
)
def
stop
(
self
):
tdSql
.
close
()
os
.
system
(
"rm -rf /mnt/data1"
)
os
.
system
(
"rm -rf /mnt/data2"
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/multilevel/addAnotherLevel.py
0 → 100644
浏览文件 @
a324b654
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
cfg
=
{
'/mnt/data1 0 1'
:
'dataDir'
}
tdSql
.
createDir
(
'/mnt/data1'
)
tdLog
.
info
(
"================= step1"
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
deploy
(
1
,
cfg
)
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"create database db"
)
tdSql
.
execute
(
"create table db.tb (ts timestamp, f1 int)"
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
cfg
(
1
,
'dataDir'
,
'/mnt/data2 1 0'
)
tdSql
.
createDir
(
'/mnt/data2'
)
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"insert into db.tb values('2015-1-1', 1);"
)
tdSql
.
execute
(
"alter database db keep 365,3650,3650"
)
tdDnodes
.
stop
(
1
)
tdLog
.
info
(
"================= step2"
)
tdSql
.
haveFile
(
'/mnt/data2'
,
1
)
def
stop
(
self
):
tdSql
.
close
()
os
.
system
(
"rm -rf /mnt/data1"
)
os
.
system
(
"rm -rf /mnt/data2"
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tsdb/delete.py
浏览文件 @
a324b654
...
@@ -80,11 +80,17 @@ class TDTestCase:
...
@@ -80,11 +80,17 @@ class TDTestCase:
def
create_tables
(
self
):
def
create_tables
(
self
):
# super table
# super table
tdSql
.
execute
(
"create table st(ts timestamp, i1 int) tags(area int)"
)
tdSql
.
execute
(
"create table st(ts timestamp, i1 int) tags(area int)"
)
# test delete empty super table
tdSql
.
execute
(
"delete from st"
)
# child table
# child table
for
i
in
range
(
10
):
for
i
in
range
(
10
):
sql
=
"create table t%d using st tags(%d)"
%
(
i
,
i
)
sql
=
"create table t%d using st tags(%d)"
%
(
i
,
i
)
tdSql
.
execute
(
sql
)
tdSql
.
execute
(
sql
)
# test delete empty table
tdSql
.
execute
(
"delete from t0"
)
return
return
# insert data1
# insert data1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录