diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 8602421ed0..e1316af9a5 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -233,7 +233,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml goto END; } SML_CHECK_CODE(smlBuildSTableMeta(info->dataFormat, sMeta)); - for (int i = 1; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++) { + for (int i = 0; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++) { SSchema *col = pTableMeta->schema + i; SSmlKv kv = {.key = col->name, .keyLen = strlen(col->name), .type = col->type}; if (col->type == TSDB_DATA_TYPE_NCHAR) { @@ -772,22 +772,26 @@ END: RETURN } -static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool isTag) { +static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols) { int32_t code = TSDB_CODE_SUCCESS; int32_t lino = 0; SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); SML_CHECK_NULL(hashTmp); - int32_t i = 0; - for (; i < length; i++) { - SML_CHECK_CODE(taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES)); + for (int32_t i = 0; i < length; i++) { + SML_CHECK_CODE(taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &schema[i], sizeof(SSchema))); } - i = isTag ? 0 : 1; - for (; i < taosArrayGetSize(cols); i++) { + for (int32_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); SML_CHECK_NULL(kv); - if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { + SSchema *sTmp = taosHashGet(hashTmp, kv->key, kv->keyLen); + if (sTmp == NULL) { SML_CHECK_CODE(TSDB_CODE_SML_INVALID_DATA); } + if ((IS_VAR_DATA_TYPE(kv->type) && kv->length + VARSTR_HEADER_SIZE > sTmp->bytes)){ + uError("column %s (type %s) bytes invalid. db bytes:%d, kv bytes:%zu", sTmp->name, + tDataTypes[sTmp->type].name, sTmp->bytes, kv->length); + SML_CHECK_CODE(TSDB_CODE_INTERNAL_ERROR); + } } END: @@ -1132,8 +1136,8 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { } if (needCheckMeta) { - SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, sTableData->tags, true)); - SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[0]), pTableMeta->tableInfo.numOfColumns, sTableData->cols, false)); + SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, sTableData->tags)); + SML_CHECK_CODE(smlCheckMeta(&(pTableMeta->schema[0]), pTableMeta->tableInfo.numOfColumns, sTableData->cols)); } taosMemoryFreeClear(sTableData->tableMeta); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 0d17ccd0b0..f3baa04f9b 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1239,6 +1239,7 @@ static int32_t mndAlterDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pOld, SDbObj *p mndTransSetDbName(pTrans, pOld->name, NULL); TAOS_CHECK_GOTO(mndTransCheckConflict(pMnode, pTrans), NULL, _OVER); + TAOS_CHECK_GOTO(mndTransCheckConflictWithCompact(pMnode, pTrans), NULL, _OVER); TAOS_CHECK_GOTO(mndSetAlterDbPrepareLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); TAOS_CHECK_GOTO(mndSetAlterDbCommitLogs(pMnode, pTrans, pOld, pNew), NULL, _OVER); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 4268d73746..e51500bf34 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -867,6 +867,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { if (pIter == NULL) break; if (pNew->conflict == TRN_CONFLICT_GLOBAL) conflict = true; + if (pNew->conflict == TRN_CONFLICT_DB) { if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true; if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { @@ -874,6 +875,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { mndTransLogConflict(pNew, pTrans, mndCheckStbConflict(pNew->stbname, pTrans), &conflict); } } + if (pNew->conflict == TRN_CONFLICT_DB_INSIDE) { if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true; if (pTrans->conflict == TRN_CONFLICT_DB) { @@ -885,22 +887,6 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { } } -// if (pNew->conflict == TRN_CONFLICT_TOPIC) { -// if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true; -// if (pTrans->conflict == TRN_CONFLICT_TOPIC || pTrans->conflict == TRN_CONFLICT_TOPIC_INSIDE) { -// if (strcasecmp(pNew->dbname, pTrans->dbname) == 0) conflict = true; -// } -// } -// if (pNew->conflict == TRN_CONFLICT_TOPIC_INSIDE) { -// if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true; -// if (pTrans->conflict == TRN_CONFLICT_TOPIC) { -// if (strcasecmp(pNew->dbname, pTrans->dbname) == 0) conflict = true; -// } -// if (pTrans->conflict == TRN_CONFLICT_TOPIC_INSIDE) { -// if (strcasecmp(pNew->dbname, pTrans->dbname) == 0 && strcasecmp(pNew->stbname, pTrans->stbname) == 0) -// conflict = true; -// } -// } if (pNew->conflict == TRN_CONFLICT_ARBGROUP) { if (pTrans->conflict == TRN_CONFLICT_GLOBAL) conflict = true; if (pTrans->conflict == TRN_CONFLICT_ARBGROUP) { @@ -963,8 +949,10 @@ int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans) { pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact); if (pIter == NULL) break; - if (pTrans->conflict == TRN_CONFLICT_GLOBAL || pTrans->conflict == TRN_CONFLICT_DB || - pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { + if (pTrans->conflict == TRN_CONFLICT_GLOBAL) { + thisConflict = true; + } + if (pTrans->conflict == TRN_CONFLICT_DB || pTrans->conflict == TRN_CONFLICT_DB_INSIDE) { if (strcasecmp(pTrans->dbname, pCompact->dbname) == 0) thisConflict = true; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 913e6e3295..01dedd4762 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -3193,6 +3193,7 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro mInfo("trans:%d, used to split vgroup, vgId:%d", pTrans->id, pVgroup->vgId); mndTransSetDbName(pTrans, pDb->name, NULL); + TAOS_CHECK_GOTO(mndTransCheckConflictWithCompact(pMnode, pTrans), NULL, _OVER); SVgObj newVg1 = {0}; memcpy(&newVg1, pVgroup, sizeof(SVgObj)); @@ -3441,6 +3442,8 @@ static int32_t mndBalanceVgroup(SMnode *pMnode, SRpcMsg *pReq, SArray *pArray) { } mndTransSetSerial(pTrans); mInfo("trans:%d, used to balance vgroup", pTrans->id); + TAOS_CHECK_GOTO(mndTransCheckConflict(pMnode, pTrans), NULL, _OVER); + TAOS_CHECK_GOTO(mndTransCheckConflictWithCompact(pMnode, pTrans), NULL, _OVER); while (1) { taosArraySort(pArray, (__compar_fn_t)mndCompareDnodeVnodes); diff --git a/tests/army/cluster/snapshot.py b/tests/army/cluster/snapshot.py index d18dbf2796..d14887db5c 100644 --- a/tests/army/cluster/snapshot.py +++ b/tests/army/cluster/snapshot.py @@ -97,6 +97,11 @@ class TDTestCase(TBase): self.alterReplica(1) self.checkAggCorrect() self.compactDb() + + if self.waitCompactsZero() is False: + tdLog.exit(f"compact not finished") + return False + self.alterReplica3() vgids = self.getVGroup(self.db) diff --git a/tests/army/frame/caseBase.py b/tests/army/frame/caseBase.py index 491e432df7..c2b3411e77 100644 --- a/tests/army/frame/caseBase.py +++ b/tests/army/frame/caseBase.py @@ -283,6 +283,18 @@ class TBase: time.sleep(interval) return False + def waitCompactsZero(self, seconds = 300, interval = 1): + # wait end + for i in range(seconds): + sql ="show compacts;" + rows = tdSql.query(sql) + if rows == 0: + tdLog.info("compacts count became zero.") + return True + #tdLog.info(f"i={i} wait ...") + time.sleep(interval) + + return False # check file exist def checkFileExist(self, pathFile): diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index b7298d359b..ab00179698 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -753,6 +753,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/compactDBConflict.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/varchar.py -Q 2 diff --git a/tests/system-test/2-query/sml_TS-3724.py b/tests/system-test/2-query/sml_TS-3724.py index b537ad9b9a..9511ee8aa1 100644 --- a/tests/system-test/2-query/sml_TS-3724.py +++ b/tests/system-test/2-query/sml_TS-3724.py @@ -14,7 +14,7 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: - updatecfgDict = {'clientCfg': {'smlChildTableName': 'dataModelName', 'fqdn': 'localhost', 'smlTsDefaultName': "times"}, 'fqdn': 'localhost'} + updatecfgDict = {'clientCfg': {'smlChildTableName': 'dataModelName', 'fqdn': 'localhost'}, 'fqdn': 'localhost'} print("===================: ", updatecfgDict) def init(self, conn, logSql, replicaVar=1): @@ -58,7 +58,7 @@ class TDTestCase: tdSql.query(f"select distinct tbname from {dbname}.readings") tdSql.checkRows(4) - tdSql.query(f"select * from {dbname}.t_0799064f5487946e5d22164a822acfc8 order by times") + tdSql.query(f"select * from {dbname}.t_0799064f5487946e5d22164a822acfc8 order by _ts") tdSql.checkRows(2) tdSql.checkData(0, 3, "kk") tdSql.checkData(1, 3, "") @@ -67,7 +67,7 @@ class TDTestCase: tdSql.query(f"select distinct tbname from {dbname}.`sys_if_bytes_out`") tdSql.checkRows(2) - tdSql.query(f"select * from {dbname}.t_f67972b49aa8adf8bca5d0d54f0d850d order by times") + tdSql.query(f"select * from {dbname}.t_f67972b49aa8adf8bca5d0d54f0d850d order by _ts") tdSql.checkRows(2) tdSql.checkData(0, 1, 1.300000000) tdSql.checkData(1, 1, 13.000000000) @@ -80,7 +80,7 @@ class TDTestCase: tdSql.query(f"select distinct tbname from {dbname}.`sys_cpu_nice`") tdSql.checkRows(3) - tdSql.query(f"select * from {dbname}.`sys_cpu_nice` order by times") + tdSql.query(f"select * from {dbname}.`sys_cpu_nice` order by _ts") tdSql.checkRows(4) tdSql.checkData(0, 1, 13.000000000) tdSql.checkData(0, 2, "web01") diff --git a/tests/system-test/6-cluster/compactDBConflict.py b/tests/system-test/6-cluster/compactDBConflict.py new file mode 100644 index 0000000000..54d1513ad0 --- /dev/null +++ b/tests/system-test/6-cluster/compactDBConflict.py @@ -0,0 +1,204 @@ +################################################################### +# 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 -*- +from util.log import * +from util.cases import * +from util.dnodes import * +from util.sql import * +from util.common import tdCom +import threading + + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + tdLog.debug(f"start to init {__file__}") + self.replicaVar = int(replicaVar) + tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def run(self): + tdLog.debug(f"start to excute {__file__}") + + tdSql.execute('CREATE DATABASE db vgroups 4 replica 1;') + + tdSql.execute('use db;') + + tdLog.debug("start test1") + event = threading.Event() + newTdSql=tdCom.newTdSql() + t0 = threading.Thread(target=self.compactDBThread, args=('', event, newTdSql)) + t0.start() + tdLog.info("t0 threading started,wait compact db tran start") + event.wait() + tdSql.error('ALTER DATABASE db REPLICA 3;', expectErrInfo="Transaction not completed due to conflict with compact") + tdLog.info("wait compact db finish") + t0.join() + + tdLog.debug("start test2") + event1 = threading.Event() + newTdSql1=tdCom.newTdSql() + t1 = threading.Thread(target=self.compactDBThread, args=('', event1, newTdSql1)) + t1.start() + tdLog.info("t1 threading started,wait compact db tran start") + event1.wait() + tdSql.error('REDISTRIBUTE VGROUP 5 DNODE 1;', expectErrInfo="Transaction not completed due to conflict with compact") + tdLog.info("wait compact db finish") + t1.join() + + tdLog.debug("start test3") + event2 = threading.Event() + newTdSql2=tdCom.newTdSql() + t2 = threading.Thread(target=self.compactDBThread, args=('', event2, newTdSql2)) + t2.start() + tdLog.info("t2 threading started,wait compact db tran start") + event2.wait() + rowLen = tdSql.query('show vgroups') + if rowLen > 0: + vgroupId = tdSql.getData(0, 0) + tdLog.info(f"split Vgroup vgroupId:{vgroupId} start") + tdSql.error(f"split vgroup {vgroupId}", expectErrInfo="Transaction not completed due to conflict with compact") + else: + tdLog.exit("get vgroupId fail!") + tdLog.info("wait compact db finish") + t2.join() + + tdLog.debug("start test4") + event3 = threading.Event() + newTdSql3=tdCom.newTdSql() + t3 = threading.Thread(target=self.compactDBThread, args=('', event3, newTdSql3)) + t3.start() + tdLog.info("t3 threading started!!!!!") + event3.wait() + tdSql.error('BALANCE VGROUP;', expectErrInfo="Transaction not completed due to conflict with compact") + t3.join() + + tdLog.debug("start test5") + newTdSql4=tdCom.newTdSql() + t4 = threading.Thread(target=self.splitVgroupThread, args=('', newTdSql4)) + t4.start() + tdLog.info("t4 threading started!!!!!") + time.sleep(1) + tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") + t4.join() + + tdLog.debug("start test6") + newTdSql5=tdCom.newTdSql() + t5 = threading.Thread(target=self.RedistributeVGroups, args=('', newTdSql5)) + t5.start() + tdLog.info("t5 threading started!!!!!") + time.sleep(1) + tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") + t5.join() + + tdLog.debug("start test7") + newTdSql6=tdCom.newTdSql() + t6 = threading.Thread(target=self.balanceVGROUPThread, args=('', newTdSql6)) + t6.start() + tdLog.info("t6 threading started!!!!!") + time.sleep(1) + tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") + t6.join() + + tdLog.debug("start test8") + newTdSql7=tdCom.newTdSql() + t7 = threading.Thread(target=self.alterDBThread, args=('', newTdSql7)) + t7.start() + tdLog.info("t7 threading started!!!!!") + time.sleep(1) + tdSql.error('compact database db;', expectErrInfo="Conflict transaction not completed") + t7.join() + + + def compactDBThread(self, p, event, newtdSql): + tdLog.info("compact db start") + newtdSql.execute('compact DATABASE db') + event.set() + if self.waitCompactsZero(atdSql=newtdSql) is False: + tdLog.info(f"compact not finished") + + def alterDBThread(self, p, newtdSql): + tdLog.info("alter db start") + newtdSql.execute('ALTER DATABASE db REPLICA 3') + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.info(f"transaction not finished") + + def balanceVGROUPThread(self, p, newtdSql): + tdLog.info("balance VGROUP start") + newtdSql.execute('BALANCE VGROUP') + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.info(f"transaction not finished") + + def RedistributeVGroups(self, p, newtdSql): + tdLog.info("REDISTRIBUTE VGROUP start") + sql = f"REDISTRIBUTE VGROUP 5 DNODE 1" + newtdSql.execute(sql, show=True) + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.exit(f"{sql} transaction not finished") + return False + + sql = f"REDISTRIBUTE VGROUP 4 DNODE 1" + newtdSql.execute(sql, show=True) + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.exit(f"{sql} transaction not finished") + return False + + sql = f"REDISTRIBUTE VGROUP 3 DNODE 1" + newtdSql.execute(sql, show=True) + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.exit(f"{sql} transaction not finished") + return False + + return True + + def splitVgroupThread(self, p, newtdSql): + newtdSql.execute(f"use db;") + rowLen = newtdSql.query('show vgroups') + if rowLen > 0: + vgroupId = newtdSql.getData(0, 0) + tdLog.info(f"splitVgroupThread vgroupId:{vgroupId} start") + newtdSql.execute(f"split vgroup {vgroupId}") + else: + tdLog.exit("get vgroupId fail!") + if self.waitTransactionZero(atdSql=newtdSql) is False: + tdLog.info(f"transaction not finished") + + def waitTransactionZero(self, atdSql, seconds = 300, interval = 1): + # wait end + for i in range(seconds): + sql ="show transactions;" + rows = atdSql.query(sql) + if rows == 0: + tdLog.info("transaction count became zero.") + return True + #tdLog.info(f"i={i} wait ...") + time.sleep(interval) + + return False + def waitCompactsZero(self, atdSql, seconds = 300, interval = 1): + # wait end + for i in range(seconds): + sql ="show compacts;" + rows = atdSql.query(sql) + if rows == 0: + tdLog.info("compacts count became zero.") + return True + #tdLog.info(f"i={i} wait ...") + time.sleep(interval) + + return False + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index a8d4fafb03..bf04352232 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -2253,6 +2253,83 @@ int sml_ts5528_test(){ return 0; } +int sml_td33048_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists td33048"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists td33048"); + taos_free_result(pRes); + + // check column name duplication + const char *sql[] = { + "alarm_record,tag=alarm_record uid=\"3+8001+c939604c\",deviceId=\"3\",alarmId=\"8001\",alarmStatus=\"false\",lotNo=\"2411A0302\",subMode=\"11\",occurTime=\"2024-11-25 09:31:52.702\" 1732527117484", + }; + pRes = taos_query(taos, "use td33048"); + taos_free_result(pRes); + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == 0); + taos_free_result(pRes); + + // check tag name duplication + const char *sql1[] = { + "alarm_record,tag=alarm_record uid=\"2+100012+303fe9b5\",deviceId=\"2\",alarmId=\"100012\",alarmStatus=\"false\",lotNo=\"2411A0202\",subMode=\"11\",occurTime=\"2024-11-25 09:31:55.591\" 1732527119493", + }; + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from alarm_record"); + code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == 0); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + +int sml_td17324_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "drop database if exists gcbacaefqk"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create database if not exists gcbacaefqk PRECISION 'ns'"); + taos_free_result(pRes); + + pRes = taos_query(taos, "use gcbacaefqk"); + taos_free_result(pRes); + + pRes = taos_query(taos, "create stable gcbacaefqk.test_stb(_ts timestamp, f int) tags(t1 bigint)"); + taos_free_result(pRes); + // check column name duplication + const char *sql[] = { + "st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1732700000364000000", + "st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin\",c2=true,c4=5f64,c5=5f64 1732700000361000000", + "test_stb,t2=5f64,t3=L\"ste\" c1=true,c2=4i64,c3=\"iam\" 1732700000364316532" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + int code = taos_errno(pRes); + printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes)); + ASSERT(code == 0); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + int main(int argc, char *argv[]) { if (argc == 2) { taos_options(TSDB_OPTION_CONFIGDIR, argv[1]); @@ -2262,6 +2339,10 @@ int main(int argc, char *argv[]) { ASSERT(!ret); ret = sml_ts5528_test(); ASSERT(!ret); + ret = sml_td33048_Test(); + ASSERT(!ret); + ret = sml_td17324_Test(); + ASSERT(!ret); ret = sml_td29691_Test(); ASSERT(ret); ret = sml_td29373_Test();