diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index f550bbd000bc894a20b00a4d6195059a478c3da3..eaf9c21bfbf667e8e16f16857afb118f87fada8a 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -279,7 +279,8 @@ static void tscProcessCurrentUser(SSqlObj *pSql) { pExpr->resType = TSDB_DATA_TYPE_BINARY; char* vx = calloc(1, pExpr->resBytes); - STR_WITH_MAXSIZE_TO_VARSTR(vx, pSql->pTscObj->user, sizeof(pSql->pTscObj->user)); + size_t size = sizeof(pSql->pTscObj->user); + STR_WITH_MAXSIZE_TO_VARSTR(vx, pSql->pTscObj->user, size); tscSetLocalQueryResult(pSql, vx, pExpr->aliasName, pExpr->resType, pExpr->resBytes); free(vx); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index ce174c2473938f35a86a35965d9b1b627aad8101..09a3f6767b2fdd6a48be26db428d396984d13661 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1708,8 +1708,9 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) { for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, i); - tstrncpy(pMsg, pTableMetaInfo->name, sizeof(pTableMetaInfo->name)); - pMsg += sizeof(pTableMetaInfo->name); + size_t size = sizeof(pTableMetaInfo->name); + tstrncpy(pMsg, pTableMetaInfo->name, size); + pMsg += size; } pCmd->msgType = TSDB_MSG_TYPE_CM_STABLE_VGROUP; diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 39144c3083803b99997d19cf63b389f5f1c21aa5..53d821b3d827f13de280092470ad70d1d2513897 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -53,6 +53,7 @@ extern int64_t tsMsPerDay[3]; extern char tsFirst[]; extern char tsSecond[]; +extern char tsLocalFqdn[]; extern char tsLocalEp[]; extern uint16_t tsServerPort; extern uint16_t tsDnodeShellPort; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 0cd0e48fbf50dc290e5ce3209e551ff10930274f..86fc6deb1b59802ebd699a5ae6ac68e1492cc54f 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -65,6 +65,7 @@ int64_t tsMsPerDay[] = {86400000L, 86400000000L, 86400000000000L}; char tsFirst[TSDB_EP_LEN] = {0}; char tsSecond[TSDB_EP_LEN] = {0}; char tsArbitrator[TSDB_EP_LEN] = {0}; +char tsLocalFqdn[TSDB_FQDN_LEN] = {0}; char tsLocalEp[TSDB_EP_LEN] = {0}; // Local End Point, hostname:port uint16_t tsServerPort = 6030; uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035] @@ -305,6 +306,16 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "fqdn"; + cfg.ptr = tsLocalFqdn; + cfg.valType = TAOS_CFG_VTYPE_STRING; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 0; + cfg.maxValue = 0; + cfg.ptrLength = TSDB_FQDN_LEN; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + // port cfg.option = "serverPort"; cfg.ptr = &tsServerPort; @@ -1251,9 +1262,14 @@ bool taosCheckGlobalCfg() { taosSetAllDebugFlag(); } - taosGetFqdn(tsLocalEp); - sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort); - uPrint("localEp is %s", tsLocalEp); + if (tsLocalFqdn[0] == 0) { + taosGetFqdn(tsLocalFqdn); + } + + strcpy(tsLocalEp, tsLocalFqdn); + + snprintf(tsLocalEp + strlen(tsLocalEp), sizeof(tsLocalEp), ":%d", tsServerPort); + uPrint("localEp is: %s", tsLocalEp); if (tsFirst[0] == 0) { strcpy(tsFirst, tsLocalEp); diff --git a/src/inc/trpc.h b/src/inc/trpc.h index 3be304e29b1b147b75230a58177df26fd7bc8c97..748fad0e6292464929421fb941ab1a83f5f3e763 100644 --- a/src/inc/trpc.h +++ b/src/inc/trpc.h @@ -83,7 +83,7 @@ void rpcSendResponse(const SRpcMsg *pMsg); void rpcSendRedirectRsp(void *pConn, const SRpcIpSet *pIpSet); int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo); void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pReq, SRpcMsg *pRsp); -void rpcReportProgress(void *pConn, char *pCont, int contLen); +int rpcReportProgress(void *pConn, char *pCont, int contLen); #ifdef __cplusplus } diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c index 5b637d03bd48bc99e80208899b43f92c2bc1d8d2..4720fb0ddca703e936cacc4bbfab647ed812e31c 100644 --- a/src/mnode/src/mnodeProfile.c +++ b/src/mnode/src/mnodeProfile.c @@ -235,12 +235,14 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, sizeof(pConnObj->user)); + size_t size = sizeof(pConnObj->user); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, sizeof(ipStr)); + size = sizeof(ipStr); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -358,12 +360,14 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, sizeof(pConnObj->user)); + size_t size = sizeof(pConnObj->user); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, sizeof(ipStr)); + size = sizeof(ipStr); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -479,12 +483,14 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, sizeof(pConnObj->user)); + size_t size = sizeof(pConnObj->user); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, sizeof(ipStr)); + size = sizeof(ipStr); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index a13c6ca129c3c8b2bf58b73958d925657f655cbd..659ac159a8fee323e2a1677c9032598ecadd2331 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -451,7 +451,7 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) { pthread_mutex_unlock(&pTable->mutex); - sdbTrace("table:%s, insert record:%s to hash, rowSize:%d vnumOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName, + sdbTrace("table:%s, insert record:%s to hash, rowSize:%d numOfRows:%" PRId64 " version:%" PRIu64, pTable->tableName, sdbGetKeyStrFromObj(pTable, pOper->pObj), pOper->rowSize, pTable->numOfRows, sdbGetVersion()); (*pTable->insertFp)(pOper); @@ -475,7 +475,7 @@ static int32_t sdbDeleteHash(SSdbTable *pTable, SSdbOper *pOper) { pTable->numOfRows--; pthread_mutex_unlock(&pTable->mutex); - sdbTrace("table:%s, delete record:%s from hash, numOfRows:%d" PRId64 "version:%" PRIu64, pTable->tableName, + sdbTrace("table:%s, delete record:%s from hash, numOfRows:%" PRId64 "version:%" PRIu64, pTable->tableName, sdbGetKeyStrFromObj(pTable, pOper->pObj), pTable->numOfRows, sdbGetVersion()); int8_t *updateEnd = pOper->pObj + pTable->refCountPos - 1; diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 89ac4b6cc4e6aa0da55994737e3a4be3d3ec6206..478e7790fba3405139d94548b219d2e2e857e12e 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -1004,7 +1004,7 @@ static int32_t mnodeAddSuperTableColumn(SDbObj *pDb, SSuperTableObj *pStable, SS sizeof(SSchema) * pStable->numOfTags); memcpy(pStable->schema + pStable->numOfColumns, schema, sizeof(SSchema) * ncols); - SSchema *tschema = (SSchema *) (pStable->schema + sizeof(SSchema) * pStable->numOfColumns); + SSchema *tschema = (SSchema *) (pStable->schema + pStable->numOfColumns); for (int32_t i = 0; i < ncols; i++) { tschema[i].colId = pStable->nextColId++; } @@ -1770,7 +1770,8 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) { return TSDB_CODE_MND_OUT_OF_MEMORY; } - tstrncpy(pCreateMsg->tableId, pInfo->tableId, sizeof(pInfo->tableId)); + size_t size = sizeof(pInfo->tableId); + tstrncpy(pCreateMsg->tableId, pInfo->tableId, size); tstrncpy(pCreateMsg->db, pMsg->pDb->name, sizeof(pCreateMsg->db)); pCreateMsg->igExists = 1; pCreateMsg->getMeta = 1; diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c index ee79d962bad8fd86483518af6fec2dba3532d479..95457c83a0c81871955df2ac0b729171dcc5a2ae 100644 --- a/src/mnode/src/mnodeUser.c +++ b/src/mnode/src/mnodeUser.c @@ -315,7 +315,8 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, sizeof(pUser->user)); + size_t size = sizeof(pUser->user); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, size); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/plugins/http/src/httpAuth.c b/src/plugins/http/src/httpAuth.c index 61ca5b4cc9f37a3801e5bac77f64ce29feb06168..cf2ce5ddd9274e8a7d1908f6c410c7ef629055b8 100644 --- a/src/plugins/http/src/httpAuth.c +++ b/src/plugins/http/src/httpAuth.c @@ -101,8 +101,10 @@ bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int len) { bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int maxLen) { char buffer[sizeof(pContext->user) + sizeof(pContext->pass)] = {0}; - tstrncpy(buffer, pContext->user, sizeof(pContext->user)); - tstrncpy(buffer + sizeof(pContext->user), pContext->pass, sizeof(pContext->pass)); + size_t size = sizeof(pContext->user); + tstrncpy(buffer, pContext->user, size); + size = sizeof(pContext->pass); + tstrncpy(buffer + sizeof(pContext->user), pContext->pass, size); char *encrypt = taosDesEncode(KEY_DES_4, buffer, TSDB_USER_LEN + TSDB_PASSWORD_LEN); char *base64 = base64_encode((const unsigned char *)encrypt, TSDB_USER_LEN + TSDB_PASSWORD_LEN); diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 7627a06c994d155309be6dfd7d2e6e919acc7664..cf15cc690ab52b9fb538fd4809b26774aed06e75 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -486,12 +486,19 @@ void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pMsg, SRpcMsg } // this API is used by server app to keep an APP context in case connection is broken -void rpcReportProgress(void *handle, char *pCont, int contLen) { +int rpcReportProgress(void *handle, char *pCont, int contLen) { SRpcConn *pConn = (SRpcConn *)handle; - // pReqMsg and reqMsgLen is re-used to store the context from app server - pConn->pReqMsg = pCont; - pConn->reqMsgLen = contLen; + if (pConn->user[0]) { + // pReqMsg and reqMsgLen is re-used to store the context from app server + pConn->pReqMsg = pCont; + pConn->reqMsgLen = contLen; + return 0; + } + + tTrace("%s, rpc connection is already released", pConn->info); + rpcFreeCont(pCont); + return -1; } static void rpcFreeMsg(void *msg) { diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 67ba891f93237399b11ce53b8e9ea6ae06cfa582..0882ee983dfb6aca7831600e870885e0061ca75d 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -321,6 +321,22 @@ void vnodeRelease(void *pVnodeRaw) { return; } + if (pVnode->tsdb) + tsdbCloseRepo(pVnode->tsdb, 1); + pVnode->tsdb = NULL; + + if (pVnode->wal) + walClose(pVnode->wal); + pVnode->wal = NULL; + + if (pVnode->wqueue) + dnodeFreeVnodeWqueue(pVnode->wqueue); + pVnode->wqueue = NULL; + + if (pVnode->rqueue) + dnodeFreeVnodeRqueue(pVnode->rqueue); + pVnode->rqueue = NULL; + tfree(pVnode->rootDir); if (pVnode->status == TAOS_VN_STATUS_DELETING) { @@ -411,33 +427,21 @@ void vnodeBuildStatusMsg(void *param) { } static void vnodeCleanUp(SVnodeObj *pVnode) { + // remove from hash, so new messages wont be consumed taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); + // stop replication module if (pVnode->sync) { syncStop(pVnode->sync); pVnode->sync = NULL; } - if (pVnode->tsdb) - tsdbCloseRepo(pVnode->tsdb, 1); - pVnode->tsdb = NULL; - - if (pVnode->wal) - walClose(pVnode->wal); - pVnode->wal = NULL; - + // stop continuous query if (pVnode->cq) cqClose(pVnode->cq); pVnode->cq = NULL; - if (pVnode->wqueue) - dnodeFreeVnodeWqueue(pVnode->wqueue); - pVnode->wqueue = NULL; - - if (pVnode->rqueue) - dnodeFreeVnodeRqueue(pVnode->rqueue); - pVnode->rqueue = NULL; - + // release local resources only after cutting off outside connections vnodeRelease(pVnode); } diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index a157100236238e1d11ad83146930ad328a1a9f9b..7dec2c961e4d957d4adf2200cddb5974aea1214e 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -134,6 +134,9 @@ python3 ./test.py -f query/filter.py python3 ./test.py -f query/filterCombo.py python3 ./test.py -f query/queryNormal.py python3 ./test.py -f query/queryError.py +python3 ./test.py -f query/filterAllIntTypes.py +python3 ./test.py -f query/filterFloatAndDouble.py +python3 ./test.py -f query/filterOtherTypes.py #stream python3 ./test.py -f stream/stream1.py diff --git a/tests/pytest/query/filterAllIntTypes.py b/tests/pytest/query/filterAllIntTypes.py new file mode 100644 index 0000000000000000000000000000000000000000..32e635d6da6e430da219722df81f3ad0ac09e9b8 --- /dev/null +++ b/tests/pytest/query/filterAllIntTypes.py @@ -0,0 +1,117 @@ +################################################################### +# 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 * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.powers = [7, 15, 31, 63] + self.types = ["tinyint", "smallint", "int", "bigint"] + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + for i in range(len(self.powers)): + curType = self.types[i] + print("======= Verify filter for %s type =========" % (curType)) + tdLog.debug( + "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) + tdSql.execute( + "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) + + #create 10 tables, insert 10 rows for each table + for j in range(self.rowNum): + tdSql.execute("create table st%s%d using st%s tags(%d)" % (curType, j + 1, curType, j + 1)) + for k in range(self.rowNum): + tdSql.execute("insert into st%s%d values(%d, %d)" % (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) + + tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 11, pow(2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) + tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 13, pow(-2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) + + # > for int type on column + tdSql.query("select * from st%s where num > 50" % curType) + tdSql.checkRows(51) + + # >= for int type on column + tdSql.query("select * from st%s where num >= 50" % curType) + tdSql.checkRows(52) + + # = for int type on column + tdSql.query("select * from st%s where num = 50" % curType) + tdSql.checkRows(1) + + # < for int type on column + tdSql.query("select * from st%s where num < 50" % curType) + tdSql.checkRows(50) + + # <= for int type on column + tdSql.query("select * from st%s where num <= 50" % curType) + tdSql.checkRows(51) + + # <> for int type on column + tdSql.query("select * from st%s where num <> 50" % curType) + tdSql.checkRows(101) + + # != for int type on column + tdSql.query("select * from st%s where num != 50" % curType) + tdSql.checkRows(101) + + # > for int type on tag + tdSql.query("select * from st%s where id > 5" % curType) + tdSql.checkRows(52) + + # >= for int type on tag + tdSql.query("select * from st%s where id >= 5" % curType) + tdSql.checkRows(62) + + # = for int type on tag + tdSql.query("select * from st%s where id = 5" % curType) + tdSql.checkRows(10) + + # < for int type on tag + tdSql.query("select * from st%s where id < 5" % curType) + tdSql.checkRows(40) + + # <= for int type on tag + tdSql.query("select * from st%s where id <= 5" % curType) + tdSql.checkRows(50) + + # <> for int type on tag + tdSql.query("select * from st%s where id <> 5" % curType) + tdSql.checkRows(92) + + # != for int type on tag + tdSql.query("select * from st%s where id != 5" % curType) + tdSql.checkRows(92) + + print("======= Verify filter for %s type finished =========" % curType) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/filterFloatAndDouble.py b/tests/pytest/query/filterFloatAndDouble.py new file mode 100644 index 0000000000000000000000000000000000000000..bea41be11c4ca35051fbb62c8387241b05e48742 --- /dev/null +++ b/tests/pytest/query/filterFloatAndDouble.py @@ -0,0 +1,160 @@ +################################################################### +# 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 * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + print("======= Verify filter for float and double type =========") + tdLog.debug( + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + tdSql.execute( + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + + for j in range(self.rowNum): + tdSql.execute( + "insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % (self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) + + # > for float type on column + tdSql.query("select * from st where num > 5.5") + tdSql.checkRows(5) + + # >= for float type on column + tdSql.query("select * from st where num >= 5.5") + tdSql.checkRows(6) + + # = for float type on column + tdSql.query("select * from st where num = 5.5") + tdSql.checkRows(1) + + # <> for float type on column + tdSql.query("select * from st where num <> 5.5") + tdSql.checkRows(9) + + # != for float type on column + tdSql.query("select * from st where num != 5.5") + tdSql.checkRows(9) + + # <= for float type on column + tdSql.query("select * from st where num <= 5.5") + tdSql.checkRows(5) + + # < for float type on column + tdSql.query("select * from st where num < 5.5") + tdSql.checkRows(4) + + # > for float type on tag + tdSql.query("select * from st where tagcol1 > 1.1") + tdSql.checkRows(0) + + # >= for float type on tag + tdSql.query("select * from st where tagcol1 >= 1.1") + tdSql.checkRows(10) + + # = for float type on tag + tdSql.query("select * from st where tagcol1 = 1.1") + tdSql.checkRows(10) + + # <> for float type on tag + tdSql.query("select * from st where tagcol1 <> 1.1") + tdSql.checkRows(0) + + # != for float type on tag + tdSql.query("select * from st where tagcol1 != 1.1") + tdSql.checkRows(0) + + # <= for float type on tag + tdSql.query("select * from st where tagcol1 <= 1.1") + tdSql.checkRows(10) + + # < for float type on tag + tdSql.query("select * from st where tagcol1 < 1.1") + tdSql.checkRows(0) + + # > for double type on column + tdSql.query("select * from st where speed > 11.5") + tdSql.checkRows(5) + + # >= for double type on column + tdSql.query("select * from st where speed >= 11.5") + tdSql.checkRows(6) + + # = for double type on column + tdSql.query("select * from st where speed = 11.5") + tdSql.checkRows(1) + + # <> for double type on column + tdSql.query("select * from st where speed <> 11.5") + tdSql.checkRows(9) + + # != for double type on column + tdSql.query("select * from st where speed != 11.5") + tdSql.checkRows(9) + + # <= for double type on column + tdSql.query("select * from st where speed <= 11.5") + tdSql.checkRows(5) + + # < for double type on column + tdSql.query("select * from st where speed < 11.5") + tdSql.checkRows(4) + + # > for double type on tag + tdSql.query("select * from st where tagcol2 > 2.3") + tdSql.checkRows(0) + + # >= for double type on tag + tdSql.query("select * from st where tagcol2 >= 2.3") + tdSql.checkRows(10) + + # = for double type on tag + tdSql.query("select * from st where tagcol2 = 2.3") + tdSql.checkRows(10) + + # <> for double type on tag + tdSql.query("select * from st where tagcol2 <> 2.3") + tdSql.checkRows(0) + + # != for double type on tag + tdSql.query("select * from st where tagcol2 != 2.3") + tdSql.checkRows(0) + + # <= for double type on tag + tdSql.query("select * from st where tagcol2 <= 2.3") + tdSql.checkRows(10) + + # < for double type on tag + tdSql.query("select * from st where tagcol2 < 2.3") + tdSql.checkRows(0) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/filterOtherTypes.py b/tests/pytest/query/filterOtherTypes.py new file mode 100644 index 0000000000000000000000000000000000000000..f09ac596c7156b468e425d071c2c8ba024115f34 --- /dev/null +++ b/tests/pytest/query/filterOtherTypes.py @@ -0,0 +1,362 @@ +################################################################### +# 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 * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.ts = 1537146000000 + + def run(self): + tdSql.prepare() + + print("======= Verify filter for bool, nchar and binary type =========") + tdLog.debug( + "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + tdSql.execute( + "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + + tdSql.execute("create table st1 using st tags(true, 'table1', '水表')") + for i in range(1, 6): + tdSql.execute("insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + + tdSql.execute("create table st2 using st tags(false, 'table2', '电表')") + for i in range(6, 11): + tdSql.execute("insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + + # =============Verify stable columns==================== + # > for bool type on column + tdSql.error("select * from st where tbcol1 > false") + + # >= for bool type on column + tdSql.error("select * from st where tbcol1 >= false") + + # = for bool type on column + tdSql.query("select * from st where tbcol1 = false") + tdSql.checkRows(5) + + # <> for bool type on column + tdSql.query("select * from st where tbcol1 <> true") + tdSql.checkRows(5) + + # != for bool type on column + tdSql.query("select * from st where tbcol1 != true") + tdSql.checkRows(5) + + # > for bool type on column + tdSql.error("select * from st where tbcol1 < true") + + # >= for bool type on column + tdSql.error("select * from st where tbcol1 <= true") + + # % for bool type on column + tdSql.error("select * from st where tbcol1 like '%'") + + # _ for bool type on column + tdSql.error("select * from st where tbcol1 like '____'") + + # > for nchar type on column + tdSql.error("select * from st where tbcol2 > 'taosdata'") + + # >= for nchar type on column + tdSql.error("select * from st where tbcol2 >= 'taosdata'") + + # = for nchar type on column + tdSql.query("select * from st where tbcol2 = 'taosdata1'") + tdSql.checkRows(1) + + # <> for nchar type on column + tdSql.query("select * from st where tbcol2 <> 'taosdata1'") + tdSql.checkRows(9) + + # != for nchar type on column + tdSql.query("select * from st where tbcol2 != 'taosdata1'") + tdSql.checkRows(9) + + # > for nchar type on column + tdSql.error("select * from st where tbcol2 < 'taodata'") + + # >= for nchar type on column + tdSql.error("select * from st where tbcol2 <= 'taodata'") + + # % for nchar type on column case 1 + tdSql.query("select * from st where tbcol2 like '%'") + tdSql.checkRows(10) + + # % for nchar type on column case 2 + tdSql.query("select * from st where tbcol2 like 'a%'") + tdSql.checkRows(0) + + # % for nchar type on column case 3 + tdSql.query("select * from st where tbcol2 like 't%_'") + tdSql.checkRows(10) + + # % for nchar type on column case 4 + tdSql.query("select * from st where tbcol2 like '%1'") + # tdSql.checkRows(2) + + # _ for nchar type on column case 1 + tdSql.query("select * from st where tbcol2 like '____________'") + tdSql.checkRows(0) + + # _ for nchar type on column case 2 + tdSql.query("select * from st where tbcol2 like '__________'") + tdSql.checkRows(1) + + # _ for nchar type on column case 3 + tdSql.query("select * from st where tbcol2 like '_________'") + tdSql.checkRows(9) + + # _ for nchar type on column case 4 + tdSql.query("select * from st where tbcol2 like 't________'") + tdSql.checkRows(9) + + # _ for nchar type on column case 5 + tdSql.query("select * from st where tbcol2 like '%________'") + tdSql.checkRows(10) + + # > for binary type on column + tdSql.error("select * from st where tbcol3 > '涛思数据'") + + # >= for binary type on column + tdSql.error("select * from st where tbcol3 >= '涛思数据'") + + # = for binary type on column + tdSql.query("select * from st where tbcol3 = '涛思数据1'") + tdSql.checkRows(1) + + # <> for binary type on column + tdSql.query("select * from st where tbcol3 <> '涛思数据1'") + tdSql.checkRows(9) + + # != for binary type on column + tdSql.query("select * from st where tbcol3 != '涛思数据1'") + tdSql.checkRows(9) + + # > for binary type on column + tdSql.error("select * from st where tbcol3 < '涛思数据'") + + # >= for binary type on column + tdSql.error("select * from st where tbcol3 <= '涛思数据'") + + # % for binary type on column case 1 + tdSql.query("select * from st where tbcol3 like '%'") + tdSql.checkRows(10) + + # % for binary type on column case 2 + tdSql.query("select * from st where tbcol3 like '陶%'") + tdSql.checkRows(0) + + # % for binary type on column case 3 + tdSql.query("select * from st where tbcol3 like '涛%_'") + tdSql.checkRows(10) + + # % for binary type on column case 4 + tdSql.query("select * from st where tbcol3 like '%1'") + tdSql.checkRows(1) + + # _ for binary type on column case 1 + tdSql.query("select * from st where tbcol3 like '_______'") + tdSql.checkRows(0) + + # _ for binary type on column case 2 + tdSql.query("select * from st where tbcol3 like '______'") + tdSql.checkRows(1) + + # _ for binary type on column case 2 + tdSql.query("select * from st where tbcol3 like '_____'") + tdSql.checkRows(9) + + # _ for binary type on column case 3 + tdSql.query("select * from st where tbcol3 like '____'") + tdSql.checkRows(0) + + # _ for binary type on column case 4 + tdSql.query("select * from st where tbcol3 like 't____'") + tdSql.checkRows(0) + + # =============Verify stable tags==================== + # > for bool type on tag + tdSql.error("select * from st where tagcol1 > false") + + # >= for bool type on tag + tdSql.error("select * from st where tagcol1 >= false") + + # = for bool type on tag + tdSql.query("select * from st where tagcol1 = false") + tdSql.checkRows(5) + + # <> for bool type on tag + tdSql.query("select * from st where tagcol1 <> true") + tdSql.checkRows(5) + + # != for bool type on tag + tdSql.query("select * from st where tagcol1 != true") + tdSql.checkRows(5) + + # > for bool type on tag + tdSql.error("select * from st where tagcol1 < true") + + # >= for bool type on tag + tdSql.error("select * from st where tagcol1 <= true") + + # % for bool type on tag + tdSql.error("select * from st where tagcol1 like '%'") + + # _ for bool type on tag + tdSql.error("select * from st where tagcol1 like '____'") + + # > for nchar type on tag + tdSql.error("select * from st where tagcol2 > 'table'") + + # >= for nchar type on tag + tdSql.error("select * from st where tagcol2 >= 'table'") + + # = for nchar type on tag + tdSql.query("select * from st where tagcol2 = 'table1'") + tdSql.checkRows(5) + + # <> for nchar type on tag + tdSql.query("select * from st where tagcol2 <> 'table1'") + tdSql.checkRows(5) + + # != for nchar type on tag + tdSql.query("select * from st where tagcol2 != 'table'") + tdSql.checkRows(10) + + # > for nchar type on tag + tdSql.error("select * from st where tagcol2 < 'table'") + + # >= for nchar type on tag + tdSql.error("select * from st where tagcol2 <= 'table'") + + # % for nchar type on tag case 1 + tdSql.query("select * from st where tagcol2 like '%'") + tdSql.checkRows(10) + + # % for nchar type on tag case 2 + tdSql.query("select * from st where tagcol2 like 'a%'") + tdSql.checkRows(0) + + # % for nchar type on tag case 3 + tdSql.query("select * from st where tagcol2 like 't%_'") + tdSql.checkRows(10) + + # % for nchar type on tag case 4 + tdSql.query("select * from st where tagcol2 like '%1'") + tdSql.checkRows(5) + + # _ for nchar type on tag case 1 + tdSql.query("select * from st where tagcol2 like '_______'") + tdSql.checkRows(0) + + # _ for nchar type on tag case 2 + tdSql.query("select * from st where tagcol2 like '______'") + tdSql.checkRows(10) + + # _ for nchar type on tag case 3 + tdSql.query("select * from st where tagcol2 like 't_____'") + tdSql.checkRows(10) + + # _ for nchar type on tag case 4 + tdSql.query("select * from st where tagcol2 like 's________'") + tdSql.checkRows(0) + + # _ for nchar type on tag case 5 + tdSql.query("select * from st where tagcol2 like '%__'") + tdSql.checkRows(10) + + # > for binary type on tag + tdSql.error("select * from st where tagcol3 > '表'") + + # >= for binary type on tag + tdSql.error("select * from st where tagcol3 >= '表'") + + # = for binary type on tag + tdSql.query("select * from st where tagcol3 = '水表'") + tdSql.checkRows(5) + + # <> for binary type on tag + tdSql.query("select * from st where tagcol3 <> '水表'") + tdSql.checkRows(5) + + # != for binary type on tag + tdSql.query("select * from st where tagcol3 != '水表'") + tdSql.checkRows(5) + + # > for binary type on tag + tdSql.error("select * from st where tagcol3 < '水表'") + + # >= for binary type on tag + tdSql.error("select * from st where tagcol3 <= '水表'") + + # % for binary type on tag case 1 + tdSql.query("select * from st where tagcol3 like '%'") + tdSql.checkRows(10) + + # % for binary type on tag case 2 + tdSql.query("select * from st where tagcol3 like '水%'") + tdSql.checkRows(5) + + # % for binary type on tag case 3 + tdSql.query("select * from st where tagcol3 like '数%_'") + tdSql.checkRows(0) + + # % for binary type on tag case 4 + tdSql.query("select * from st where tagcol3 like '%表'") + tdSql.checkRows(10) + + # % for binary type on tag case 5 + tdSql.query("select * from st where tagcol3 like '%据'") + tdSql.checkRows(0) + + # _ for binary type on tag case 1 + tdSql.query("select * from st where tagcol3 like '__'") + tdSql.checkRows(10) + + # _ for binary type on tag case 2 + tdSql.query("select * from st where tagcol3 like '水_'") + tdSql.checkRows(5) + + # _ for binary type on tag case 2 + tdSql.query("select * from st where tagcol3 like '_表'") + tdSql.checkRows(10) + + # _ for binary type on tag case 3 + tdSql.query("select * from st where tagcol3 like '___'") + tdSql.checkRows(0) + + # _ for binary type on tag case 4 + tdSql.query("select * from st where tagcol3 like '数_'") + tdSql.checkRows(0) + + # _ for binary type on tag case 5 + tdSql.query("select * from st where tagcol3 like '_据'") + tdSql.checkRows(0) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) + diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index d75afca2df8aa9444be14b335037e13312a6fee6..743a837f5efb5235198ebd90223159aa42405013 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -131,6 +131,8 @@ python3 ./test.py -f user/pass_len.py #query python3 ./test.py -f query/filter.py +python3 ./test.py -f query/filterAllIntTypes.py +python3 ./test.py -f query/filterFloatAndDouble.py #stream diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim b/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim index 09654ca8a9e6fe3f126052c9ba51294b32d376ab..1652470346ec747cc325b7a3923e6afa344fdb53 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim @@ -51,7 +51,7 @@ system sh/exec.sh -n dnode2 -s start sql create dnode $hostname2 sleep 3000 -$totalTableNum = 10000 +$totalTableNum = 10 $sleepTimer = 10000 $db = db @@ -192,7 +192,7 @@ if $data00 != $totalRows then endi -print ============== step4: stop dnode2 for checking if sync success +print ============== step4: stop dnode2 for checking if sync ok system sh/exec.sh -n dnode2 -s stop sleep $sleepTimer diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim b/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim index 4f29989aff04b5684f7a66ca87f724e1599d9e32..b870d07c1d261af47207bcba21c7bdef33016bd7 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 1000 +$totalTableNum = 10 $sleepTimer = 10000 $db = db diff --git a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim b/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim index 04933ea6e992b05936830b594732c05d7c8eb021..1b0a184690f7bbcaf0a49b1473451dd90043981a 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim @@ -173,7 +173,7 @@ if $rows != 3 then return -1 endi -print ============== step5: remove dnode4 director, then recreate dnode4 into cluster, result should success +print ============== step5: remove dnode4 director, then recreate dnode4 into cluster, result should ok system sh/exec.sh -n dnode4 -s stop system rm -rf ../../../sim/dnode4 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim index c156d7d55cc84cb924d4e7939166f345a4a3e289..fda850d2c9941cd9c1baecd07c621b0e99d6f8d7 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim index be4c321c364028faf752b190cd39275d69820176..d556976a43790ec9ba12152c8da7685ee310980f 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 #sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db @@ -177,7 +177,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync success +print ============== step5: stop dnode2, and check if dnode3 sync ok system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim index 1345bac4f8b510932ea955362cb8367d0f8bb880..968a93156e67bb5e1b07fb22c4eb6cb9c83f4d56 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 #sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db @@ -105,7 +105,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync success +print ============== step5: stop dnode2, and check if dnode3 sync ok system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim index 46b4023aa2ebae2a70ce81465ba9c435e8d8556a..82f2aad07b79858379e4b3d9e8355b1ad693f1d1 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim index b6a2b7e1d5ff836d3a256d7722cb19d5697373a4..4e9afbf31ae32fe2dacb43a4d367a94212f711c3 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim @@ -55,7 +55,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db @@ -152,7 +152,7 @@ print ============== step4: restart dnode2, then create database with replica 2, system sh/exec.sh -n dnode2 -s start sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db1 diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim index bcbb7e81a58ca8cd3c883cd3678ea2d31034742b..26a6359a5c526a88ea8e84ae2cb6f1c43fefac41 100644 --- a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname2 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim b/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim index 54e5c6a81f5fde0e3ae1786b6d785589f6dea523..b883f077c2d1821a104efb579bdda866d7940b33 100644 --- a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim @@ -67,7 +67,7 @@ sql use $db # create table , insert data $stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t1 int) +sql create table $stb (ts timestamp, c1 int, c2 int) tags(t0 int, t1 int) $rowNum = 500 $tblNum = $totalTableNum $totalRows = 0 @@ -77,7 +77,7 @@ $tsEnd = 0 $i = 0 while $i < $tblNum $tb = tb . $i - sql create table $tb using $stb tags( $i ) + sql create table $tb using $stb tags( $i , $i ) $x = 0 while $x < $rowNum @@ -164,7 +164,7 @@ $totalRows = 0 $i = 0 while $i < $tblNum $tb = tb . $i - sql create table $tb using $stb tags( $i , $i ) + sql create table $tb using $stb tags( $i , $i , $i ) $x = 0 while $x < $rowNum diff --git a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim index e9b5e484eb0d4a5aaf9968c1d509dfa858f5f462..e7b2c70c782a6ffd260c5c4b12dfc94ba6331def 100644 --- a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname2 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $maxTables = $totalTableNum * 2 diff --git a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim b/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim index e2ffc2ab1d85451a94b617b4ca139113ed58f714..20c575d382e71a9340240ba2fc7a142ee8927b0f 100644 --- a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname2 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim index ba8b1cd3b52c102046f513c06de9f8b80d9ae0cf..9f72cde440ac53cc7e5c246905022c0f51e5ee7b 100644 --- a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname2 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db @@ -146,14 +146,14 @@ endi print ============== step4: drop some tables $i = 1 -$dropTblNum = 21 +$dropTblNum = 6 while $i < $dropTblNum $tb = tb . $i sql drop table if exists $tb $i = $i + 1 endw -$tblNum = $tblNum - 20 +$tblNum = $tblNum - 5 print ============== step5: restart dnode4, waiting dnode4 synced system sh/exec.sh -n dnode4 -s start diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim index c7f02fdc511e928ec56b93bb800e285c23526558..43f9dfff144d3622ff738db6c5bdb61215bee357 100644 --- a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim b/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim index 97a8a0d6e06e760ad3acb386589ceae91fa63e9b..e27bbafba7a6d6cc01f83f2a594f9f25b1f8a5d8 100644 --- a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim @@ -67,7 +67,7 @@ sql use $db # create table , insert data $stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t1 int) +sql create table $stb (ts timestamp, c1 int, c2 int) tags(t0 int, t1 int) $rowNum = 500 $tblNum = $totalTableNum $totalRows = 0 @@ -77,7 +77,7 @@ $tsEnd = 0 $i = 0 while $i < $tblNum $tb = tb . $i - sql create table $tb using $stb tags( $i ) + sql create table $tb using $stb tags( $i , $i ) $x = 0 while $x < $rowNum @@ -164,7 +164,7 @@ $totalRows = 0 $i = 0 while $i < $tblNum $tb = tb . $i - sql create table $tb using $stb tags( $i , $i ) + sql create table $tb using $stb tags( $i , $i , $i ) $x = 0 while $x < $rowNum diff --git a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim index 113d322d8556938555105f7adefe7adccd6e6fe3..1e47157975e5f9183787f7874f7461b6d7492598 100644 --- a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $maxTables = $totalTableNum * 2 diff --git a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim b/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim index 0c7211d9e57428f56c8cd36bc16cc8f85d58bd4a..c9fc91527d27a2e66d17b2d385b097b9f837b7de 100644 --- a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db diff --git a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim index 8e59acc23430104890560197770de6f3591dfeff..aecf41b892ea2eabd428a88b803d9a81c8be830c 100644 --- a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim @@ -56,7 +56,7 @@ sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 -$totalTableNum = 100 +$totalTableNum = 10 $sleepTimer = 3000 $db = db @@ -146,14 +146,14 @@ endi print ============== step4: drop some tables $i = 1 -$dropTblNum = 21 +$dropTblNum = 6 while $i < $dropTblNum $tb = tb . $i sql drop table if exists $tb $i = $i + 1 endw -$tblNum = $tblNum - 20 +$tblNum = $tblNum - 5 print ============== step5: restart dnode4, waiting dnode4 synced system sh/exec.sh -n dnode4 -s start