Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
王长生-AnH
TDengine
提交
9adf9478
T
TDengine
项目概览
王长生-AnH
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
9adf9478
编写于
6月 16, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2306 from taosdata/bugfix/td-642
fix td-642
上级
af84f8de
3d567070
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
36 deletion
+31
-36
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+6
-3
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+4
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+5
-5
tests/script/general/parser/stream.sim
tests/script/general/parser/stream.sim
+16
-28
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
9adf9478
...
@@ -6082,11 +6082,14 @@ int32_t exprTreeFromSqlExpr(tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray*
...
@@ -6082,11 +6082,14 @@ int32_t exprTreeFromSqlExpr(tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray*
}
}
}
}
if
((
*
pExpr
)
->
_node
.
optr
!=
TSDB_RELATION_EQUAL
&&
(
*
pExpr
)
->
_node
.
optr
!=
TSDB_RELATION_NOT_EQUAL
)
{
if
((
*
pExpr
)
->
_node
.
optr
!=
TSDB_RELATION_EQUAL
&&
(
*
pExpr
)
->
_node
.
optr
!=
TSDB_RELATION_NOT_EQUAL
)
{
if
(
pRight
->
nodeType
==
TSQL_NODE_VALUE
)
{
if
(
pRight
->
nodeType
==
TSQL_NODE_VALUE
)
{
if
(
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_BOOL
if
(
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_BOOL
)
{
||
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_BINARY
return
TSDB_CODE_TSC_INVALID_SQL
;
||
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
}
if
((
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pRight
->
pVal
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
&&
(
*
pExpr
)
->
_node
.
optr
!=
TSDB_RELATION_LIKE
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
}
}
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
9adf9478
...
@@ -600,6 +600,10 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
...
@@ -600,6 +600,10 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
return
-
1
;
return
-
1
;
}
}
if
(
pTable
->
cqhandle
!=
NULL
)
{
pRepo
->
appH
.
cqDropFunc
(
pTable
->
cqhandle
);
}
tsdbTrace
(
"vgId:%d, table %s is dropped! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
tsdbTrace
(
"vgId:%d, table %s is dropped! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
tableId
.
tid
,
tableId
.
uid
);
tableId
.
tid
,
tableId
.
uid
);
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
,
true
)
<
0
)
return
-
1
;
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
,
true
)
<
0
)
return
-
1
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
9adf9478
...
@@ -325,6 +325,11 @@ void vnodeRelease(void *pVnodeRaw) {
...
@@ -325,6 +325,11 @@ void vnodeRelease(void *pVnodeRaw) {
tsdbCloseRepo
(
pVnode
->
tsdb
,
1
);
tsdbCloseRepo
(
pVnode
->
tsdb
,
1
);
pVnode
->
tsdb
=
NULL
;
pVnode
->
tsdb
=
NULL
;
// stop continuous query
if
(
pVnode
->
cq
)
cqClose
(
pVnode
->
cq
);
pVnode
->
cq
=
NULL
;
if
(
pVnode
->
wal
)
if
(
pVnode
->
wal
)
walClose
(
pVnode
->
wal
);
walClose
(
pVnode
->
wal
);
pVnode
->
wal
=
NULL
;
pVnode
->
wal
=
NULL
;
...
@@ -436,11 +441,6 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
...
@@ -436,11 +441,6 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
pVnode
->
sync
=
NULL
;
pVnode
->
sync
=
NULL
;
}
}
// stop continuous query
if
(
pVnode
->
cq
)
cqClose
(
pVnode
->
cq
);
pVnode
->
cq
=
NULL
;
// release local resources only after cutting off outside connections
// release local resources only after cutting off outside connections
vnodeRelease
(
pVnode
);
vnodeRelease
(
pVnode
);
}
}
...
...
tests/script/general/parser/stream.sim
浏览文件 @
9adf9478
...
@@ -51,19 +51,20 @@ sql drop table strm
...
@@ -51,19 +51,20 @@ sql drop table strm
## [TBASE304]
## [TBASE304]
print ====== TBASE-304
print ====== TBASE-304
sleep 10000
sleep 10000
print create mt
# we cannot reset query cache in server side, as a workaround,
sql create table mt (ts timestamp, c1 int) tags(t1 int, t2 int)
# set super table name to mt304, need to change back to mt later
print create mt304
sql create table mt304 (ts timestamp, c1 int) tags(t1 int, t2 int)
print create tb1
print create tb1
sql create table tb1 using mt tags(1, 1)
sql create table tb1 using mt
304
tags(1, 1)
print create tb2
print create tb2
sql create table tb2 using mt tags(1, -1)
sql create table tb2 using mt
304
tags(1, -1)
print create strm
print create strm
sql create table strm as select count(*), avg(c1) from mt where t2 >= 0 interval(4s) sliding(2s)
sql create table strm as select count(*), avg(c1) from mt
304
where t2 >= 0 interval(4s) sliding(2s)
sql insert into tb1 values (now,1)
sql insert into tb1 values (now,1)
sql insert into tb2 values (now,2)
sql insert into tb2 values (now,2)
sleep
2
0000
sleep
10
0000
sql select * from strm;
sql select * from strm;
sleep 1000
if $rows != 2 then
if $rows != 2 then
print ==== expect rows = 2, actually returned rows = $rows
print ==== expect rows = 2, actually returned rows = $rows
return -1
return -1
...
@@ -75,11 +76,11 @@ print data02 = $data02
...
@@ -75,11 +76,11 @@ print data02 = $data02
if $data02 != 1.000000000 then
if $data02 != 1.000000000 then
return -1
return -1
endi
endi
sql alter table mt drop tag t2;
sql alter table mt
304
drop tag t2;
sql insert into tb2 values (now,2);
sql insert into tb2 values (now,2);
sql insert into tb1 values (now,1);
sql insert into tb1 values (now,1);
sql select * from strm;
sql select * from strm;
sql alter table mt add tag t2 int;
sql alter table mt
304
add tag t2 int;
sleep 10000
sleep 10000
sql select * from strm
sql select * from strm
...
@@ -98,7 +99,7 @@ sleep 4000
...
@@ -98,7 +99,7 @@ sleep 4000
sql insert into tb2 values (now, 2, 'tb2')
sql insert into tb2 values (now, 2, 'tb2')
sleep 4000
sleep 4000
sql insert into tb3 values (now, 0, 'tb3')
sql insert into tb3 values (now, 0, 'tb3')
sleep 6000
sleep 6000
0
sql describe strm
sql describe strm
if $rows == 0 then
if $rows == 0 then
...
@@ -134,11 +135,9 @@ endi
...
@@ -134,11 +135,9 @@ endi
## The vnode client needs to refresh metadata cache to allow strm calculate tb4's data. But the current refreshing frequency is every 10 min
## The vnode client needs to refresh metadata cache to allow strm calculate tb4's data. But the current refreshing frequency is every 10 min
## commented out the case below to save running time
## commented out the case below to save running time
sql create table tb4 using stb tags('a4')
sql create table tb4 using stb tags('a4')
sleep 6000
sql insert into tb4 values(now, 4, 'tb4')
sql insert into tb4 values(now, 4, 'tb4')
sleep
1
0000
sleep
6
0000
sql select * from strm order by ts desc
sql select * from strm order by ts desc
sleep 1000
print ======== data0: $data00 $data01 $data02 $data03
print ======== data0: $data00 $data01 $data02 $data03
#print ======== data1: $data10 $data11 $data12 $data13
#print ======== data1: $data10 $data11 $data12 $data13
#print ======== data2: $data20 $data21 $data22 $data23
#print ======== data2: $data20 $data21 $data22 $data23
...
@@ -160,7 +159,7 @@ sleep 3000 # waiting for new tag valid
...
@@ -160,7 +159,7 @@ sleep 3000 # waiting for new tag valid
sql insert into tb1 values (now, 1, 'tb1_a1')
sql insert into tb1 values (now, 1, 'tb1_a1')
sleep 4000
sleep 4000
sql insert into tb4 values (now, -4, 'tb4_b4')
sql insert into tb4 values (now, -4, 'tb4_b4')
sleep 10000
sleep 10000
0
sql select * from strm order by ts desc
sql select * from strm order by ts desc
sleep 1000
sleep 1000
print ======== data0: $data00 $data01 $data02 $data03
print ======== data0: $data00 $data01 $data02 $data03
...
@@ -191,9 +190,9 @@ sql create table tb3 using stb tags(3, 'tb3')
...
@@ -191,9 +190,9 @@ sql create table tb3 using stb tags(3, 'tb3')
sql create table tb4 using stb tags(4, 'tb4')
sql create table tb4 using stb tags(4, 'tb4')
sql create table strm0 as select count(ts), count(c1), max(c2), min(c4), first(c5), last(c6) from stb where ts < now + 30s interval(4s) sliding(2s)
sql create table strm0 as select count(ts), count(c1), max(c2), min(c4), first(c5), last(c6) from stb where ts < now + 30s interval(4s) sliding(2s)
sleep 1000
0
sleep 1000
sql insert into tb0 values (now, 0, 0, 0, 0, 'binary0', '涛思0', true) tb1 values (now, 1, 1, 1, 1, 'binary1', '涛思1', false) tb2 values (now, 2, 2, 2, 2, 'binary2', '涛思2', true) tb3 values (now, 3, 3, 3, 3, 'binary3', '涛思3', false) tb4 values (now, 4, 4, 4, 4, 'binary4', '涛思4', true)
sql insert into tb0 values (now, 0, 0, 0, 0, 'binary0', '涛思0', true) tb1 values (now, 1, 1, 1, 1, 'binary1', '涛思1', false) tb2 values (now, 2, 2, 2, 2, 'binary2', '涛思2', true) tb3 values (now, 3, 3, 3, 3, 'binary3', '涛思3', false) tb4 values (now, 4, 4, 4, 4, 'binary4', '涛思4', true)
sleep
5
000
sleep
20
000
sql select * from strm0 order by ts desc
sql select * from strm0 order by ts desc
sleep 1000
sleep 1000
if $rows != 2 then
if $rows != 2 then
...
@@ -202,7 +201,7 @@ if $rows != 2 then
...
@@ -202,7 +201,7 @@ if $rows != 2 then
endi
endi
sql insert into tb0 values (now, 10, 10, 10, 10, 'binary0', '涛思0', true) tb1 values (now, 11, 11, 11, 11, 'binary1', '涛思1', false) tb2 values (now, 12, 12, 12, 12, 'binary2', '涛思2', true) tb3 values (now, 13, 13, 13, 13, 'binary3', '涛思3', false) tb4 values (now, 14, 14, 14, 14, 'binary4', '涛思4', true)
sql insert into tb0 values (now, 10, 10, 10, 10, 'binary0', '涛思0', true) tb1 values (now, 11, 11, 11, 11, 'binary1', '涛思1', false) tb2 values (now, 12, 12, 12, 12, 'binary2', '涛思2', true) tb3 values (now, 13, 13, 13, 13, 'binary3', '涛思3', false) tb4 values (now, 14, 14, 14, 14, 'binary4', '涛思4', true)
sleep
5
000
sleep
30
000
sql select * from strm0 order by ts desc
sql select * from strm0 order by ts desc
sleep 1000
sleep 1000
if $rows != 4 then
if $rows != 4 then
...
@@ -210,15 +209,4 @@ if $rows != 4 then
...
@@ -210,15 +209,4 @@ if $rows != 4 then
return -1
return -1
endi
endi
sql drop database if exists strm_db_0
sql show databases
if $rows != 0 then
return -1
endi
sql create database $db
sql use $db
sql create table stb (ts timestamp, c1 int) tags(t1 int)
sql create table tb1 using stb tags(1)
system sh/exec.sh -n dnode1 -s stop -x SIGINT
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录