未验证 提交 9adf9478 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2306 from taosdata/bugfix/td-642

fix td-642
...@@ -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;
} }
} }
......
...@@ -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;
......
...@@ -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);
} }
......
...@@ -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 mt304 tags(1, 1)
print create tb2 print create tb2
sql create table tb2 using mt tags(1, -1) sql create table tb2 using mt304 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 mt304 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 20000 sleep 100000
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 mt304 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 mt304 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 60000
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 10000 sleep 60000
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 100000
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 10000 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 5000 sleep 20000
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 5000 sleep 30000
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.
先完成此消息的编辑!
想要评论请 注册