提交 a324b654 编写于 作者: P Ping Xiao

Merge branch '2.6' into cases/TS-1579-V26

...@@ -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) {
......
...@@ -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);
......
...@@ -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;
} }
......
...@@ -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 *));
......
...@@ -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
......
###################################################################
# 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())
###################################################################
# 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())
...@@ -80,10 +80,16 @@ class TDTestCase: ...@@ -80,10 +80,16 @@ 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册