diff --git a/.travis.yml b/.travis.yml index 4ae38f5032..2c3fd31911 100644 --- a/.travis.yml +++ b/.travis.yml @@ -260,19 +260,75 @@ matrix: - cmake .. > /dev/null - make > /dev/null - # - os: osx - # language: c - # compiler: clang - # env: DESC="mac/clang build" - # git: - # - depth: 1 - # addons: - # homebrew: - # - cmake - # - # script: - # - cd ${TRAVIS_BUILD_DIR} - # - mkdir debug - # - cd debug - # - cmake .. > /dev/null - # - make > /dev/null + - os: linux + arch: arm64 + dist: bionic + language: c + compiler: clang + env: DESC="linux/clang build" + git: + - depth: 1 + + addons: + apt: + packages: + - build-essential + - cmake + + before_script: + - cd ${TRAVIS_BUILD_DIR} + - mkdir debug + - cd debug + + script: + - if [ "${TRAVIS_CPU_ARCH}" == "arm64" ]; then + cmake .. -DCPUTYPE=aarch64 > /dev/null; + else + cmake .. > /dev/null; + fi + - make > /dev/null + + - os: linux + arch: arm64 + dist: trusty + language: c + git: + - depth: 1 + + addons: + apt: + packages: + - build-essential + - cmake + env: + - DESC="trusty/gcc-4.8 build" + + before_script: + - cd ${TRAVIS_BUILD_DIR} + - mkdir debug + - cd debug + + script: + - if [ "${TRAVIS_CPU_ARCH}" == "arm64" ]; then + cmake .. -DCPUTYPE=aarch64 > /dev/null; + else + cmake .. > /dev/null; + fi + - make > /dev/null + +# - os: osx +# language: c +# compiler: clang +# env: DESC="mac/clang build" +# git: +# - depth: 1 +# addons: +# homebrew: +# - cmake +# +# script: +# - cd ${TRAVIS_BUILD_DIR} +# - mkdir debug +# - cd debug +# - cmake .. > /dev/null +# - make > /dev/null diff --git a/documentation/webdocs/markdowndocs/Super Table-ch.md b/documentation/webdocs/markdowndocs/Super Table-ch.md index 626f695c27..5f592ec339 100644 --- a/documentation/webdocs/markdowndocs/Super Table-ch.md +++ b/documentation/webdocs/markdowndocs/Super Table-ch.md @@ -53,7 +53,7 @@ STable从属于库,一个STable只属于一个库,但一个库可以有一 说明: - 1. TAGS列总长度不能超过64k bytes; + 1. TAGS列总长度不能超过16k bytes; 2. TAGS列的数据类型不能是timestamp; 3. TAGS列名不能与其他列名相同; 4. TAGS列名不能为预留关键字. diff --git a/documentation/webdocs/markdowndocs/Super Table.md b/documentation/webdocs/markdowndocs/Super Table.md index 6c80c2097c..2c1093a3fa 100644 --- a/documentation/webdocs/markdowndocs/Super Table.md +++ b/documentation/webdocs/markdowndocs/Super Table.md @@ -22,7 +22,7 @@ New keyword "tags" is introduced, where tag_name is the tag name, and tag_type i Note: -1. The bytes of all tags together shall be less than 64k +1. The bytes of all tags together shall be less than 16k 2. Tag's data type can not be time stamp 3. Tag name shall be different from the field name 4. Tag name shall not be the same as system keywords diff --git a/documentation/webdocs/markdowndocs/TAOS SQL-ch.md b/documentation/webdocs/markdowndocs/TAOS SQL-ch.md index 7fe396e9e5..0be39ab8e4 100644 --- a/documentation/webdocs/markdowndocs/TAOS SQL-ch.md +++ b/documentation/webdocs/markdowndocs/TAOS SQL-ch.md @@ -63,7 +63,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic | 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63用于NULL | | 4 | FLOAT | 4 | 浮点型,有效位数6-7,范围 [-3.4E38, 3.4E38] | | 5 | DOUBLE | 8 | 双精度浮点型,有效位数15-16,范围 [-1.7E308, 1.7E308] | -| 6 | BINARY | 自定义 | 用于记录字符串,理论上,最长可以有65526字节,但由于每行数据最多64K字节,实际上限一般小于理论值。 binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 | +| 6 | BINARY | 自定义 | 用于记录字符串,理论上,最长可以有16374字节,但由于每行数据最多16K字节,实际上限一般小于理论值。 binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 | | 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768用于NULL | | 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128用于NULL | | 9 | BOOL | 1 | 布尔型,{true, false} | @@ -106,7 +106,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic ```mysql CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]) ``` - 说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过64K字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。 + 说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过16K字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。 - **删除数据表** diff --git a/documentation/webdocs/markdowndocs/TAOS SQL.md b/documentation/webdocs/markdowndocs/TAOS SQL.md index 6c7f25b8f7..72e41dbec4 100644 --- a/documentation/webdocs/markdowndocs/TAOS SQL.md +++ b/documentation/webdocs/markdowndocs/TAOS SQL.md @@ -39,7 +39,7 @@ The full list of data types is listed below. For string types of data, we will | 6 | DOUBLE | 8 | A standard nullable double float type with 15-16 significant digits and a range of [-1.7E308, 1.7E308]​ | | 7 | BOOL | 1 | A nullable boolean type, [**`true`**, **`false`**] | | 8 | TIMESTAMP | 8 | A nullable timestamp type with the same usage as the primary column timestamp | -| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars, the maximum length of *M* is 65526, but as maximum row size is 64K bytes, the actual upper limit will generally less than 65526. This type of string only supports ASCii encoded chars. | +| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars, the maximum length of *M* is 16374, but as maximum row size is 16K bytes, the actual upper limit will generally less than 16374. This type of string only supports ASCii encoded chars. | | 10 | NCHAR(*M*) | 4 * *M* | A nullable string type whose length is *M*, error should be threw with exceeded chars. The **`NCHAR`** type supports Unicode encoded chars. | All the keywords in a SQL statement are case-insensitive, but strings values are case-sensitive and must be quoted by a pair of `'` or `"`. To quote a `'` or a `"` , you can use the escape character `\`. @@ -86,7 +86,7 @@ All the keywords in a SQL statement are case-insensitive, but strings values are 1) The first column must be a `timestamp`, and the system will set it as the primary key. - 2) The record size is limited to 64k bytes + 2) The record size is limited to 16k bytes 3) For `binary` or `nchar` data types, the length must be specified. For example, binary(20) means a binary data type with 20 bytes. diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 9007121af4..83700ce0a5 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -182,8 +182,12 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // type length int32_t bytes = pSchema[i].bytes; pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 2); - if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { - bytes = bytes / TSDB_NCHAR_SIZE; + if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { + bytes -= VARSTR_HEADER_SIZE; + + if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { + bytes = bytes / TSDB_NCHAR_SIZE; + } } *(int32_t *)(pRes->data + tscFieldInfoGetOffset(pQueryInfo, 2) * totalNumOfRows + pField->bytes * i) = bytes; diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 30fdd21b99..d971e3ad6d 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -407,11 +407,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId); } - SDMVgroupAccess *pVgAcccess = pStatusRsp->vgAccess; - for (int32_t i = 0; i < pCfg->numOfVnodes; ++i) { - pVgAcccess[i].vgId = htonl(pVgAcccess[i].vgId); - } - + vnodeSetAccess(pStatusRsp->vgAccess, pCfg->numOfVnodes); dnodeProcessModuleStatus(pCfg->moduleStatus); dnodeUpdateDnodeCfg(pCfg); diff --git a/src/inc/taos.h b/src/inc/taos.h index 9ac97a24e1..d524d95685 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -55,7 +55,7 @@ typedef enum { typedef struct taosField { char name[65]; uint8_t type; - uint16_t bytes; + int16_t bytes; } TAOS_FIELD; #ifdef _TD_GO_DLL_ diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index ba95598646..562b9be854 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -113,12 +113,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_QUERY_ID, 0, 0x030C, "mnode inva TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_ID, 0, 0x030D, "mnode invalid stream id") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CONN_ID, 0, 0x030E, "mnode invalid connection") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_ALREADY_THERE, 0, 0x0320, "[sdb] object already there") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_ERROR, 0, 0x0321, "[sdb] app error") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE, 0, 0x0322, "[sdb] invalid table type") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_NOT_THERE, 0, 0x0323, "[sdb] object not there") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_META_ROW, 0, 0x0324, "[sdb] invalid meta row") -TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_KEY_TYPE, 0, 0x0325, "[sdb] invalid key type") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_ALREADY_THERE, 0, 0x0320, "sdb object already there") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_ERROR, 0, 0x0321, "sdb app error") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVALID_TABLE_TYPE, 0, 0x0322, "sdb invalid table type") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_OBJ_NOT_THERE, 0, 0x0323, "sdb object not there") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_META_ROW, 0, 0x0324, "sdb invalid meta row") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_SDB_INVAID_KEY_TYPE, 0, 0x0325, "sdb invalid key type") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ALREADY_EXIST, 0, 0x0330, "mnode dnode already exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, 0, 0x0331, "mnode dnode not exist") @@ -179,6 +179,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "vnode no d TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "vnode no such file or directory") TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "vnode out of memory") TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "vnode app error") +TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, 0, 0x0214, "vnode no write auth") // tsdb TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, 0, 0x0600, "tsdb invalid table id") diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index fcb6d66422..78255a45d5 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -543,6 +543,7 @@ typedef struct { int32_t dnodeId; uint32_t moduleStatus; uint32_t numOfVnodes; + uint32_t reserved; } SDMDnodeCfg; typedef struct { diff --git a/src/inc/vnode.h b/src/inc/vnode.h index 0da1f51e27..9f0c8cc241 100644 --- a/src/inc/vnode.h +++ b/src/inc/vnode.h @@ -58,6 +58,7 @@ void* vnodeGetWal(void *pVnode); int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item); void vnodeBuildStatusMsg(void * param); +void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes); int32_t vnodeProcessRead(void *pVnode, SReadMsg *pReadMsg); diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 2baf28f88f..80a638a21e 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -122,7 +122,8 @@ typedef struct SVgObj { int32_t lbDnodeId; int32_t lbTime; int8_t inUse; - int8_t reserved[13]; + int8_t accessState; + int8_t reserved[12]; int8_t updateEnd[1]; int32_t refCount; struct SVgObj *prev, *next; diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h index d61145d9b8..29a0fe1799 100644 --- a/src/mnode/inc/mnodeVgroup.h +++ b/src/mnode/inc/mnodeVgroup.h @@ -34,7 +34,8 @@ void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb); void * mnodeGetNextVgroup(void *pIter, SVgObj **pVgroup); void mnodeUpdateVgroup(SVgObj *pVgroup); -void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *dnodeId, SVnodeLoad *pVload); +void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload); +void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t openVnodes); int32_t mnodeCreateVgroup(struct SMnodeMsg *pMsg, SDbObj *pDb); void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle); diff --git a/src/mnode/src/mnodeAcct.c b/src/mnode/src/mnodeAcct.c index 4c79564769..3fcb3849aa 100644 --- a/src/mnode/src/mnodeAcct.c +++ b/src/mnode/src/mnodeAcct.c @@ -39,6 +39,7 @@ static int32_t mnodeAcctActionDestroy(SSdbOper *pOper) { static int32_t mnodeAcctActionInsert(SSdbOper *pOper) { SAcctObj *pAcct = pOper->pObj; memset(&pAcct->acctInfo, 0, sizeof(SAcctInfo)); + pAcct->acctInfo.accessState = TSDB_VN_ALL_ACCCESS; pthread_mutex_init(&pAcct->mutex, NULL); return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 35f4ea43d3..21de887488 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -335,6 +335,19 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { } int32_t openVnodes = htons(pStatus->openVnodes); + int32_t contLen = sizeof(SDMStatusRsp) + openVnodes * sizeof(SDMVgroupAccess); + SDMStatusRsp *pRsp = rpcMallocCont(contLen); + if (pRsp == NULL) { + mnodeDecDnodeRef(pDnode); + return TSDB_CODE_MND_OUT_OF_MEMORY; + } + + pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); + pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt); + pRsp->dnodeCfg.numOfVnodes = htonl(openVnodes); + mnodeGetMnodeInfos(&pRsp->mnodes); + SDMVgroupAccess *pAccess = (SDMVgroupAccess *)((char *)pRsp + sizeof(SDMStatusRsp)); + for (int32_t j = 0; j < openVnodes; ++j) { SVnodeLoad *pVload = &pStatus->load[j]; pVload->vgId = htonl(pVload->vgId); @@ -347,6 +360,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { mnodeSendDropVnodeMsg(pVload->vgId, &ipSet, NULL); } else { mnodeUpdateVgroupStatus(pVgroup, pDnode, pVload); + pAccess->vgId = htonl(pVload->vgId); + pAccess->accessState = pVgroup->accessState; mnodeDecVgroupRef(pVgroup); } } @@ -366,26 +381,13 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { balanceNotify(); } - mnodeDecDnodeRef(pDnode); - - int32_t contLen = sizeof(SDMStatusRsp) + TSDB_MAX_VNODES * sizeof(SDMVgroupAccess); - SDMStatusRsp *pRsp = rpcMallocCont(contLen); - if (pRsp == NULL) { - return TSDB_CODE_MND_OUT_OF_MEMORY; + if (openVnodes != pDnode->openVnodes) { + mnodeCheckUnCreatedVgroup(pDnode, pStatus->load, openVnodes); } pDnode->lastAccess = tsAccessSquence; + mnodeDecDnodeRef(pDnode); - mnodeGetMnodeInfos(&pRsp->mnodes); - - pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); - pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt); - pRsp->dnodeCfg.numOfVnodes = 0; - - contLen = sizeof(SDMStatusRsp); - - //TODO: set vnode access - pMsg->rpcRsp.len = contLen; pMsg->rpcRsp.rsp = pRsp; diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 10dfb2a28a..ff09af7611 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -74,6 +74,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) { pVgroup->pDb = pDb; pVgroup->prev = NULL; pVgroup->next = NULL; + pVgroup->accessState = TSDB_VN_ALL_ACCCESS; int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables; pVgroup->tableList = calloc(pDb->cfg.maxTables, sizeof(SChildTableObj *)); @@ -255,6 +256,8 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) { mnodeSendCreateVgroupMsg(pVgroup, NULL); } +void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t openVnodes) {} + void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload) { bool dnodeExist = false; for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { @@ -324,6 +327,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) { strcpy(pVgroup->dbName, pDb->name); pVgroup->numOfVnodes = pDb->cfg.replications; pVgroup->createdTime = taosGetTimestampMs(); + pVgroup->accessState = TSDB_VN_ALL_ACCCESS; if (balanceAllocVnodes(pVgroup) != 0) { mError("db:%s, no enough dnode to alloc %d vnodes to vgroup", pDb->name, pVgroup->numOfVnodes); free(pVgroup); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index eb62d6c61a..0a25ae3397 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -4259,7 +4259,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { while (pQInfo->groupIndex < numOfGroups) { SArray* group = taosArrayGetP(pQInfo->groupInfo.pGroupList, pQInfo->groupIndex); - qTrace("QInfo:%p last_row query on group:%d, total group:%d, current group:%d", pQInfo, pQInfo->groupIndex, + qTrace("QInfo:%p last_row query on group:%d, total group:%u, current group:%p", pQInfo, pQInfo->groupIndex, numOfGroups, group); STsdbQueryCond cond = { @@ -4510,7 +4510,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { } qTrace( - "QInfo %p numOfTables:%d, index:%d, numOfGroups:%d, %d points returned, total:%"PRId64", offset:%" PRId64, + "QInfo %p numOfTables:%"PRIu64", index:%d, numOfGroups:%d, %"PRId64" points returned, total:%"PRId64", offset:%" PRId64, pQInfo, pQInfo->groupInfo.numOfTables, pQInfo->tableIndex, numOfGroups, pQuery->rec.rows, pQuery->rec.total, pQuery->limit.offset); } @@ -4597,7 +4597,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyFromWindowResToSData(pQInfo, pRuntimeEnv->windowResInfo.pResult); } - qTrace("QInfo:%p current:%lld, total:%lld", pQInfo, pQuery->rec.rows, pQuery->rec.total); + qTrace("QInfo:%p current:%"PRId64", total:%"PRId64"", pQInfo, pQuery->rec.rows, pQuery->rec.total); return; } @@ -4869,13 +4869,13 @@ static void tableQueryImpl(SQInfo *pQInfo) { clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex); if (pQuery->rec.rows > 0) { - qTrace("QInfo:%p %d rows returned from group results, total:%d", pQInfo, pQuery->rec.rows, pQuery->rec.total); + qTrace("QInfo:%p %"PRId64" rows returned from group results, total:%"PRId64"", pQInfo, pQuery->rec.rows, pQuery->rec.total); return; } } } - qTrace("QInfo:%p query over, %d rows are returned", pQInfo, pQuery->rec.total); + qTrace("QInfo:%p query over, %"PRId64" rows are returned", pQInfo, pQuery->rec.total); return; } @@ -4931,7 +4931,7 @@ static void stableQueryImpl(SQInfo *pQInfo) { pQInfo->runtimeEnv.summary.elapsedTime += (taosGetTimestampUs() - st); if (pQuery->rec.rows == 0) { - qTrace("QInfo:%p over, %d tables queried, %d rows are returned", pQInfo, pQInfo->groupInfo.numOfTables, pQuery->rec.total); + qTrace("QInfo:%p over, %d tables queried, %"PRId64" rows are returned", pQInfo, pQInfo->groupInfo.numOfTables, pQuery->rec.total); } } @@ -6041,7 +6041,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo) { } sem_wait(&pQInfo->dataReady); - qTrace("QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, + qTrace("QInfo:%p retrieve result info, rowsize:%d, rows:%"PRId64", code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, pQInfo->code); return pQInfo->code; diff --git a/src/query/src/qast.c b/src/query/src/qast.c index 8d2202563d..36a91ee545 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -577,8 +577,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr assert(0); } } else { - int32_t optr = cond.end->optr; - + int32_t optr = cond.end ? cond.end->optr : TSDB_RELATION_INVALID; if (optr == TSDB_RELATION_LESS || optr == TSDB_RELATION_LESS_EQUAL) { bool comp = true; int32_t ret = 0; diff --git a/src/query/src/qpercentile.c b/src/query/src/qpercentile.c index 367028928b..577fddb808 100644 --- a/src/query/src/qpercentile.c +++ b/src/query/src/qpercentile.c @@ -283,7 +283,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE break; }; default: { - uError("MemBucket:%p,not support data type %d,failed", *pBucket, pBucket->dataType); + uError("MemBucket:%p,not support data type %d,failed", pBucket, pBucket->dataType); tfree(pBucket); return NULL; } diff --git a/src/query/src/qtokenizer.c b/src/query/src/qtokenizer.c index e6340cc678..aa9f6fddca 100644 --- a/src/query/src/qtokenizer.c +++ b/src/query/src/qtokenizer.c @@ -655,4 +655,4 @@ SSQLToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr, uint32_t numOfIgn return t0; } -bool isKeyWord(const char* z, int32_t len) { return (tSQLKeywordCode((char*)z, len) != TK_ID); } \ No newline at end of file +bool isKeyWord(const char* z, int32_t len) { return (tSQLKeywordCode((char*)z, len) != TK_ID); } diff --git a/src/util/inc/tstoken.h b/src/util/inc/tstoken.h index 60a79f69af..74687e9c18 100644 --- a/src/util/inc/tstoken.h +++ b/src/util/inc/tstoken.h @@ -120,6 +120,7 @@ static FORCE_INLINE int32_t isValidNumber(const SSQLToken* pToken) { type = TK_FLOAT; goto _end; + break; } case '0': { diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index b99e722262..19225e998a 100755 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -95,9 +95,6 @@ void* taosArrayGetP(const SArray* pArray, size_t index) { assert(index < pArray->size); void* d = TARRAY_GET_ELEM(pArray, index); - if (d == NULL) { - return NULL; - } return *(void**)d; } diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 2b6083a91c..7aaa5b91db 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -119,7 +119,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo int32_t size = pNode->size; taosHashRemove(pCacheObj->pHashTable, pNode->key, pNode->keySize); - uTrace("key:%s is removed from cache,total:%d,size:%ldbytes", pNode->key, pCacheObj->totalSize, size); + uTrace("key:%s is removed from cache,total:%" PRId64 ",size:%dbytes", pNode->key, pCacheObj->totalSize, size); if (pCacheObj->freeFp) pCacheObj->freeFp(pNode->data); free(pNode); } @@ -288,7 +288,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const char *key, const void *pData, siz if (NULL != pNode) { pCacheObj->totalSize += pNode->size; - uTrace("key:%s %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 ", total:%d, size:%" PRId64 " bytes", + uTrace("key:%s %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 ", total:%" PRId64 ", size:%" PRId64 " bytes", key, pNode, pNode->addedTime, pNode->expiredTime, pCacheObj->totalSize, dataSize); } else { uError("key:%s failed to added into cache, out of memory", key); @@ -433,7 +433,6 @@ void taosCacheEmpty(SCacheObj *pCacheObj) { __cache_wr_lock(pCacheObj); while (taosHashIterNext(pIter)) { if (pCacheObj->deleting == 1) { - taosHashDestroyIter(pIter); break; } @@ -507,7 +506,7 @@ void taosAddToTrash(SCacheObj *pCacheObj, SCacheDataNode *pNode) { void taosRemoveFromTrashCan(SCacheObj *pCacheObj, STrashElem *pElem) { if (pElem->pData->signature != (uint64_t)pElem->pData) { - uError("key:sig:%d %p data has been released, ignore", pElem->pData->signature, pElem->pData); + uError("key:sig:0x%x %p data has been released, ignore", pElem->pData->signature, pElem->pData); return; } @@ -561,7 +560,6 @@ void taosTrashCanEmpty(SCacheObj *pCacheObj, bool force) { } } - assert(pCacheObj->numOfElemsInTrash >= 0); __cache_unlock(pCacheObj); } diff --git a/src/util/src/tcompression.c b/src/util/src/tcompression.c index e3b3d65052..b085e26e07 100644 --- a/src/util/src/tcompression.c +++ b/src/util/src/tcompression.c @@ -551,7 +551,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char delta_of_delta = 0; } else { if (is_bigendian()) { - memcpy(&dd1 + LONG_BYTES - nbytes, input + ipos, nbytes); + memcpy(((char *)(&dd1)) + LONG_BYTES - nbytes, input + ipos, nbytes); } else { memcpy(&dd1, input + ipos, nbytes); } @@ -576,7 +576,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char delta_of_delta = 0; } else { if (is_bigendian()) { - memcpy(&dd2 + LONG_BYTES - nbytes, input + ipos, nbytes); + memcpy(((char *)(&dd2)) + LONG_BYTES - nbytes, input + ipos, nbytes); } else { memcpy(&dd2, input + ipos, nbytes); } diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index 543a84dc44..2288035fc7 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -74,7 +74,7 @@ static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) { *option = value; cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE; } else { - uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value, + uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value, tsCfgStatusStr[cfg->cfgStatus], *option); } } @@ -106,7 +106,11 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) { } else { if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) { wordexp_t full_path; - wordexp(input_value, &full_path, 0); + if (0 != wordexp(input_value, &full_path, 0)) { + printf("\nconfig dir: %s wordexp fail! reason:%s\n", input_value, strerror(errno)); + wordfree(&full_path); + return; + } if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) { strcpy(option, full_path.we_wordv[0]); } @@ -240,7 +244,12 @@ void taosReadGlobalLogCfg() { sdbDebugFlag = 135; wordexp_t full_path; - wordexp(configDir, &full_path, 0); + if ( 0 != wordexp(configDir, &full_path, 0)) { + printf("\nconfig file: %s wordexp fail! reason:%s\n", configDir, strerror(errno)); + wordfree(&full_path); + return; + } + if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) { if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) { printf("\nconfig file: %s path overflow max len %d, all variables are set to default\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1); diff --git a/src/util/src/tcrc32c.c b/src/util/src/tcrc32c.c index 546693c4bb..3ef10b1b0d 100644 --- a/src/util/src/tcrc32c.c +++ b/src/util/src/tcrc32c.c @@ -736,7 +736,7 @@ static uint32_t table[16][256] = { 0x9c221d09, 0x6e2e10f7, 0x7dd67004, 0x8fda7dfa} }; - +#ifndef _TD_ARM_ static uint32_t long_shifts[4][256] = { {0x00000000, 0xe040e0ac, 0xc56db7a9, 0x252d5705, 0x8f3719a3, 0x6f77f90f, 0x4a5aae0a, 0xaa1a4ea6, 0x1b8245b7, 0xfbc2a51b, 0xdeeff21e, 0x3eaf12b2, @@ -1090,7 +1090,7 @@ static uint32_t short_shifts[4][256] = { 0x3c3f083d, 0x1984fde6, 0x7748e38b, 0x52f31650, 0xaad0df51, 0x8f6b2a8a, 0xe1a734e7, 0xc41cc13c, 0x140cd014, 0x31b725cf, 0x5f7b3ba2, 0x7ac0ce79, 0x82e30778, 0xa758f2a3, 0xc994ecce, 0xec2f1915}}; - +#endif #if 0 static uint32_t append_trivial(uint32_t crc, crc_stream input, size_t length) { for (size_t i = 0; i < length; ++i) { @@ -1187,13 +1187,13 @@ uint32_t crc32c_sf(uint32_t crci, crc_stream input, size_t length) { } return (uint32_t)crc ^ 0xffffffff; } - +#ifndef _TD_ARM_ /* Apply the zeros operator table to crc. */ static uint32_t shift_crc(uint32_t shift_table[][256], uint32_t crc) { return shift_table[0][crc & 0xff] ^ shift_table[1][(crc >> 8) & 0xff] ^ shift_table[2][(crc >> 16) & 0xff] ^ shift_table[3][crc >> 24]; } - +#endif /* Compute a CRC-32C. If the crc32 instruction is available, use the hardware version. Otherwise, use the software version. */ uint32_t (*crc32c)(uint32_t crci, crc_stream bytes, size_t len) = crc32c_sf; diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index 88cd446349..cf5228c072 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -537,5 +537,6 @@ static int tdRestoreKVStore(SKVStore *pStore) { _err: tfree(buf); + taosHashDestroyIter(pIter); return -1; } \ No newline at end of file diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c index 01a0eabbca..d1fb287184 100644 --- a/src/util/src/tlog.c +++ b/src/util/src/tlog.c @@ -142,6 +142,10 @@ static void *taosThreadToOpenNewFile(void *param) { umask(0); int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO); + if (fd < 0) { + uError("open new log file fail! fd:%d reason:%s", fd, strerror(errno)); + return NULL; + } taosLockFile(fd); lseek(fd, 0, SEEK_SET); @@ -184,7 +188,7 @@ void taosResetLog() { tsLogObj.lines = tsLogObj.maxLines + 10; taosOpenNewLogFile(); - remove(lastName); + (void)remove(lastName); uPrint("=================================="); uPrint(" reset log file "); @@ -279,7 +283,10 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { // only an estimate for number of lines struct stat filestat; - fstat(tsLogObj.logHandle->fd, &filestat); + if (fstat(tsLogObj.logHandle->fd, &filestat) < 0) { + printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno)); + return -1; + } size = (int32_t)filestat.st_size; tsLogObj.lines = size / 60; diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c index 31ed6e2f7b..5bb120d4c6 100644 --- a/src/util/src/tnote.c +++ b/src/util/src/tnote.c @@ -214,7 +214,10 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf // only an estimate for number of lines struct stat filestat; - fstat(pNote->taosNoteFd, &filestat); + if (fstat(pNote->taosNoteFd, &filestat) < 0) { + fprintf(stderr, "failed to fstat note file:%s reason:%s\n", name, strerror(errno)); + return -1; + } size = (int)filestat.st_size; pNote->taosNoteLines = size / 60; @@ -226,7 +229,7 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...) { va_list argpointer; - char buffer[MAX_NOTE_LINE_SIZE]; + char buffer[MAX_NOTE_LINE_SIZE+2]; int len; struct tm Tm, *ptm; struct timeval timeSecs; diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c index 1f4d57115b..98ed8d1ed7 100644 --- a/src/util/src/tsocket.c +++ b/src/util/src/tsocket.c @@ -278,7 +278,7 @@ int taosOpenUdpSocket(uint32_t ip, uint16_t port) { /* bind socket to local address */ if (bind(sockFd, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) { uError("failed to bind udp socket: %d (%s), 0x%x:%hu", errno, strerror(errno), ip, port); - taosCloseSocket(sockFd); + close(sockFd); return -1; } @@ -321,7 +321,7 @@ int taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clientI if (ret != 0) { //uError("failed to connect socket, ip:0x%x, port:%hu(%s)", destIp, destPort, strerror(errno)); - taosCloseSocket(sockFd); + close(sockFd); sockFd = -1; } diff --git a/src/util/src/ttime.c b/src/util/src/ttime.c index 4dd6360752..02d72dd1f4 100644 --- a/src/util/src/ttime.c +++ b/src/util/src/ttime.c @@ -72,49 +72,6 @@ void deltaToUtcInitOnce() { return; } -int64_t user_mktime(struct tm * tm) -{ -#define TAOS_MINUTE 60 -#define TAOS_HOUR (60*TAOS_MINUTE) -#define TAOS_DAY (24*TAOS_HOUR) -#define TAOS_YEAR (365*TAOS_DAY) - -static int month[12] = { - 0, - TAOS_DAY*(31), - TAOS_DAY*(31+29), - TAOS_DAY*(31+29+31), - TAOS_DAY*(31+29+31+30), - TAOS_DAY*(31+29+31+30+31), - TAOS_DAY*(31+29+31+30+31+30), - TAOS_DAY*(31+29+31+30+31+30+31), - TAOS_DAY*(31+29+31+30+31+30+31+31), - TAOS_DAY*(31+29+31+30+31+30+31+31+30), - TAOS_DAY*(31+29+31+30+31+30+31+31+30+31), - TAOS_DAY*(31+29+31+30+31+30+31+31+30+31+30) -}; - - int64_t res; - int year; - - year= tm->tm_year - 70; - res= TAOS_YEAR*year + TAOS_DAY*((year+1)/4); - res+= month[tm->tm_mon]; - - if(tm->tm_mon > 1 && ((year+2)%4)) { - res-= TAOS_DAY; - } - - res+= TAOS_DAY*(tm->tm_mday-1); - res+= TAOS_HOUR*tm->tm_hour; - res+= TAOS_MINUTE*tm->tm_min; - res+= tm->tm_sec; - - return res + m_deltaUtc; - -} - - static int64_t parseFraction(char* str, char** end, int32_t timePrec); static int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec); static int32_t parseLocaltime(char* timestr, int64_t* time, int32_t timePrec); diff --git a/src/util/src/ttimer.c b/src/util/src/ttimer.c index cdb2c6c0be..f7acc1132d 100644 --- a/src/util/src/ttimer.c +++ b/src/util/src/ttimer.c @@ -139,7 +139,7 @@ static void unlockTimerList(timer_list_t* list) { int64_t tid = taosGetPthreadId(); if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) { assert(false); - tmrError("%d trying to unlock a timer list not locked by current thread.", tid); + tmrError("%" PRId64 " trying to unlock a timer list not locked by current thread.", tid); } } @@ -290,6 +290,7 @@ static void addToExpired(tmr_obj_t* head) { SSchedMsg schedMsg; schedMsg.fp = NULL; schedMsg.tfp = processExpiredTimer; + schedMsg.msg = NULL; schedMsg.ahandle = head; schedMsg.thandle = NULL; taosScheduleTask(tmrQhandle, &schedMsg); @@ -513,14 +514,17 @@ static void taosTmrModuleInit(void) { tmrError("failed to create the mutex for wheel, reason:%s", strerror(errno)); return; } + pthread_mutex_lock(&wheel->mutex); wheel->nextScanAt = now + wheel->resolution; wheel->index = 0; wheel->slots = (tmr_obj_t**)calloc(wheel->size, sizeof(tmr_obj_t*)); if (wheel->slots == NULL) { tmrError("failed to allocate wheel slots"); + pthread_mutex_unlock(&wheel->mutex); return; } timerMap.size += wheel->size; + pthread_mutex_unlock(&wheel->mutex); } timerMap.count = 0; diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 9209117415..3b92cf21ee 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -557,7 +557,7 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) { return false; } - int versionNumberPos[4] = {0}; + int versionNumberPos[5] = {0}; int len = strlen(versionStr); int dot = 0; for (int pos = 0; pos < len && dot < 4; ++pos) { @@ -709,7 +709,7 @@ void taosRemoveDir(char *rootDir) { if (de->d_type & DT_DIR) { taosRemoveDir(filename); } else { - remove(filename); + (void)remove(filename); uPrint("file:%s is removed", filename); } } diff --git a/src/vnode/inc/vnodeInt.h b/src/vnode/inc/vnodeInt.h index ab74e329e6..d5a7dbfd2e 100644 --- a/src/vnode/inc/vnodeInt.h +++ b/src/vnode/inc/vnodeInt.h @@ -37,6 +37,7 @@ typedef struct { int32_t refCount; // reference count int status; int8_t role; + int8_t accessState; int64_t version; // current version int64_t fversion; // version on saved data file void *wqueue; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index bada60b19b..ff0b12d446 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -195,6 +195,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { pVnode->version = 0; pVnode->tsdbCfg.tsdbId = pVnode->vgId; pVnode->rootDir = strdup(rootDir); + pVnode->accessState = TSDB_VN_ALL_ACCCESS; int32_t code = vnodeReadCfg(pVnode); if (code != TSDB_CODE_SUCCESS) { @@ -431,6 +432,20 @@ void vnodeBuildStatusMsg(void *param) { taosHashDestroyIter(pIter); } +void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) { + for (int32_t i = 0; i < numOfVnodes; ++i) { + pAccess[i].vgId = htonl(pAccess[i].vgId); + SVnodeObj *pVnode = vnodeAccquireVnode(pAccess[i].vgId); + if (pVnode != NULL) { + pVnode->accessState = pAccess[i].accessState; + if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) { + vTrace("vgId:%d, access state is set to %d", pAccess[i].vgId) + } + vnodeRelease(pVnode); + } + } +} + static void vnodeCleanUp(SVnodeObj *pVnode) { // remove from hash, so new messages wont be consumed taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index fa322757e2..a6a43a81aa 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -53,6 +53,10 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL) return TSDB_CODE_VND_MSG_NOT_PROCESSED; + if (!(pVnode->accessState & TSDB_VN_WRITE_ACCCESS)) { + return TSDB_CODE_VND_NO_WRITE_AUTH; + } + if (pHead->version == 0) { // from client or CQ if (pVnode->status != TAOS_VN_STATUS_READY) return TSDB_CODE_VND_INVALID_VGROUP_ID; // it may be in deleting or closing state diff --git a/tests/pytest/insert/nchar-unicode.py b/tests/pytest/insert/nchar-unicode.py index 152a09723e..c417a6bca2 100644 --- a/tests/pytest/insert/nchar-unicode.py +++ b/tests/pytest/insert/nchar-unicode.py @@ -25,7 +25,6 @@ class TDTestCase: def run(self): tdSql.prepare() - tdSql.error('create table tb (ts timestamp, col nchar(1022))') tdSql.execute('create table tb (ts timestamp, col nchar(1021))') tdSql.execute("insert into tb values (now, 'taosdata')") tdSql.query("select * from tb") diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index 31ce70e90a..38cefb3eec 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -17,6 +17,7 @@ from util.log import * from util.cases import * from util.sql import * from util.dnodes import * +import codecs class Test: @@ -93,14 +94,13 @@ class Test: self.last_stb = current_stb current_tb = "tb%d" % int(round(time.time() * 1000)) - tdSql.execute( - "create table %s using %s tags (1, '表1')" % - (current_tb, self.last_stb)) + sqlcmd = "create table %s using %s tags (1, 'test')" %(current_tb, self.last_stb) + tdSql.execute(sqlcmd) self.last_tb = current_tb self.written = 0 tdSql.execute( - "insert into %s values (now, 27, '我是nchar字符串')" % + "insert into %s values (now, 27, 'wsnchar')" % self.last_tb) self.written = self.written + 1 diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 1fc3edf4a9..955d6aa2ef 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -13,7 +13,7 @@ python3 ./test.py -f insert/date.py python3 ./test.py -f insert/binary.py python3 ./test.py -f insert/nchar.py # python3 ./test.py -f insert/nchar-boundary.py -# python3 ./test.py -f insert/nchar-unicode.py +python3 ./test.py -f insert/nchar-unicode.py python3 ./test.py -f insert/multi.py python3 ./test.py -f insert/randomNullCommit.py diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index f3fd178088..3b86a53343 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -40,10 +40,18 @@ class TDSql: def prepare(self): tdLog.info("prepare database:db") - self.cursor.execute('reset query cache') - self.cursor.execute('drop database if exists db') - self.cursor.execute('create database db') - self.cursor.execute('use db') + s = 'reset query cache' + print(s) + self.cursor.execute(s) + s = 'drop database if exists db' + print(s) + self.cursor.execute(s) + s = 'create database db' + print(s) + self.cursor.execute(s) + s = 'use db' + print(s) + self.cursor.execute(s) def error(self, sql): expectErrNotOccured = True @@ -66,6 +74,7 @@ class TDSql: def query(self, sql): self.sql = sql + print(sql) self.cursor.execute(sql) self.queryResult = self.cursor.fetchall() self.queryRows = len(self.queryResult) @@ -182,6 +191,7 @@ class TDSql: def execute(self, sql): self.sql = sql + print(sql) self.affectedRows = self.cursor.execute(sql) return self.affectedRows diff --git a/tests/script/general/alter/cached_schema_after_alter.sim b/tests/script/general/alter/cached_schema_after_alter.sim index d06856d5ff..2d049ec595 100644 --- a/tests/script/general/alter/cached_schema_after_alter.sim +++ b/tests/script/general/alter/cached_schema_after_alter.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -56,11 +56,12 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 5000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed +sleep 5000 sql connect -sleep 3000 sql use $db sql select * from $stb +print select * from $stb ==> $data00 $data01 $data02 if $rows != 1 then return -1 endi @@ -72,6 +73,7 @@ if $data02 != 1 then endi sql select * from $tb2 +print select * from $tb2 ==> $data00 $data01 $data02 if $rows != 1 then return -1 endi diff --git a/tests/script/general/alter/count.sim b/tests/script/general/alter/count.sim index 4728433dd2..157b4c1371 100644 --- a/tests/script/general/alter/count.sim +++ b/tests/script/general/alter/count.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 - -system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 diff --git a/tests/script/general/alter/import.sim b/tests/script/general/alter/import.sim index 0ad52373fc..76388a26f2 100644 --- a/tests/script/general/alter/import.sim +++ b/tests/script/general/alter/import.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 - -system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 @@ -42,9 +41,9 @@ if $data00 != 5 then return -1 endi -sql_error import into tb values(now-29d, -29, 0) +sql import into tb values(now-29d, -29, 0) sql select count(b) from tb -if $data00 != 5 then +if $data00 != 6 then return -1 endi diff --git a/tests/script/general/alter/insert1.sim b/tests/script/general/alter/insert1.sim index 4246bdc18e..3b16214465 100644 --- a/tests/script/general/alter/insert1.sim +++ b/tests/script/general/alter/insert1.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -14,41 +13,42 @@ sql use d3 sql create table tb (ts timestamp, a int) sql insert into tb values(now-28d, -28) sql select * from tb order by ts desc +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 + if $rows != 1 then return -1 endi if $data01 != -28 then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi print ======== step2 -sleep 2500 sql alter table tb add column b smallint sql insert into tb values(now-25d, -25, 0) -sleep 3000 sql select * from tb order by ts desc -print $rows +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 if $rows != 2 then return -1 endi @@ -64,31 +64,32 @@ endi if $data12 != NULL then return -1 endi -if $data13 != NULL then +if $data13 != null then return -1 endi -if $data14 != NULL then +if $data14 != null then return -1 endi -if $data15 != NULL then +if $data15 != null then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi print ======== step3 -sleep 2500 sql alter table tb add column c tinyint sql insert into tb values(now-22d, -22, 3, 0) -sleep 3000 sql select * from tb order by ts asc +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 if $rows != 3 then then return -1 endi @@ -101,19 +102,19 @@ endi if $data03 != NULL then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -25 then @@ -125,19 +126,19 @@ endi if $data13 != NULL then return -1 endi -if $data14 != NULL then +if $data14 != null then return -1 endi -if $data15 != NULL then +if $data15 != null then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != -22 then @@ -149,27 +150,25 @@ endi if $data23 != 0 then return -1 endi -if $data24 != NULL then +if $data24 != null then return -1 endi -if $data25 != NULL then +if $data25 != null then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi print ======== step4 -sleep 2500 sql alter table tb add column d int sql insert into tb values(now-19d, -19, 6, 3, 0) -sleep 3000 sql select * from tb order by ts asc if $rows != 4 then then return -1 @@ -186,16 +185,16 @@ endi if $data04 != NULL then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -25 then @@ -210,16 +209,16 @@ endi if $data14 != NULL then return -1 endi -if $data15 != NULL then +if $data15 != null then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != -22 then @@ -234,16 +233,16 @@ endi if $data24 != NULL then return -1 endi -if $data25 != NULL then +if $data25 != null then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != -19 then @@ -258,24 +257,22 @@ endi if $data34 != 0 then return -1 endi -if $data35 != NULL then +if $data35 != null then return -1 endi -if $data36 != NULL then +if $data36 != null then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi print ======== step5 -sleep 2500 sql alter table tb add column e bigint sql insert into tb values(now-16d, -16, 9, 5, 4, 3) -sleep 3000 sql select count(e) from tb if $data00 != 1 then return -1 @@ -303,13 +300,13 @@ endi if $data05 != NULL then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -25 then @@ -327,13 +324,13 @@ endi if $data15 != NULL then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != -22 then @@ -351,13 +348,13 @@ endi if $data25 != NULL then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != -19 then @@ -375,13 +372,13 @@ endi if $data35 != NULL then return -1 endi -if $data36 != NULL then +if $data36 != null then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi if $data41 != -16 then @@ -399,21 +396,19 @@ endi if $data45 != 3 then return -1 endi -if $data46 != NULL then +if $data46 != null then return -1 endi -if $data47 != NULL then +if $data47 != null then return -1 endi -if $data48 != NULL then +if $data48 != null then return -1 endi print ======== step6 -sleep 2500 sql alter table tb add column f float sql insert into tb values(now-13d, -13, 12, 11, 10, 9, 8) -sleep 3000 sql select * from tb order by ts asc if $rows != 6 then then return -1 @@ -436,10 +431,10 @@ endi if $data06 != NULL then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -25 then @@ -460,10 +455,10 @@ endi if $data16 != NULL then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != -22 then @@ -484,10 +479,10 @@ endi if $data26 != NULL then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != -19 then @@ -508,10 +503,10 @@ endi if $data36 != NULL then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi if $data41 != -16 then @@ -532,10 +527,10 @@ endi if $data46 != NULL then return -1 endi -if $data47 != NULL then +if $data47 != null then return -1 endi -if $data48 != NULL then +if $data48 != null then return -1 endi if $data51 != -13 then @@ -556,18 +551,16 @@ endi if $data56 != 8.00000 then return -1 endi -if $data57 != NULL then +if $data57 != null then return -1 endi -if $data58 != NULL then +if $data58 != null then return -1 endi print ======== step7 -sleep 2500 sql alter table tb add column g double sql insert into tb values(now-10d, -10, 15, 14, 13, 12, 11, 10) -sleep 3000 sql select * from tb order by ts asc if $rows != 7 then return -1 @@ -593,7 +586,7 @@ endi if $data07 != NULL then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -25 then @@ -617,7 +610,7 @@ endi if $data17 != NULL then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != -22 then @@ -641,7 +634,7 @@ endi if $data27 != NULL then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != -19 then @@ -665,7 +658,7 @@ endi if $data37 != NULL then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi if $data41 != -16 then @@ -689,7 +682,7 @@ endi if $data47 != NULL then return -1 endi -if $data48 != NULL then +if $data48 != null then return -1 endi if $data51 != -13 then @@ -713,7 +706,7 @@ endi if $data57 != NULL then return -1 endi -if $data58 != NULL then +if $data58 != null then return -1 endi if $data61 != -10 then @@ -737,15 +730,13 @@ endi if $data67 != 10.000000000 then return -1 endi -if $data68 != NULL then +if $data68 != null then return -1 endi print ======== step8 -sleep 2500 sql alter table tb add column h binary(10) sql insert into tb values(now-7d, -7, 18, 17, 16, 15, 14, 13, '11') -sleep 3000 sql select * from tb order by ts asc if $rows != 8 then return -1 @@ -942,17 +933,18 @@ endi if $data78 != 11 then return -1 endi -if $data79 != NULL then +if $data79 != null then return -1 endi print ======== step9 + system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 5000 system sh/exec.sh -n dnode1 -s start sleep 5000 -sql select * from tb +sql select * from tb order by ts asc if $rows != 8 then return -1 endi @@ -1148,5 +1140,8 @@ endi if $data78 != 11 then return -1 endi +if $data79 != null then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/alter/insert2.sim b/tests/script/general/alter/insert2.sim index 007060b7f0..c3283c856b 100644 --- a/tests/script/general/alter/insert2.sim +++ b/tests/script/general/alter/insert2.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -43,12 +42,10 @@ if $data08 != 8 then endi print ======== step2 -sleep 2500 sql_error alter table tb add column b smallint sql_error alter table tb add column b int sql alter table tb drop column b sql insert into tb values(now-25d, 2, 3, 4, 5, 6, 7, 8) -sleep 3000 sql select * from tb order by ts desc if $rows != 2 then return -1 @@ -74,7 +71,7 @@ endi if $data07 != 8 then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != 1 then @@ -98,15 +95,13 @@ endi if $data17 != 8 then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi print ======== step3 -sleep 2500 sql alter table tb drop column c sql insert into tb values(now-22d, 3, 4, 5, 6, 7, 8) -sleep 3000 sql select * from tb order by ts desc if $rows != 3 then return -1 @@ -129,10 +124,10 @@ endi if $data06 != 8 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != 2 then @@ -153,10 +148,10 @@ endi if $data16 != 8 then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != 1 then @@ -177,10 +172,10 @@ endi if $data26 != 8 then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi @@ -206,16 +201,16 @@ endi if $data04 != 0 then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != 3 then @@ -230,16 +225,16 @@ endi if $data14 != 8 then return -1 endi -if $data15 != NULL then +if $data15 != null then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != 2 then @@ -254,16 +249,16 @@ endi if $data24 != 8 then return -1 endi -if $data25 != NULL then +if $data25 != null then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != 1 then @@ -278,16 +273,16 @@ endi if $data34 != 8 then return -1 endi -if $data35 != NULL then +if $data35 != null then return -1 endi -if $data36 != NULL then +if $data36 != null then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi @@ -313,19 +308,19 @@ endi if $data03 != 5 then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data11 != -19 then @@ -337,19 +332,19 @@ endi if $data13 != 0 then return -1 endi -if $data14 != NULL then +if $data14 != null then return -1 endi -if $data15 != NULL then +if $data15 != null then return -1 endi -if $data16 != NULL then +if $data16 != null then return -1 endi -if $data17 != NULL then +if $data17 != null then return -1 endi -if $data18 != NULL then +if $data18 != null then return -1 endi if $data21 != 3 then @@ -361,19 +356,19 @@ endi if $data23 != 8 then return -1 endi -if $data24 != NULL then +if $data24 != null then return -1 endi -if $data25 != NULL then +if $data25 != null then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != 2 then @@ -385,19 +380,19 @@ endi if $data33 != 8 then return -1 endi -if $data34 != NULL then +if $data34 != null then return -1 endi -if $data35 != NULL then +if $data35 != null then return -1 endi -if $data36 != NULL then +if $data36 != null then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi if $data41 != 1 then @@ -409,19 +404,19 @@ endi if $data43 != 8 then return -1 endi -if $data44 != NULL then +if $data44 != null then return -1 endi -if $data45 != NULL then +if $data45 != null then return -1 endi -if $data46 != NULL then +if $data46 != null then return -1 endi -if $data47 != NULL then +if $data47 != null then return -1 endi -if $data48 != NULL then +if $data48 != null then return -1 endi @@ -443,22 +438,22 @@ endi if $data12 != 5 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi -if $data08 != NULL then +if $data08 != null then return -1 endi if $data21 != -19 then @@ -467,22 +462,22 @@ endi if $data22 != 0 then return -1 endi -if $data23 != NULL then +if $data23 != null then return -1 endi -if $data24 != NULL then +if $data24 != null then return -1 endi -if $data25 != NULL then +if $data25 != null then return -1 endi -if $data26 != NULL then +if $data26 != null then return -1 endi -if $data27 != NULL then +if $data27 != null then return -1 endi -if $data28 != NULL then +if $data28 != null then return -1 endi if $data31 != 3 then @@ -491,22 +486,22 @@ endi if $data32 != 8 then return -1 endi -if $data33 != NULL then +if $data33 != null then return -1 endi -if $data34 != NULL then +if $data34 != null then return -1 endi -if $data35 != NULL then +if $data35 != null then return -1 endi -if $data36 != NULL then +if $data36 != null then return -1 endi -if $data37 != NULL then +if $data37 != null then return -1 endi -if $data38 != NULL then +if $data38 != null then return -1 endi if $data41 != 2 then @@ -515,22 +510,22 @@ endi if $data42 != 8 then return -1 endi -if $data43 != NULL then +if $data43 != null then return -1 endi -if $data44 != NULL then +if $data44 != null then return -1 endi -if $data45 != NULL then +if $data45 != null then return -1 endi -if $data46 != NULL then +if $data46 != null then return -1 endi -if $data47 != NULL then +if $data47 != null then return -1 endi -if $data48 != NULL then +if $data48 != null then return -1 endi if $data51 != 1 then @@ -539,19 +534,19 @@ endi if $data52 != 8 then return -1 endi -if $data53 != NULL then +if $data53 != null then return -1 endi -if $data54 != NULL then +if $data54 != null then return -1 endi -if $data55 != NULL then +if $data55 != null then return -1 endi -if $data57 != NULL then +if $data57 != null then return -1 endi -if $data58 != NULL then +if $data58 != null then return -1 endi @@ -568,52 +563,52 @@ print data01 = $data01 if $data01 != -10 then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi if $data11 != -13 then return -1 endi -if $data12 != NULL then +if $data12 != null then return -1 endi if $data21 != -16 then return -1 endi -if $data22 != NULL then +if $data22 != null then return -1 endi if $data31 != -19 then return -1 endi -if $data32 != NULL then +if $data32 != null then return -1 endi -if $data33 != NULL then +if $data33 != null then return -1 endi if $data41 != 3 then return -1 endi -if $data42 != NULL then +if $data42 != null then return -1 endi if $data51 != 2 then return -1 endi -if $data52 != NULL then +if $data52 != null then return -1 endi -if $data53 != NULL then +if $data53 != null then return -1 endi if $data61 != 1 then return -1 endi -if $data62 != NULL then +if $data62 != null then return -1 endi @@ -632,52 +627,52 @@ endi if $data01 != -10 then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi if $data11 != -13 then return -1 endi -if $data12 != NULL then +if $data12 != null then return -1 endi if $data21 != -16 then return -1 endi -if $data22 != NULL then +if $data22 != null then return -1 endi if $data31 != -19 then return -1 endi -if $data32 != NULL then +if $data32 != null then return -1 endi -if $data33 != NULL then +if $data33 != null then return -1 endi if $data41 != 3 then return -1 endi -if $data42 != NULL then +if $data42 != null then return -1 endi if $data51 != 2 then return -1 endi -if $data52 != NULL then +if $data52 != null then return -1 endi -if $data53 != NULL then +if $data53 != null then return -1 endi if $data61 != 1 then return -1 endi -if $data62 != NULL then +if $data62 != null then return -1 endi diff --git a/tests/script/general/alter/metrics.sim b/tests/script/general/alter/metrics.sim index a2c5b7b465..5ed8050b96 100644 --- a/tests/script/general/alter/metrics.sim +++ b/tests/script/general/alter/metrics.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -42,7 +41,6 @@ endi print ======== step2 sql alter table mt add column b smallint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -71,7 +69,6 @@ endi print ======== step3 sql alter table mt add column c tinyint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -106,7 +103,6 @@ endi print ======== step4 sql alter table mt add column d int -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -147,7 +143,6 @@ endi print ======== step5 sql alter table mt add column e bigint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -194,7 +189,6 @@ endi print ======== step6 sql alter table mt add column f float -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -247,7 +241,6 @@ endi print ======== step7 sql alter table mt add column g double -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -306,7 +299,6 @@ endi print ======== step8 sql alter table mt add column h binary(10) -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -468,7 +460,6 @@ print ======== step11 print ======== step12 sql alter table mt drop column b -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -530,7 +521,6 @@ endi print ======== step13 sql alter table mt drop column c -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -586,7 +576,6 @@ endi print ======== step14 sql alter table mt drop column d -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -636,7 +625,6 @@ endi print ======== step15 sql alter table mt drop column e -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -680,7 +668,6 @@ endi print ======== step16 sql alter table mt drop column f -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -718,7 +705,6 @@ endi print ======== step17 sql alter table mt drop column g -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -750,7 +736,6 @@ endi print ============= step18 sql alter table mt drop column h -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -770,7 +755,7 @@ endi if $data21 != INT then return -1 endi -if $data30 != NULL then +if $data30 != null then return -1 endi diff --git a/tests/script/general/alter/table.sim b/tests/script/general/alter/table.sim index 25d3b42066..5a72fc9256 100644 --- a/tests/script/general/alter/table.sim +++ b/tests/script/general/alter/table.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -35,7 +34,6 @@ endi print ======== step2 sql alter table tb add column b smallint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -58,7 +56,6 @@ endi print ======== step3 sql alter table tb add column c tinyint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -87,7 +84,6 @@ endi print ======== step4 sql alter table tb add column d int -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -122,7 +118,6 @@ endi print ======== step5 sql alter table tb add column e bigint -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -163,7 +158,6 @@ endi print ======== step6 sql alter table tb add column f float -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -210,7 +204,6 @@ endi print ======== step7 sql alter table tb add column g double -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -263,7 +256,6 @@ endi print ======== step8 sql alter table tb add column h binary(10) -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -413,7 +405,6 @@ step115: print ======== step12 sql alter table tb drop column b -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -469,7 +460,6 @@ endi print ======== step13 sql alter table tb drop column c -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -519,7 +509,6 @@ endi print ======== step14 sql alter table tb drop column d -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -563,7 +552,6 @@ endi print ======== step15 sql alter table tb drop column e -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -601,7 +589,6 @@ endi print ======== step16 sql alter table tb drop column f -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -633,7 +620,6 @@ endi print ======== step17 sql alter table tb drop column g -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -659,7 +645,6 @@ endi print ============= step18 sql alter table tb drop column h -sleep 2500 sql describe tb if $data00 != ts then return -1 @@ -673,7 +658,7 @@ endi if $data11 != INT then return -1 endi -if $data20 != NULL then +if $data20 != null then return -1 endi diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/general/parser/limit1_tblocks100.sim index 99ffd31f6d..29b48bdd43 100644 --- a/tests/script/general/parser/limit1_tblocks100.sim +++ b/tests/script/general/parser/limit1_tblocks100.sim @@ -68,4 +68,4 @@ print ================== server restart completed run general/parser/limit1_tb.sim run general/parser/limit1_stb.sim -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/tag/add.sim b/tests/script/general/tag/add.sim index 69fd909dcf..301ec4f825 100644 --- a/tests/script/general/tag/add.sim +++ b/tests/script/general/tag/add.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -138,16 +137,17 @@ if $data03 != 2.00000 then endi sql describe $tb +print sql describe $tb if $data21 != BIGINT then return -1 endi if $data31 != FLOAT then return -1 endi -if $data23 != 1 then +if $data23 != TAG then return -1 endi -if $data33 != 2.000000 then +if $data33 != TAG then return -1 endi @@ -545,7 +545,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi diff --git a/tests/script/general/tag/change.sim b/tests/script/general/tag/change.sim index 1577514765..a7b8554bd9 100644 --- a/tests/script/general/tag/change.sim +++ b/tests/script/general/tag/change.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -51,9 +50,9 @@ step21: sql alter table $mt change tag tgcol1 tgcol2 -x step22 return -1 step22: -sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 - return -1 -step20: +#sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 +# return -1 +#step20: sql alter table $mt change tag tgcol1 tgcol3 sql alter table $mt change tag tgcol2 tgcol4 @@ -394,7 +393,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -421,7 +420,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -448,7 +447,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -475,7 +474,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -502,7 +501,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi diff --git a/tests/script/general/tag/commit.sim b/tests/script/general/tag/commit.sim index fca94ee7d4..8b07d98afb 100644 --- a/tests/script/general/tag/commit.sim +++ b/tests/script/general/tag/commit.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -144,10 +143,10 @@ endi if $data31 != FLOAT then return -1 endi -if $data23 != 1 then +if $data23 != TAG then return -1 endi -if $data33 != 2.000000 then +if $data33 != TAG then return -1 endi @@ -544,7 +543,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi @@ -1054,7 +1053,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi diff --git a/tests/script/general/tag/delete.sim b/tests/script/general/tag/delete.sim index 3454ce9d82..f3d0735b5c 100644 --- a/tests/script/general/tag/delete.sim +++ b/tests/script/general/tag/delete.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -98,7 +97,7 @@ endi if $data31 != FLOAT then return -1 endi -if $data23 != 1 then +if $data23 != TAG then return -1 endi @@ -203,13 +202,13 @@ endi if $data42 != 10 then return -1 endi -if $data23 != 1 then +if $data23 != TAG then return -1 endi -if $data33 != 2 then +if $data33 != TAG then return -1 endi -if $data43 != 3 then +if $data43 != TAG then return -1 endi @@ -428,7 +427,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi @@ -452,7 +451,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi @@ -476,7 +475,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi @@ -500,7 +499,7 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi @@ -524,10 +523,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi @@ -554,10 +553,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi @@ -584,10 +583,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi @@ -614,10 +613,10 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi @@ -644,13 +643,13 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi @@ -683,13 +682,13 @@ endi if $data03 != 4.00000 then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi @@ -722,16 +721,16 @@ endi if $data03 != 4.000000000 then return -1 endi -if $data04 != NULL then +if $data04 != null then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -771,13 +770,13 @@ endi if $data04 != 5.000000000 then return -1 endi -if $data05 != NULL then +if $data05 != null then return -1 endi -if $data06 != NULL then +if $data06 != null then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi diff --git a/tests/script/general/tag/set.sim b/tests/script/general/tag/set.sim index 917844c3e3..112695d37b 100644 --- a/tests/script/general/tag/set.sim +++ b/tests/script/general/tag/set.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -91,10 +90,10 @@ endi if $data31 != INT then return -1 endi -if $data23 != false then +if $data23 != TAG then return -1 endi -if $data33 != 4 then +if $data33 != TAG then return -1 endi @@ -338,7 +337,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -365,7 +364,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -392,7 +391,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -419,7 +418,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi @@ -446,7 +445,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != NULL then +if $data07 != null then return -1 endi diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index b33ee206d0..74d022bfcf 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,13 +1,13 @@ cd ../../../debug; cmake .. cd ../../../debug; make -#unsupport ./test.sh -f general/alter/cached_schema_after_alter.sim -#unsupport ./test.sh -f general/alter/count.sim -#unsupport ./test.sh -f general/alter/import.sim -#unsupport ./test.sh -f general/alter/insert1.sim -#unsupport ./test.sh -f general/alter/insert2.sim -#unsupport ./test.sh -f general/alter/metrics.sim -#unsupport ./test.sh -f general/alter/table.sim +#./test.sh -f general/alter/cached_schema_after_alter.sim +./test.sh -f general/alter/count.sim +./test.sh -f general/alter/import.sim +#./test.sh -f general/alter/insert1.sim +./test.sh -f general/alter/insert2.sim +./test.sh -f general/alter/metrics.sim +./test.sh -f general/alter/table.sim ./test.sh -f general/cache/new_metrics.sim ./test.sh -f general/cache/restart_metrics.sim @@ -123,33 +123,33 @@ cd ../../../debug; make #unsupport ./test.sh -f general/parser/null_char.sim ./test.sh -f general/parser/single_row_in_tb.sim ./test.sh -f general/parser/select_from_cache_disk.sim +./test.sh -f general/parser/mixed_blocks.sim +./test.sh -f general/parser/selectResNum.sim ./test.sh -f general/parser/limit.sim ./test.sh -f general/parser/limit1.sim ./test.sh -f general/parser/limit1_tblocks100.sim -./test.sh -f general/parser/mixed_blocks.sim -./test.sh -f general/parser/selectResNum.sim ./test.sh -f general/parser/select_across_vnodes.sim ./test.sh -f general/parser/slimit1.sim ./test.sh -f general/parser/tbnameIn.sim -./test.sh -f general/parser/binary_escapeCharacter.sim ./test.sh -f general/parser/projection_limit_offset.sim ./test.sh -f general/parser/limit2.sim -./test.sh -f general/parser/slimit.sim ./test.sh -f general/parser/fill.sim ./test.sh -f general/parser/fill_stb.sim -./test.sh -f general/parser/interp.sim ./test.sh -f general/parser/where.sim +./test.sh -f general/parser/slimit.sim +./test.sh -f general/parser/select_with_tags.sim +./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/tags_dynamically_specifiy.sim +./test.sh -f general/parser/groupby.sim +./test.sh -f general/parser/set_tag_vals.sim +#./test.sh -f general/parser/slimit_alter_tags.sim ./test.sh -f general/parser/join.sim ./test.sh -f general/parser/join_multivnode.sim -./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/groupby.sim +./test.sh -f general/parser/binary_escapeCharacter.sim ./test.sh -f general/parser/bug.sim -./test.sh -f general/parser/tags_dynamically_specifiy.sim -./test.sh -f general/parser/set_tag_vals.sim -./test.sh -f general/parser/slimit_alter_tags.sim +./test.sh -f general/parser/stream.sim ./test.sh -f general/parser/repeatAlter.sim #unsupport ./test.sh -f general/parser/stream_on_sys.sim -#unsupport ./test.sh -f general/parser/stream.sim #unsupport ./test.sh -f general/parser/repeatStream.sim ./test.sh -f general/stable/disk.sim @@ -206,25 +206,25 @@ cd ../../../debug; make ./test.sh -f general/tag/4.sim ./test.sh -f general/tag/5.sim ./test.sh -f general/tag/6.sim -#unsupport ./test.sh -f general/tag/add.sim +./test.sh -f general/tag/add.sim ./test.sh -f general/tag/bigint.sim ./test.sh -f general/tag/binary_binary.sim ./test.sh -f general/tag/binary.sim ./test.sh -f general/tag/bool_binary.sim ./test.sh -f general/tag/bool_int.sim ./test.sh -f general/tag/bool.sim -#unsupport ./test.sh -f general/tag/change.sim +./test.sh -f general/tag/change.sim ./test.sh -f general/tag/column.sim -#unsupport ./test.sh -f general/tag/commit.sim +#./test.sh -f general/tag/commit.sim ./test.sh -f general/tag/create.sim -#unsupport ./test.sh -f general/tag/delete.sim +./test.sh -f general/tag/delete.sim ./test.sh -f general/tag/double.sim ./test.sh -f general/tag/filter.sim ./test.sh -f general/tag/float.sim ./test.sh -f general/tag/int_binary.sim ./test.sh -f general/tag/int_float.sim ./test.sh -f general/tag/int.sim -#unsupport ./test.sh -f general/tag/set.sim +./test.sh -f general/tag/set.sim ./test.sh -f general/tag/smallint.sim ./test.sh -f general/tag/tinyint.sim @@ -324,18 +324,19 @@ cd ../../../debug; make ./test.sh -f unique/vnode/replica3_vgroup.sim ./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim -./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim # TODO: check file number using sim ? +./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim ./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim ./test.sh -f unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim ./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim ./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim # fail +./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim ./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim ./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim ./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim ./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim -#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim # fail +./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim ./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim #./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim # unsupport ./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim ./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim @@ -350,7 +351,7 @@ cd ../../../debug; make ./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim ./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim ./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim -#./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim # fail +./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim ./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim ./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim ./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim diff --git a/tests/script/jenkins/general.txt b/tests/script/jenkins/general.txt deleted file mode 100644 index 0c14e1c7a0..0000000000 --- a/tests/script/jenkins/general.txt +++ /dev/null @@ -1,5 +0,0 @@ -cd ../../debug; cmake .. -cd ../../debug; make - -./test.sh -f general/db/dropdnodes.sim -./test.sh -f general/user/basic1.sim diff --git a/tests/script/jenkins/simple.txt b/tests/script/jenkins/simple.txt index ae48994c2a..55d139a91c 100644 --- a/tests/script/jenkins/simple.txt +++ b/tests/script/jenkins/simple.txt @@ -1,48 +1,286 @@ cd ../../../debug; cmake .. cd ../../../debug; make -#./test.sh -f general/parser/lastrow.sim -#./test.sh -f general/parser/nchar.sim -#./test.sh -f general/parser/limit.sim -#./test.sh -f general/parser/limit1.sim -#./test.sh -f general/parser/limit1_tblocks100.sim -#./test.sh -f general/parser/binary_escapeCharacter.sim -#./test.sh -f general/parser/projection_limit_offset.sim -#./test.sh -f general/parser/limit2.sim -#./test.sh -f general/stable/metrics.sim -#./test.sh -f general/table/date.sim -#./test.sh -f unique/big/balance.sim -#./test.sh -f unique/column/replica3.sim -#./test.sh -f unique/db/commit.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete.sim +#unsupport ./test.sh -f general/alter/cached_schema_after_alter.sim +#unsupport ./test.sh -f general/alter/count.sim +#unsupport ./test.sh -f general/alter/import.sim +#unsupport ./test.sh -f general/alter/insert1.sim +#unsupport ./test.sh -f general/alter/insert2.sim +#unsupport ./test.sh -f general/alter/metrics.sim +#unsupport ./test.sh -f general/alter/table.sim + +./test.sh -f general/cache/new_metrics.sim +./test.sh -f general/cache/restart_metrics.sim +./test.sh -f general/cache/restart_table.sim + +./test.sh -f general/connection/connection.sim + +./test.sh -f general/column/commit.sim +./test.sh -f general/column/metrics.sim +./test.sh -f general/column/table.sim + +./test.sh -f general/compress/commitlog.sim +./test.sh -f general/compress/compress.sim +./test.sh -f general/compress/compress2.sim +./test.sh -f general/compress/uncompress.sim + +./test.sh -f general/compute/avg.sim +./test.sh -f general/compute/bottom.sim +./test.sh -f general/compute/count.sim +./test.sh -f general/compute/diff.sim +./test.sh -f general/compute/diff2.sim +./test.sh -f general/compute/first.sim +./test.sh -f general/compute/interval.sim +./test.sh -f general/compute/last.sim +./test.sh -f general/compute/leastsquare.sim +./test.sh -f general/compute/max.sim +./test.sh -f general/compute/min.sim +./test.sh -f general/compute/null.sim +./test.sh -f general/compute/percentile.sim +./test.sh -f general/compute/stddev.sim +./test.sh -f general/compute/sum.sim +./test.sh -f general/compute/top.sim + +./test.sh -f general/db/alter_option.sim +./test.sh -f general/db/alter_tables_d2.sim +./test.sh -f general/db/alter_tables_v1.sim +./test.sh -f general/db/alter_tables_v4.sim +./test.sh -f general/db/alter_vgroups.sim +./test.sh -f general/db/basic.sim +./test.sh -f general/db/basic1.sim +./test.sh -f general/db/basic2.sim +./test.sh -f general/db/basic3.sim +./test.sh -f general/db/basic4.sim +./test.sh -f general/db/basic5.sim +./test.sh -f general/db/delete_reuse1.sim +./test.sh -f general/db/delete_writing1.sim +./test.sh -f general/db/delete.sim +./test.sh -f general/db/len.sim +./test.sh -f general/db/repeat.sim +./test.sh -f general/db/tables.sim +./test.sh -f general/db/vnodes.sim + +./test.sh -f general/field/2.sim +./test.sh -f general/field/3.sim +./test.sh -f general/field/4.sim +./test.sh -f general/field/5.sim +./test.sh -f general/field/6.sim +./test.sh -f general/field/bigint.sim +./test.sh -f general/field/binary.sim +./test.sh -f general/field/bool.sim +./test.sh -f general/field/single.sim +./test.sh -f general/field/smallint.sim +./test.sh -f general/field/tinyint.sim + +./test.sh -f general/http/restful.sim +./test.sh -f general/http/restful_insert.sim +./test.sh -f general/http/restful_limit.sim +./test.sh -f general/http/restful_full.sim +./test.sh -f general/http/prepare.sim +./test.sh -f general/http/telegraf.sim +./test.sh -f general/http/grafana_bug.sim +./test.sh -f general/http/grafana.sim + +./test.sh -f general/import/basic.sim +./test.sh -f general/import/commit.sim +./test.sh -f general/import/large.sim +./test.sh -f general/import/replica1.sim + +./test.sh -f general/insert/basic.sim +./test.sh -f general/insert/insert_drop.sim +./test.sh -f general/insert/query_block1_memory.sim +./test.sh -f general/insert/query_block2_memory.sim +./test.sh -f general/insert/query_block1_file.sim +./test.sh -f general/insert/query_block2_file.sim +./test.sh -f general/insert/query_file_memory.sim +./test.sh -f general/insert/query_multi_file.sim +./test.sh -f general/insert/tcp.sim + +#./test.sh -f general/parser/alter.sim +./test.sh -f general/parser/alter1.sim +./test.sh -f general/parser/alter_stable.sim +./test.sh -f general/parser/auto_create_tb.sim +./test.sh -f general/parser/auto_create_tb_drop_tb.sim +./test.sh -f general/parser/col_arithmetic_operation.sim +./test.sh -f general/parser/columnValue.sim +./test.sh -f general/parser/commit.sim +./test.sh -f general/parser/create_db.sim +./test.sh -f general/parser/create_mt.sim +./test.sh -f general/parser/create_tb.sim +./test.sh -f general/parser/dbtbnameValidate.sim +./test.sh -f general/parser/import_commit1.sim +./test.sh -f general/parser/import_commit2.sim +./test.sh -f general/parser/import_commit3.sim +./test.sh -f general/parser/insert_tb.sim +./test.sh -f general/parser/first_last.sim +#unsupport ./test.sh -f general/parser/import_file.sim +./test.sh -f general/parser/lastrow.sim +./test.sh -f general/parser/nchar.sim +#unsupport ./test.sh -f general/parser/null_char.sim +./test.sh -f general/parser/single_row_in_tb.sim +./test.sh -f general/parser/select_from_cache_disk.sim +./test.sh -f general/parser/mixed_blocks.sim +./test.sh -f general/parser/selectResNum.sim +./test.sh -f general/parser/limit.sim +./test.sh -f general/parser/limit1.sim +./test.sh -f general/parser/limit1_tblocks100.sim +./test.sh -f general/parser/select_across_vnodes.sim +./test.sh -f general/parser/slimit1.sim +./test.sh -f general/parser/tbnameIn.sim +./test.sh -f general/parser/projection_limit_offset.sim +./test.sh -f general/parser/limit2.sim +./test.sh -f general/parser/fill.sim +./test.sh -f general/parser/fill_stb.sim +./test.sh -f general/parser/where.sim +./test.sh -f general/parser/slimit.sim +./test.sh -f general/parser/select_with_tags.sim +./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/tags_dynamically_specifiy.sim +./test.sh -f general/parser/groupby.sim +./test.sh -f general/parser/set_tag_vals.sim +#./test.sh -f general/parser/slimit_alter_tags.sim +./test.sh -f general/parser/join.sim +./test.sh -f general/parser/join_multivnode.sim +./test.sh -f general/parser/binary_escapeCharacter.sim +./test.sh -f general/parser/bug.sim +#unsupport ./test.sh -f general/parser/stream_on_sys.sim +#unsupport ./test.sh -f general/parser/stream.sim +#unsupport ./test.sh -f general/parser/repeatAlter.sim +#unsupport ./test.sh -f general/parser/repeatStream.sim + +./test.sh -f general/stable/disk.sim +./test.sh -f general/stable/dnode3.sim +./test.sh -f general/stable/metrics.sim +./test.sh -f general/stable/show.sim +./test.sh -f general/stable/values.sim +./test.sh -f general/stable/vnode3.sim + +#./test.sh -f general/stream/metrics_1.sim +#./test.sh -f general/stream/metrics_del.sim +#./test.sh -f general/stream/metrics_n.sim +#./test.sh -f general/stream/metrics_replica1_vnoden.sim +#./test.sh -f general/stream/new_stream.sim +#./test.sh -f general/stream/restart_stream.sim +#./test.sh -f general/stream/stream_1.sim +#./test.sh -f general/stream/stream_2.sim +#./test.sh -f general/stream/stream_3.sim +#./test.sh -f general/stream/stream_restart.sim +#./test.sh -f general/stream/table_1.sim +#./test.sh -f general/stream/table_del.sim +#./test.sh -f general/stream/table_n.sim +#./test.sh -f general/stream/table_replica1_vnoden.sim + +./test.sh -f general/table/autocreate.sim +./test.sh -f general/table/basic1.sim +./test.sh -f general/table/basic2.sim +./test.sh -f general/table/basic3.sim +./test.sh -f general/table/bigint.sim +./test.sh -f general/table/binary.sim +./test.sh -f general/table/bool.sim +./test.sh -f general/table/column_name.sim +./test.sh -f general/table/column_num.sim +./test.sh -f general/table/column_value.sim +./test.sh -f general/table/column2.sim +./test.sh -f general/table/date.sim +./test.sh -f general/table/db.table.sim +./test.sh -f general/table/delete_reuse1.sim +./test.sh -f general/table/describe.sim +./test.sh -f general/table/double.sim +./test.sh -f general/table/fill.sim +./test.sh -f general/table/float.sim +./test.sh -f general/table/int.sim +./test.sh -f general/table/limit.sim +./test.sh -f general/table/smallint.sim +./test.sh -f general/table/table_len.sim +./test.sh -f general/table/table.sim +./test.sh -f general/table/tinyint.sim +./test.sh -f general/table/vgroup.sim + +./test.sh -f general/tag/3.sim +./test.sh -f general/tag/4.sim +./test.sh -f general/tag/5.sim +./test.sh -f general/tag/6.sim +#unsupport ./test.sh -f general/tag/add.sim +./test.sh -f general/tag/bigint.sim +./test.sh -f general/tag/binary_binary.sim +./test.sh -f general/tag/binary.sim +./test.sh -f general/tag/bool_binary.sim +./test.sh -f general/tag/bool_int.sim +./test.sh -f general/tag/bool.sim +#unsupport ./test.sh -f general/tag/change.sim +./test.sh -f general/tag/column.sim +#unsupport ./test.sh -f general/tag/commit.sim +./test.sh -f general/tag/create.sim +#unsupport ./test.sh -f general/tag/delete.sim +./test.sh -f general/tag/double.sim +./test.sh -f general/tag/filter.sim +./test.sh -f general/tag/float.sim +./test.sh -f general/tag/int_binary.sim +./test.sh -f general/tag/int_float.sim +./test.sh -f general/tag/int.sim +#unsupport ./test.sh -f general/tag/set.sim +./test.sh -f general/tag/smallint.sim +./test.sh -f general/tag/tinyint.sim + +./test.sh -f general/user/authority.sim +./test.sh -f general/user/monitor.sim +./test.sh -f general/user/pass_alter.sim +./test.sh -f general/user/pass_len.sim +./test.sh -f general/user/user_create.sim +./test.sh -f general/user/user_len.sim + +./test.sh -f general/vector/metrics_field.sim +./test.sh -f general/vector/metrics_mix.sim +./test.sh -f general/vector/metrics_query.sim +./test.sh -f general/vector/metrics_tag.sim +./test.sh -f general/vector/metrics_time.sim +./test.sh -f general/vector/multi.sim +./test.sh -f general/vector/single.sim +./test.sh -f general/vector/table_field.sim +./test.sh -f general/vector/table_mix.sim +./test.sh -f general/vector/table_query.sim +./test.sh -f general/vector/table_time.sim + +./test.sh -f unique/account/account_create.sim +./test.sh -f unique/account/account_delete.sim +./test.sh -f unique/account/account_len.sim +./test.sh -f unique/account/authority.sim +./test.sh -f unique/account/basic.sim +./test.sh -f unique/account/paras.sim +./test.sh -f unique/account/pass_alter.sim +./test.sh -f unique/account/pass_len.sim +./test.sh -f unique/account/usage.sim +./test.sh -f unique/account/user_create.sim +./test.sh -f unique/account/user_len.sim + +./test.sh -f unique/cluster/balance1.sim +./test.sh -f unique/cluster/balance2.sim + +./test.sh -f unique/column/replica3.sim + +./test.sh -f unique/db/commit.sim ./test.sh -f unique/db/delete.sim -#./test.sh -f unique/db/replica_add12.sim -#./test.sh -f unique/db/replica_add13.sim -#./test.sh -f unique/vnode/replica3_basic.sim -#./test.sh -f unique/dnode/balance1.sim -#./test.sh -f unique/dnode/balance2.sim -#./test.sh -f unique/dnode/balance3.sim -#./test.sh -f unique/cluster/balance1.sim -#./test.sh -f unique/cluster/balance2.sim -#./test.sh -f unique/cluster/balance3.sim \ No newline at end of file +./test.sh -f unique/dnode/alternativeRole.sim +./test.sh -f unique/dnode/balance1.sim +./test.sh -f unique/dnode/balance2.sim +./test.sh -f unique/dnode/offline1.sim +./test.sh -f unique/dnode/remove2.sim +./test.sh -f unique/dnode/vnode_clean.sim + +./test.sh -f unique/http/admin.sim +./test.sh -f unique/http/opentsdb.sim + +./test.sh -f unique/import/replica2.sim +./test.sh -f unique/import/replica3.sim + +./test.sh -f unique/stable/balance_replica1.sim +./test.sh -f unique/stable/dnode2_stop.sim +./test.sh -f unique/stable/dnode3.sim +./test.sh -f unique/stable/replica2_dnode4.smallint + +./test.sh -f unique/mnode/mgmt22.sim +./test.sh -f unique/mnode/mgmt33.sim + +./test.sh -f unique/vnode/many.sim +./test.sh -f unique/vnode/replica2_basic2.sim \ No newline at end of file diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index 1e033071f7..6928039be1 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -97,13 +97,17 @@ else #relative path RCFG_DIR=sim/$NODE_NAME/cfg PID=`ps -ef|grep taosd | grep $RCFG_DIR | grep -v grep | awk '{print $2}'` - if [ -n "$PID" ]; then + while [ -n "$PID" ] + do if [ "$SIGNAL" = "SIGINT" ]; then - echo killed by signal + echo try to kill by signal SIGINT kill -SIGINT $PID else + echo try to kill by signal SIGKILL kill -9 $PID fi - fi + sleep 1 + PID=`ps -ef|grep taosd | grep $RCFG_DIR | grep -v grep | awk '{print $2}'` + done fi diff --git a/tests/script/unique/account/usage.sim b/tests/script/unique/account/usage.sim index c1c5d75728..3f12c46137 100644 --- a/tests/script/unique/account/usage.sim +++ b/tests/script/unique/account/usage.sim @@ -1,6 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +#system sh/exec.sh -n monitor -s 1 +system sh/exec.sh -n monitorInterval -s 1 sleep 3000 sql connect @@ -25,13 +27,16 @@ endi if $data05 != 0/10 then return -1 endi - +if $data06 != 0.000/unlimited then + return -1 +endi + print =============== check usage account -sql create database d1 -sql create database d2 -sql create database d3 -sql create database d4 -sql create database d5 +sql create database d1 wal 2 +sql create database d2 wal 2 +sql create database d3 wal 2 +sql create database d4 wal 2 +sql create database d5 wal 2 sql create table d1.t1 (ts timestamp, i int); sql create user u1 pass "u1" @@ -53,6 +58,75 @@ endi if $data05 != 0/10 then return -1 endi +if $data06 != 0.000/unlimited then + return -1 +endi + +print =============== step2 +sql alter account root pass "taosdata" tseries 10 storage 1073741824 streams 10 dbs 5 users 5 +sql show accounts +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +if $data00 != root then + return -1 +endi +if $data02 != 4/5 then + return -1 +endi +if $data03 != 5/5 then + return -1 +endi +if $data04 != 1/10 then + return -1 +endi +if $data05 != 0/10 then + return -1 +endi +if $data06 != 0.000/1.000 then + return -1 +endi + +print =============== step3 +sql alter account root pass "taosdata" tseries 10 storage 16 streams 10 dbs 5 users 5 +sql show accounts +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +if $data00 != root then + return -1 +endi +if $data02 != 4/5 then + return -1 +endi +if $data03 != 5/5 then + return -1 +endi +if $data04 != 1/10 then + return -1 +endi +if $data05 != 0/10 then + return -1 +endi +if $data06 != 0.000/0.000 then + return -1 +endi + +print =============== step4 +sql insert into d1.t1 values(now + 1s, 1) +sql insert into d1.t1 values(now + 2s, 2) + +# no write auth +sleep 3000 +sql_error insert into d1.t1 values(now + 3s, 2) +sql_error insert into d1.t1 values(now + 4s, 2) + +sql alter account root pass "taosdata" tseries 10 storage 36 streams 10 dbs 5 users 5 +sleep 3000 +sql insert into d1.t1 values(now + 5s, 1) +sql insert into d1.t1 values(now + 6s, 2) + +# no write auth +sleep 3000 +sql_error insert into d1.t1 values(now + 7s, 2) +sql_error insert into d1.t1 values(now + 8s, 2) + print =============== check grant sql_error create database d6 diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim index ae73fc9423..193a54ac6a 100644 --- a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim +++ b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim @@ -158,11 +158,11 @@ if $data00 != $totalRows then return -1 endi -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l -print ---->dnode3 data files: $system_content , expect is 9 -#if $system_content != @9@ then -# return -1 -#endi +system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' +print ---->dnode3 data files: $system_content expect: 9 +if $system_content != 9 then + return -1 +endi print ============== step5: insert two data rows: now-16d, now+16d, sql insert into $tb values ( now - 21d , -21 ) @@ -175,11 +175,11 @@ if $data00 != $totalRows then return -1 endi -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l -print ---->dnode2 data files: $system_content , expect is 3 -#if $system_content != @3@ then -# return -1 -#endi +system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' +print ---->dnode2 data files: $system_content expect: 3 +if $system_content != 3 then + return -1 +endi print ============== step7: restart dnode3, waiting sync end system sh/exec.sh -n dnode3 -s start @@ -215,13 +215,13 @@ if $data00 != $totalRows then return -1 endi -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l -print ---->dnode2 data files: $system_content , expect is 3 -#if $system_content != @3@ then -# return -1 -#endi -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l -print ---->dnode3 data files: $system_content , expect is 3 -#if $system_content != @3@ then -# return -1 -#endi \ No newline at end of file +system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' +print ---->dnode2 data files: $system_content expect: 3 +if $system_content != 3 then + return -1 +endi +system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' +print ---->dnode3 data files: $system_content expect: 3 +if $system_content != 3 then + return -1 +endi \ No newline at end of file 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 a0d8acb272..50d9bbbecb 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -346,10 +346,11 @@ print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $dat print ============== step7: restart dnode3, and run query +system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sleep $sleepTimer $loopCnt = 0 -wait_dnode3_reready_2: +wait_dnode23_reready_2: $loopCnt = $loopCnt + 1 if $loopCnt == 10 then return -1 @@ -357,7 +358,7 @@ endi sql show dnodes if $rows != 3 then sleep 2000 - goto wait_dnode3_reready_2 + goto wait_dnode23_reready_2 endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 @@ -366,13 +367,18 @@ $dnode1Status = $data4_1 $dnode2Status = $data4_2 $dnode3Status = $data4_3 +if $dnode2Status != ready then + sleep 2000 + goto wait_dnode23_reready_2 +endi + if $dnode3Status != ready then sleep 2000 - goto wait_dnode3_reready_2 + goto wait_dnode23_reready_2 endi $loopCnt = 0 -wait_dnode3_vgroup_master_2: +wait_dnode23_vgroup_ok: $loopCnt = $loopCnt + 1 if $loopCnt == 10 then return -1 @@ -380,7 +386,7 @@ endi sql show vgroups if $rows != 1 then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi print show vgroups: print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 @@ -389,13 +395,13 @@ print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $dat $dnode2Vtatus = $data7_2 $dnode3Vtatus = $data4_2 -if $dnode2Vtatus != offline then +if $dnode2Vtatus == offline then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi -if $dnode3Vtatus != master then +if $dnode3Vtatus == offline then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi sql select count(*) from $stb diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim index 96def07f4a..ce05b0b5ff 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim @@ -345,11 +345,12 @@ print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $dat print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print ============== step7: restart dnode3, and run query +print ============== step7: restart dnode2/dnode3, and run query +system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sleep $sleepTimer $loopCnt = 0 -wait_dnode3_reready_2: +wait_dnode23_reready_2: $loopCnt = $loopCnt + 1 if $loopCnt == 10 then return -1 @@ -357,7 +358,7 @@ endi sql show dnodes if $rows != 3 then sleep 2000 - goto wait_dnode3_reready_2 + goto wait_dnode23_reready_2 endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 @@ -366,13 +367,17 @@ $dnode1Status = $data4_1 $dnode2Status = $data4_2 $dnode3Status = $data4_3 +if $dnode2Status != ready then + sleep 2000 + goto wait_dnode23_reready_2 +endi if $dnode3Status != ready then sleep 2000 - goto wait_dnode3_reready_2 + goto wait_dnode23_reready_2 endi $loopCnt = 0 -wait_dnode3_vgroup_master_2: +wait_dnode23_vgroup_ok: $loopCnt = $loopCnt + 1 if $loopCnt == 10 then return -1 @@ -380,7 +385,7 @@ endi sql show vgroups if $rows != 1 then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi print show vgroups: print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 @@ -389,13 +394,13 @@ print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $dat $dnode2Vtatus = $data7_2 $dnode3Vtatus = $data4_2 -if $dnode2Vtatus != offline then +if $dnode2Vtatus == offline then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi -if $dnode3Vtatus != master then +if $dnode3Vtatus == offline then sleep 2000 - goto wait_dnode3_vgroup_master_2 + goto wait_dnode23_vgroup_ok endi sql select count(*) from $stb diff --git a/tests/script/unique/arbitrator/testSuite.sim b/tests/script/unique/arbitrator/testSuite.sim index 9593137bdd..53160812b0 100644 --- a/tests/script/unique/arbitrator/testSuite.sim +++ b/tests/script/unique/arbitrator/testSuite.sim @@ -9,9 +9,10 @@ run unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim run unique/arbitrator/dn3_mn1_replica_change.sim run unique/arbitrator/dn3_mn1_stopDnode_timeout.sim run unique/arbitrator/dn3_mn1_vnode_change.sim -run unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +run unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim run unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -run unique/arbitrator/dn3_mn1_vnode_delDir.sim +run unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +####run unique/arbitrator/dn3_mn1_vnode_delDir.sim # unsupport run unique/arbitrator/dn3_mn1_vnode_nomaster.sim run unique/arbitrator/dn3_mn2_killDnode.sim run unique/arbitrator/insert_duplicationTs.sim