From 0d85f6ec41d7d2ce0945c38f2b309a4014d0e13c Mon Sep 17 00:00:00 2001 From: dengyihao Date: Sat, 13 Jun 2020 22:06:30 +0800 Subject: [PATCH 01/33] fix bug revealed by coverity --- src/query/src/qast.c | 9 ++++++--- src/query/src/qextbuffer.c | 2 ++ src/query/src/qparserImpl.c | 9 ++------- src/query/src/qpercentile.c | 6 +++--- src/query/src/qresultBuf.c | 10 +++++++--- src/query/src/qtsbuf.c | 2 +- src/query/src/tvariant.c | 2 +- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/query/src/qast.c b/src/query/src/qast.c index 1db965e8a3..8d2202563d 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -496,7 +496,6 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) { printf("relation is like\n"); assert(0); } - return TSDB_CODE_SUCCESS; } @@ -511,7 +510,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr if (cond.start != NULL) { iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); } else { - iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.end->v, pSkipList->keyInfo.type, TSDB_ORDER_DESC); + iter = tSkipListCreateIterFromVal(pSkipList, (char*)(cond.end ? cond.end->v: NULL), pSkipList->keyInfo.type, TSDB_ORDER_DESC); } if (cond.start != NULL) { @@ -601,6 +600,9 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr } } } + free(cond.start); + free(cond.end); + tSkipListDestroyIter(iter); } int32_t merge(SArray *pLeft, SArray *pRight, SArray *pFinalRes) { @@ -748,6 +750,7 @@ static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SExprTravers } taosArrayCopy(pResult, array); + taosArrayDestroy(array); } static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSkipList *pSkipList, SExprTraverseSupp *param ) { @@ -1182,4 +1185,4 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) { CLEANUP_EXECUTE_TO(anchor, false); return expr; -} \ No newline at end of file +} diff --git a/src/query/src/qextbuffer.c b/src/query/src/qextbuffer.c index 6351b850d8..e0a90e0408 100644 --- a/src/query/src/qextbuffer.c +++ b/src/query/src/qextbuffer.c @@ -896,6 +896,7 @@ void tColModelDisplay(SColumnModel *pModel, void *pData, int32_t numOfRows, int3 char buf[4096] = {0}; taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf); printf("%s\t", buf); + break; } case TSDB_DATA_TYPE_BINARY: { printBinaryData(val, pModel->pFields[j].field.bytes); @@ -947,6 +948,7 @@ void tColModelDisplayEx(SColumnModel *pModel, void *pData, int32_t numOfRows, in char buf[128] = {0}; taosUcs4ToMbs(val, pModel->pFields[j].field.bytes, buf); printf("%s\t", buf); + break; } case TSDB_DATA_TYPE_BINARY: { printBinaryDataEx(val, pModel->pFields[j].field.bytes, ¶m[j]); diff --git a/src/query/src/qparserImpl.c b/src/query/src/qparserImpl.c index 4a3cb8adda..87add1e69e 100644 --- a/src/query/src/qparserImpl.c +++ b/src/query/src/qparserImpl.c @@ -775,19 +775,14 @@ void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) { while (nParam-- > 0) { SSQLToken *pToken = va_arg(va, SSQLToken *); - (void)tTokenListAppend(pInfo->pDCLInfo, pToken); + pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken); } va_end(va); } void setDropDBTableInfo(SSqlInfo *pInfo, int32_t type, SSQLToken* pToken, SSQLToken* existsCheck) { pInfo->type = type; - - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); - } - - tTokenListAppend(pInfo->pDCLInfo, pToken); + pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken); pInfo->pDCLInfo->existsCheck = (existsCheck->n == 1); } diff --git a/src/query/src/qpercentile.c b/src/query/src/qpercentile.c index 286171bdab..367028928b 100644 --- a/src/query/src/qpercentile.c +++ b/src/query/src/qpercentile.c @@ -241,7 +241,6 @@ void tBucketDoubleHash(tMemBucket *pBucket, void *value, int16_t *segIdx, int16_ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nElemSize, int16_t dataType, tOrderDescriptor *pDesc) { tMemBucket *pBucket = (tMemBucket *)malloc(sizeof(tMemBucket)); - pBucket->nTotalSlots = totalSlots; pBucket->nSlotsOfSeg = 1 << 6; // 64 Segments, 16 slots each seg. pBucket->dataType = dataType; @@ -258,6 +257,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE pBucket->numOfTotalPages = pBucket->nTotalBufferSize / pBucket->pageSize; pBucket->numOfAvailPages = pBucket->numOfTotalPages; + pBucket->pSegs = NULL; pBucket->pOrderDesc = pDesc; switch (pBucket->dataType) { @@ -315,7 +315,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE pBucket->pSegs[i].pBoundingEntries = NULL; } - uTrace("MemBucket:%p,created,buffer size:%d,elem size:%d", pBucket, pBucket->numOfTotalPages * DEFAULT_PAGE_SIZE, + uTrace("MemBucket:%p,created,buffer size:%ld,elem size:%d", pBucket, pBucket->numOfTotalPages * DEFAULT_PAGE_SIZE, pBucket->nElemSize); return pBucket; @@ -751,7 +751,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction) char * thisVal = buffer->data + pMemBucket->nElemSize * currentIdx; char * nextVal = thisVal + pMemBucket->nElemSize; - double td, nd; + double td = 1.0, nd = 1.0; switch (pMemBucket->dataType) { case TSDB_DATA_TYPE_SMALLINT: { td = *(int16_t *)thisVal; diff --git a/src/query/src/qresultBuf.c b/src/query/src/qresultBuf.c index 55ec57b763..19353c9c5a 100644 --- a/src/query/src/qresultBuf.c +++ b/src/query/src/qresultBuf.c @@ -6,7 +6,12 @@ #include "queryLog.h" int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t size, int32_t rowSize, void* handle) { - SDiskbasedResultBuf* pResBuf = calloc(1, sizeof(SDiskbasedResultBuf)); + *pResultBuf = calloc(1, sizeof(SDiskbasedResultBuf)); + SDiskbasedResultBuf* pResBuf = *pResultBuf; + if (pResBuf == NULL) { + return TSDB_CODE_COM_OUT_OF_MEMORY; + } + pResBuf->numOfRowsPerPage = (DEFAULT_INTERN_BUF_PAGE_SIZE - sizeof(tFilePage)) / rowSize; pResBuf->numOfPages = size; @@ -46,7 +51,6 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t si qTrace("QInfo:%p create tmp file for output result, %s, %" PRId64 "bytes", handle, pResBuf->path, pResBuf->totalBufSize); - *pResultBuf = pResBuf; return TSDB_CODE_SUCCESS; } @@ -210,7 +214,7 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf, void* handle) { } int32_t getLastPageId(SIDList *pList) { - if (pList == NULL && pList->size <= 0) { + if (pList == NULL || pList->size <= 0) { return -1; } diff --git a/src/query/src/qtsbuf.c b/src/query/src/qtsbuf.c index 869299f309..834f648b7a 100644 --- a/src/query/src/qtsbuf.c +++ b/src/query/src/qtsbuf.c @@ -533,7 +533,7 @@ STSVnodeBlockInfo* tsBufGetVnodeBlockInfo(STSBuf* pTSBuf, int32_t vnodeId) { } int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader) { - if ((pTSBuf->f == NULL) || pHeader == NULL || pHeader->numOfVnode < 0 || pHeader->magic != TS_COMP_FILE_MAGIC) { + if ((pTSBuf->f == NULL) || pHeader == NULL || pHeader->numOfVnode == 0 || pHeader->magic != TS_COMP_FILE_MAGIC) { return -1; } diff --git a/src/query/src/tvariant.c b/src/query/src/tvariant.c index b11850a672..32d06225c5 100644 --- a/src/query/src/tvariant.c +++ b/src/query/src/tvariant.c @@ -357,7 +357,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { size_t newSize = pVariant->nLen * TSDB_NCHAR_SIZE; if (pBuf != NULL) { - if (newSize > INITIAL_ALLOC_SIZE) { + if (newSize >= INITIAL_ALLOC_SIZE) { pBuf = realloc(pBuf, newSize + 1); } From 8c4d4618bdf1099287612b8314f1adb4182c3056 Mon Sep 17 00:00:00 2001 From: dengyihao Date: Sun, 14 Jun 2020 01:13:07 +0800 Subject: [PATCH 02/33] fix bug revealed by coverity --- src/query/src/qExecutor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index a1af147b62..3e0ff479e9 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -847,7 +847,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis * } int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - if (isIntervalQuery(pQuery)) { + if (isIntervalQuery(pQuery) && tsCols != NULL) { int32_t offset = GET_COL_DATA_POS(pQuery, 0, step); TSKEY ts = tsCols[offset]; @@ -4263,7 +4263,8 @@ static void sequentialTableProcess(SQInfo *pQInfo) { assert(taosArrayGetSize(s) >= 1); setTagVal(pRuntimeEnv, (STableId*) taosArrayGet(s, 0), pQInfo->tsdb); - + + taosArrayDestroy(s); if (isFirstLastRowQuery(pQuery)) { assert(taosArrayGetSize(s) == 1); } @@ -4328,6 +4329,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; // no results generated for current group, continue to try the next group + taosArrayDestroy(s); if (pWindowResInfo->size <= 0) { continue; } From 8a6eab00dc265e17f5806e062d14b86cd4ccc6df Mon Sep 17 00:00:00 2001 From: dengyihao Date: Sun, 14 Jun 2020 01:25:59 +0800 Subject: [PATCH 03/33] add unit test of parsetime --- src/client/tests/timeParseTest.cpp | 74 +++++++++++++++--------------- src/query/tests/unitTest.cpp | 64 +++++++++++++------------- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/client/tests/timeParseTest.cpp b/src/client/tests/timeParseTest.cpp index 1f53d50c1f..b37be0485b 100644 --- a/src/client/tests/timeParseTest.cpp +++ b/src/client/tests/timeParseTest.cpp @@ -24,19 +24,19 @@ TEST(testCase, parse_time) { int64_t time = 0, time1 = 0; - taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND); char t2[] = "2018-1-1T1:1:1.952Z"; - taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952 + 28800000); char t3[] = "2018-1-1 1:01:01.952"; - taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952); char t4[] = "2018-1-1 1:01:01.9"; @@ -45,122 +45,122 @@ TEST(testCase, parse_time) { char t7[] = "2018-01-01 01:01:01.9"; char t8[] = "2018-01-01 01:01:01.9007865"; - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t9[] = "2017-4-3 1:1:2.980"; char t10[] = "2017-4-3T2:1:2.98+9:00"; - taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t11[] = "2017-4-3T2:1:2.98+09:00"; - taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t12[] = "2017-4-3T2:1:2.98+0900"; - taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); taos_options(TSDB_OPTION_TIMEZONE, "UTC"); deltaToUtcInitOnce(); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 0); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); deltaToUtcInitOnce(); char t14[] = "1970-1-1T0:0:0Z"; - taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 0); char t40[] = "1970-1-1 0:0:0.999999999"; - taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND); char t41[] = "1997-1-1 0:0:0.999999999"; - taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 852048000999); int64_t k = timezone; char t42[] = "1997-1-1T0:0:0.999999999Z"; - taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND); //////////////////////////////////////////////////////////////////// // illegal timestamp format char t15[] = "2017-12-33 0:0:0"; - EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI, 0), -1); char t16[] = "2017-12-31 99:0:0"; - EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI, 0), -1); char t17[] = "2017-12-31T9:0:0"; - EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI, 0), -1); char t18[] = "2017-12-31T9:0:0.Z"; - EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI, 0), -1); char t19[] = "2017-12-31 9:0:0.-1"; - EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI, 0), -1); char t20[] = "2017-12-31 9:0:0.1+12:99"; - EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI, 0), 0); EXPECT_EQ(time, 1514682000100); char t21[] = "2017-12-31T9:0:0.1+12:99"; - EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI, 0), -1); char t22[] = "2017-12-31 9:0:0.1+13:1"; - EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI, 0), 0); char t23[] = "2017-12-31T9:0:0.1+13:1"; - EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI, 0), 0); //======================== add some case ============================// char b1[] = "9999-12-31 23:59:59.999"; - taosParseTime(b1, &time, strlen(b1), TSDB_TIME_PRECISION_MILLI); + taosParseTime(b1, &time, strlen(b1), TSDB_TIME_PRECISION_MILLI,0); EXPECT_EQ(time, 253402271999999); char b2[] = "2020-01-01 01:01:01.321"; - taosParseTime(b2, &time, strlen(b2), TSDB_TIME_PRECISION_MILLI); + taosParseTime(b2, &time, strlen(b2), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1577811661321); taos_options(TSDB_OPTION_TIMEZONE, "America/New_York"); deltaToUtcInitOnce(); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 18000 * MILLISECOND_PER_SECOND); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Tokyo"); deltaToUtcInitOnce(); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, -32400 * MILLISECOND_PER_SECOND); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); deltaToUtcInitOnce(); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, -28800 * MILLISECOND_PER_SECOND); } diff --git a/src/query/tests/unitTest.cpp b/src/query/tests/unitTest.cpp index c33ebeb58b..c5b1cbf858 100644 --- a/src/query/tests/unitTest.cpp +++ b/src/query/tests/unitTest.cpp @@ -334,19 +334,19 @@ TEST(testCase, parse_time) { int64_t time = 0, time1 = 0; - taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t1, &time, strlen(t1), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, timezone * MILLISECOND_PER_SECOND); char t2[] = "2018-1-1T1:1:1.952Z"; - taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t2, &time, strlen(t2), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952 + 28800000); char t3[] = "2018-1-1 1:01:01.952"; - taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t3, &time, strlen(t3), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 1514739661952); char t4[] = "2018-1-1 1:01:01.9"; @@ -355,89 +355,89 @@ TEST(testCase, parse_time) { char t7[] = "2018-01-01 01:01:01.9"; char t8[] = "2018-01-01 01:01:01.9007865"; - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t5, &time1, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t6, &time1, strlen(t6), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t4, &time, strlen(t4), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t7, &time1, strlen(t7), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); - taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t5, &time, strlen(t5), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t8, &time1, strlen(t8), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t9[] = "2017-4-3 1:1:2.980"; char t10[] = "2017-4-3T2:1:2.98+9:00"; - taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t9, &time, strlen(t9), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t11[] = "2017-4-3T2:1:2.98+09:00"; - taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t10, &time1, strlen(t10), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); char t12[] = "2017-4-3T2:1:2.98+0900"; - taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI); - taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t11, &time, strlen(t11), TSDB_TIME_PRECISION_MILLI, 0); + taosParseTime(t12, &time1, strlen(t12), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, time1); taos_options(TSDB_OPTION_TIMEZONE, "UTC"); - taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t13, &time, strlen(t13), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 0); taos_options(TSDB_OPTION_TIMEZONE, "Asia/Shanghai"); char t14[] = "1970-1-1T0:0:0Z"; - taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t14, &time, strlen(t14), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 0); char t40[] = "1970-1-1 0:0:0.999999999"; - taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t40, &time, strlen(t40), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 999 + timezone * MILLISECOND_PER_SECOND); char t41[] = "1997-1-1 0:0:0.999999999"; - taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t41, &time, strlen(t41), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 852048000999); int64_t k = timezone; char t42[] = "1997-1-1T0:0:0.999999999Z"; - taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI); + taosParseTime(t42, &time, strlen(t42), TSDB_TIME_PRECISION_MILLI, 0); EXPECT_EQ(time, 852048000999 - timezone * MILLISECOND_PER_SECOND); //////////////////////////////////////////////////////////////////// // illegal timestamp format char t15[] = "2017-12-33 0:0:0"; - EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t15, &time, strlen(t15), TSDB_TIME_PRECISION_MILLI, 0), -1); char t16[] = "2017-12-31 99:0:0"; - EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t16, &time, strlen(t16), TSDB_TIME_PRECISION_MILLI, 0), -1); char t17[] = "2017-12-31T9:0:0"; - EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t17, &time, strlen(t17), TSDB_TIME_PRECISION_MILLI, 0), -1); char t18[] = "2017-12-31T9:0:0.Z"; - EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t18, &time, strlen(t18), TSDB_TIME_PRECISION_MILLI, 0), -1); char t19[] = "2017-12-31 9:0:0.-1"; - EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t19, &time, strlen(t19), TSDB_TIME_PRECISION_MILLI, 0), -1); char t20[] = "2017-12-31 9:0:0.1+12:99"; - EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t20, &time, strlen(t20), TSDB_TIME_PRECISION_MILLI, 0), 0); EXPECT_EQ(time, 1514682000100); char t21[] = "2017-12-31T9:0:0.1+12:99"; - EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI), -1); + EXPECT_EQ(taosParseTime(t21, &time, strlen(t21), TSDB_TIME_PRECISION_MILLI, 0), -1); char t22[] = "2017-12-31 9:0:0.1+13:1"; - EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t22, &time, strlen(t22), TSDB_TIME_PRECISION_MILLI, 0), 0); char t23[] = "2017-12-31T9:0:0.1+13:1"; - EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI), 0); + EXPECT_EQ(taosParseTime(t23, &time, strlen(t23), TSDB_TIME_PRECISION_MILLI, 0), 0); } TEST(testCase, tvariant_convert) { From f6a3c2432ce66db82b51b633f53f2f885a803f9a Mon Sep 17 00:00:00 2001 From: Hui Li Date: Mon, 15 Jun 2020 18:26:52 +0800 Subject: [PATCH 04/33] [TD-638] --- src/dnode/src/dnodeMgmt.c | 10 + src/inc/taoserror.h | 1 + src/inc/taosmsg.h | 36 ++-- src/mnode/src/mnodeDnode.c | 25 ++- .../arbitrator/check_cluster_cfg_para.sim | 190 ++++++++++++++++++ ...3_mn1_nw_disable_timeout_autoDropDnode.sim | 10 +- .../arbitrator/dn3_mn1_vnode_change.sim | 30 +++ 7 files changed, 284 insertions(+), 18 deletions(-) create mode 100644 tests/script/unique/arbitrator/check_cluster_cfg_para.sim diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index d35e82fa47..b03b2cc244 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -616,6 +616,16 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { pStatus->numOfCores = htons((uint16_t) tsNumOfCores); pStatus->diskAvailable = tsAvailDataDirGB; pStatus->alternativeRole = (uint8_t) tsAlternativeRole; + + // fill cluster cfg parameters + pStatus->ClusterCfgPara.numOfMnodes = tsNumOfMnodes; + pStatus->ClusterCfgPara.mnodeEqualVnodeNum = tsMnodeEqualVnodeNum; + pStatus->ClusterCfgPara.offlineThreshold = tsOfflineThreshold; + pStatus->ClusterCfgPara.statusInterval = tsStatusInterval; + strcpy(pStatus->ClusterCfgPara.arbitrator, tsArbitrator); + strcpy(pStatus->ClusterCfgPara.timezone, tsTimezone); + strcpy(pStatus->ClusterCfgPara.locale, tsLocale); + strcpy(pStatus->ClusterCfgPara.charset, tsCharset); vnodeBuildStatusMsg(pStatus); contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index ac2af75742..df9992d53a 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -121,6 +121,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, 0, 0x0331, "mnode dnod TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_EXIST, 0, 0x0332, "mnode vgroup not exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_REMOVE_MASTER, 0, 0x0333, "mnode cant not remove master") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_DNODES, 0, 0x0334, "mnode no enough dnodes") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT, 0, 0x0335, "mnode cluster cfg inconsistent") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, 0, 0x0340, "mnode accounts already exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT, 0, 0x0341, "mnode invalid account") diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 1198097895..611bd6a713 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -557,18 +557,30 @@ typedef struct { } SDMMnodeInfos; typedef struct { - uint32_t version; - int32_t dnodeId; - char dnodeEp[TSDB_EP_LEN]; - uint32_t moduleStatus; - uint32_t lastReboot; // time stamp for last reboot - uint16_t numOfTotalVnodes; // from config file - uint16_t openVnodes; - uint16_t numOfCores; - float diskAvailable; // GB - uint8_t alternativeRole; - uint8_t reserve[15]; - SVnodeLoad load[]; + int32_t numOfMnodes; // tsNumOfMnodes + int32_t mnodeEqualVnodeNum; // tsMnodeEqualVnodeNum + int32_t offlineThreshold; // tsOfflineThreshold + int32_t statusInterval; // tsStatusInterval + char arbitrator[TSDB_EP_LEN]; // tsArbitrator + char timezone[64]; // tsTimezone + char locale[TSDB_LOCALE_LEN]; // tsLocale + char charset[TSDB_LOCALE_LEN]; // tsCharset +} SClusterCfg; + +typedef struct { + uint32_t version; + int32_t dnodeId; + char dnodeEp[TSDB_EP_LEN]; + uint32_t moduleStatus; + uint32_t lastReboot; // time stamp for last reboot + uint16_t numOfTotalVnodes; // from config file + uint16_t openVnodes; + uint16_t numOfCores; + float diskAvailable; // GB + uint8_t alternativeRole; + uint8_t reserve[15]; + SClusterCfg ClusterCfgPara; + SVnodeLoad load[]; } SDMStatusMsg; typedef struct { diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index d2af86badb..aab53b9f7b 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -277,6 +277,20 @@ static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { mPrint("cfg dnode rsp is received"); } +static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) { + if (clusterCfg->numOfMnodes != tsNumOfMnodes) return false; + if (clusterCfg->mnodeEqualVnodeNum != tsMnodeEqualVnodeNum) return false; + if (clusterCfg->offlineThreshold != tsOfflineThreshold) return false; + if (clusterCfg->statusInterval != tsStatusInterval) return false; + + if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) return false; + if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) return false; + if (0 != strncasecmp(clusterCfg->locale, tsLocale, strlen(tsLocale))) return false; + if (0 != strncasecmp(clusterCfg->charset, tsCharset, strlen(tsCharset))) return false; + + return true; +} + static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { SDMStatusMsg *pStatus = pMsg->rpcMsg.pCont; pStatus->dnodeId = htonl(pStatus->dnodeId); @@ -312,7 +326,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pDnode->alternativeRole = pStatus->alternativeRole; pDnode->totalVnodes = pStatus->numOfTotalVnodes; pDnode->moduleStatus = pStatus->moduleStatus; - pDnode->lastAccess = tsAccessSquence; if (pStatus->dnodeId == 0) { mTrace("dnode:%d %s, first access", pDnode->dnodeId, pDnode->dnodeEp); @@ -338,6 +351,14 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { } if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { + // Verify whether the cluster parameters are consistent when status change from offline to ready + bool ret = mnodeCheckClusterCfgPara(&(pStatus->ClusterCfgPara)); + if (false == ret) { + mnodeDecDnodeRef(pDnode); + mError("dnode %s cluster cfg parameters inconsistent", pStatus->dnodeEp); + return TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT; + } + mTrace("dnode:%d, from offline to online", pDnode->dnodeId); pDnode->status = TAOS_DN_STATUS_READY; balanceUpdateMnode(); @@ -352,6 +373,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { return TSDB_CODE_MND_OUT_OF_MEMORY; } + pDnode->lastAccess = tsAccessSquence; + mnodeGetMnodeInfos(&pRsp->mnodes); pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); diff --git a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim new file mode 100644 index 0000000000..e74717c077 --- /dev/null +++ b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim @@ -0,0 +1,190 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/deploy.sh -n dnode7 -i 7 + + +system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode1 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode1 -c statusInterval -v 3 +system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode1 -c timezone -v "" +#system sh/cfg.sh -n dnode1 -c locale -v "" +#system sh/cfg.sh -n dnode1 -c charset -v "" +system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 + +######## dnode 2 the same with dnode1 +system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode2 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode2 -c statusInterval -v 3 +system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode2 -c timezone -v "" +#system sh/cfg.sh -n dnode2 -c locale -v "" +#system sh/cfg.sh -n dnode2 -c charset -v "" +system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 + +######## dnode 3 one para no same with dnode1 +system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 +system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode3 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode3 -c statusInterval -v 3 +system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode3 -c timezone -v "" +#system sh/cfg.sh -n dnode3 -c locale -v "" +#system sh/cfg.sh -n dnode3 -c charset -v "" +system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 + +######## dnode 4 one para no same with dnode1 +system sh/cfg.sh -n dnode4 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 5 +system sh/cfg.sh -n dnode4 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode4 -c statusInterval -v 3 +system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode4 -c timezone -v "" +#system sh/cfg.sh -n dnode4 -c locale -v "" +#system sh/cfg.sh -n dnode4 -c charset -v "" +system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 + +######## dnode 5 one para no same with dnode1 +system sh/cfg.sh -n dnode5 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode5 -c offlineThreshold -v 16 +system sh/cfg.sh -n dnode5 -c statusInterval -v 3 +system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode5 -c timezone -v "" +#system sh/cfg.sh -n dnode5 -c locale -v "" +#system sh/cfg.sh -n dnode5 -c charset -v "" +system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 + + +######## dnode 6 one para no same with dnode1 +system sh/cfg.sh -n dnode6 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode6 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode6 -c statusInterval -v 2 +system sh/cfg.sh -n dnode6 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode6 -c timezone -v "" +#system sh/cfg.sh -n dnode6 -c locale -v "" +#system sh/cfg.sh -n dnode6 -c charset -v "" +system sh/cfg.sh -n dnode6 -c balanceInterval -v 10 + + +######## dnode 7 one para no same with dnode1 +system sh/cfg.sh -n dnode7 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode7 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode7 -c statusInterval -v 3 +system sh/cfg.sh -n dnode7 -c arbitrator -v "plum-VirtualBox:8001" +#system sh/cfg.sh -n dnode7 -c timezone -v "" +#system sh/cfg.sh -n dnode7 -c locale -v "" +#system sh/cfg.sh -n dnode7 -c charset -v "" +system sh/cfg.sh -n dnode7 -c balanceInterval -v 10 + +print ============== step0: start tarbitrator +system sh/exec_tarbitrator.sh -s start + +print ============== step1: start dnode1 +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print ============== step2: start dnode2~7 and add into cluster +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +system sh/exec.sh -n dnode5 -s start +system sh/exec.sh -n dnode6 -s start +system sh/exec.sh -n dnode7 -s start +sql create dnode $hostname2 +sql create dnode $hostname3 +sql create dnode $hostname4 +sql create dnode $hostname5 +sql create dnode $hostname6 +sql create dnode $hostname7 +sleep 10000 + +wait_dnode_created: +sql show dnodes +if $rows != 7 then + sleep 2000 + goto wait_dnode_created +endi +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 +$dnode4Status = $data4_4 +$dnode5Status = $data4_5 +$dnode6Status = $data4_6 +$dnode7Status = $data4_7 + +if $dnode1Status != ready then + return -1 +endi +if $dnode2Status != ready then + return -1 +endi +if $dnode3Status != offline then + return -1 +endi +if $dnode4Status != offline then + return -1 +endi +if $dnode5Status != offline then + return -1 +endi +if $dnode6Status != offline then + return -1 +endi +if $dnode7Status != offline then + return -1 +endi + +sleep 10000 + +wait_dnode_offline_overtime_dropped: +sql show dnodes +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +if $rows != 2 then + sleep 2000 + goto wait_dnode_offline_overtime_dropped +endi +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 +$dnode4Status = $data4_4 +$dnode5Status = $data4_5 +$dnode6Status = $data4_6 +$dnode7Status = $data4_7 + +if $dnode1Status != ready then + return -1 +endi +if $dnode2Status != ready then + return -1 +endi diff --git a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim index 71e606e529..9b1e320946 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim @@ -5,11 +5,11 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode5 -c numOfMPeers -v 1 +system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode5 -c numOfMnodes -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode2 -c walLevel -v 1 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim index fda850d2c9..d2bd5c6b26 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim @@ -96,7 +96,12 @@ endi print ============== step3: stop dnode4, and remove its vnodeX subdirector system sh/exec.sh -n dnode4 -s stop -x SIGINT sleep $sleepTimer +$loopCnt = 0 wait_dnode4_offline_0: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi sql show dnodes if $rows != 4 then sleep 2000 @@ -148,7 +153,14 @@ sleep 1000 print ============== step4: restart dnode4, waiting sync end system sh/exec.sh -n dnode4 -s start sleep $sleepTimer + +$loopCnt = 0 wait_dnode4_reready: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show dnodes if $rows != 4 then sleep 2000 @@ -171,7 +183,13 @@ if $dnode4Status != ready then goto wait_dnode4_reready endi +$loopCnt = 0 wait_dnode4_vgroup_slave: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show vgroups if $rows != 1 then sleep 2000 @@ -200,7 +218,13 @@ system sh/exec.sh -n dnode2 -s stop system sh/exec.sh -n dnode3 -s stop sleep $sleepTimer + +$loopCnt = 0 wait_dnode23_offline: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi sql show dnodes if $rows != 4 then sleep 2000 @@ -231,7 +255,13 @@ if $dnode4Status != ready then goto wait_dnode23_offline endi +$loopCnt = 0 wait_dnode4_vgroup_master: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show vgroups if $rows != 1 then sleep 2000 From 6e4c0b638da9b676f67fa55d70b3076d62f6d061 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Mon, 15 Jun 2020 18:46:01 +0800 Subject: [PATCH 05/33] [TD-638] --- src/dnode/src/dnodeMgmt.c | 16 ++++++++-------- src/inc/taosmsg.h | 2 +- src/mnode/src/mnodeDnode.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index b03b2cc244..30fdd21b99 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -618,14 +618,14 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { pStatus->alternativeRole = (uint8_t) tsAlternativeRole; // fill cluster cfg parameters - pStatus->ClusterCfgPara.numOfMnodes = tsNumOfMnodes; - pStatus->ClusterCfgPara.mnodeEqualVnodeNum = tsMnodeEqualVnodeNum; - pStatus->ClusterCfgPara.offlineThreshold = tsOfflineThreshold; - pStatus->ClusterCfgPara.statusInterval = tsStatusInterval; - strcpy(pStatus->ClusterCfgPara.arbitrator, tsArbitrator); - strcpy(pStatus->ClusterCfgPara.timezone, tsTimezone); - strcpy(pStatus->ClusterCfgPara.locale, tsLocale); - strcpy(pStatus->ClusterCfgPara.charset, tsCharset); + pStatus->clusterCfg.numOfMnodes = tsNumOfMnodes; + pStatus->clusterCfg.mnodeEqualVnodeNum = tsMnodeEqualVnodeNum; + pStatus->clusterCfg.offlineThreshold = tsOfflineThreshold; + pStatus->clusterCfg.statusInterval = tsStatusInterval; + strcpy(pStatus->clusterCfg.arbitrator, tsArbitrator); + strcpy(pStatus->clusterCfg.timezone, tsTimezone); + strcpy(pStatus->clusterCfg.locale, tsLocale); + strcpy(pStatus->clusterCfg.charset, tsCharset); vnodeBuildStatusMsg(pStatus); contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 611bd6a713..7b3b2bb046 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -579,7 +579,7 @@ typedef struct { float diskAvailable; // GB uint8_t alternativeRole; uint8_t reserve[15]; - SClusterCfg ClusterCfgPara; + SClusterCfg clusterCfg; SVnodeLoad load[]; } SDMStatusMsg; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index aab53b9f7b..88f2c74778 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -352,7 +352,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { // Verify whether the cluster parameters are consistent when status change from offline to ready - bool ret = mnodeCheckClusterCfgPara(&(pStatus->ClusterCfgPara)); + bool ret = mnodeCheckClusterCfgPara(&(pStatus->clusterCfg)); if (false == ret) { mnodeDecDnodeRef(pDnode); mError("dnode %s cluster cfg parameters inconsistent", pStatus->dnodeEp); From fcca57d8dab22f0aa6a718a1af7dd7a491e25a64 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Mon, 15 Jun 2020 18:50:28 +0800 Subject: [PATCH 06/33] [init varaible] --- src/plugins/http/src/httpSession.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c index e80d6f26b7..cc60890e18 100644 --- a/src/plugins/http/src/httpSession.c +++ b/src/plugins/http/src/httpSession.c @@ -46,6 +46,7 @@ void httpCreateSession(HttpContext *pContext, void *taos) { } HttpSession session; + memset(&session, 0, sizeof(HttpSession)); session.taos = taos; session.expire = (int)taosGetTimestampSec() + server->sessionExpire; session.access = 1; @@ -199,4 +200,4 @@ void httpProcessSessionExpire(void *handle, void *tmrId) { HttpServer *pServer = (HttpServer *)handle; httpRemoveExpireSessions(pServer); taosTmrReset(httpProcessSessionExpire, 60000, pServer, pServer->timerHandle, &pServer->expireTimer); -} \ No newline at end of file +} From ff3e4e4fbd10a254c0d44632b6824c4f815f2a4c Mon Sep 17 00:00:00 2001 From: Hui Li Date: Mon, 15 Jun 2020 19:06:53 +0800 Subject: [PATCH 07/33] [modify] --- src/plugins/http/src/httpSession.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c index dfa2a4bd9f..3e43fb87f9 100644 --- a/src/plugins/http/src/httpSession.c +++ b/src/plugins/http/src/httpSession.c @@ -29,7 +29,8 @@ void httpCreateSession(HttpContext *pContext, void *taos) { pthread_mutex_lock(&server->serverMutex); - HttpSession session = {0}; + HttpSession session; + memset(&session, 0, sizeof(HttpSession); session.taos = taos; session.refCount = 1; snprintf(session.id, HTTP_SESSION_ID_LEN, "%s.%s", pContext->user, pContext->pass); @@ -122,27 +123,3 @@ bool httpInitSessions() { return true; } - -void httpRemoveExpireSessions(HttpServer *pServer) { - SHashMutableIterator *pIter = taosHashCreateIter(pServer->pSessionHash); - - while (taosHashIterNext(pIter)) { - HttpSession *pSession = taosHashIterGet(pIter); - if (pSession == NULL) continue; - - pthread_mutex_lock(&pServer->serverMutex); - if (httpSessionExpired(pSession)) { - httpResetSession(pSession); - taosHashRemove(pServer->pSessionHash, pSession->id, strlen(pSession->id)); - } - pthread_mutex_unlock(&pServer->serverMutex); - } - - taosHashDestroyIter(pIter); -} - -void httpProcessSessionExpire(void *handle, void *tmrId) { - HttpServer *pServer = (HttpServer *)handle; - httpRemoveExpireSessions(pServer); - taosTmrReset(httpProcessSessionExpire, 60000, pServer, pServer->timerHandle, &pServer->expireTimer); -} From f4bc8a2b91ae46da8507fe6122a455f65c914e7f Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 15 Jun 2020 20:13:10 +0800 Subject: [PATCH 08/33] fix tag_lite/change.py [TD-596] --- tests/pytest/tag_lite/change.py | 175 ++++++++++++++++++++++---------- 1 file changed, 120 insertions(+), 55 deletions(-) diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index 1f411b7e5a..7cbef188b2 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -84,18 +84,30 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tagcx tgcol3 -x step21 + tdLog.info("alter table ta_ch_mt2 change tag tagcx tgcol3 -x step21") + tdSql.error("alter table ta_ch_mt2 change tag tagcx tgcol3") # TSIM: return -1 # TSIM: step21: # TSIM: sql alter table $mt change tag tgcol1 tgcol2 -x step22 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 tgcol2 -x step22") + tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2") # TSIM: return -1 # TSIM: step22: # TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + tdSql.error("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # TSIM: return -1 # TSIM: step20: # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt2 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt2 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt2 change tag tgcol2 tgcol4") # TSIM: sql alter table $mt change tag tgcol4 tgcol3 -x step23 + tdLog.info("alter table ta_ch_mt2 change tag tgcol4 tgcol3 -x step23") + tdSql.error("alter table ta_ch_mt2 change tag tgcol4 tgcol3") # TSIM: return -1 # TSIM: step23: # TSIM: @@ -141,7 +153,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt3 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt3 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt3 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt3 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -185,7 +201,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt4 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt4 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt4 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt4 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -224,12 +244,16 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt5 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt5 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt5 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt5 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -257,13 +281,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data01 != 1 then - tdLog.info('tdSql.checkData(0, 1, 1)') + tdLog.info("tdSql.checkData(0, 1, 1)") tdSql.checkData(0, 1, 1) # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -278,7 +302,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdSql.checkData(0, 5, '4') # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -288,22 +312,42 @@ class TDTestCase: # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdSql.checkData(0, 7, '6') # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info("alter table ta_ch_mt6 drop tag tgcol3") + tdSql.execute("alter table ta_ch_mt6 drop tag tgcol3") # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: sql alter table $mt change tag tgcol4 tgcol3 + tdLog.info("alter table ta_ch_mt6 change tag tgcol4 tgcol3") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol4 tgcol3") # TSIM: sql alter table $mt change tag tgcol1 tgcol7 + tdLog.info("alter table ta_ch_mt6 change tag tgcol1 tgcol7") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol1 tgcol7") # TSIM: sql alter table $mt change tag tgcol2 tgcol8 + tdLog.info("alter table ta_ch_mt6 change tag tgcol2 tgcol8") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol2 tgcol8") # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: sql alter table $mt change tag tgcol3 tgcol9 + tdLog.info("alter table ta_ch_mt6 change tag tgcol3 tgcol9") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol3 tgcol9") # TSIM: sql alter table $mt change tag tgcol5 tgcol10 + tdLog.info("alter table ta_ch_mt6 change tag tgcol5 tgcol10") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol5 tgcol10") # TSIM: sql alter table $mt change tag tgcol6 tgcol11 + tdLog.info("alter table ta_ch_mt6 change tag tgcol6 tgcol11") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol6 tgcol11") # TSIM: # TSIM: sleep 5000 # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -313,12 +357,12 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step24 tdLog.info('select * from ta_ch_mt2 where tgcol1 = 1 -x step24') - tdSql.error('select * from ta_ch_mt2 where tgcol1 = 14') + tdSql.error("select * from ta_ch_mt2 where tgcol1 = 1") # TSIM: return -1 # TSIM: step24: # TSIM: sql select * from $mt where tgcol2 = 1 -x step25 tdLog.info('select * from ta_ch_mt2 where tgcol2 = 1 -x step25') - tdSql.error('select * from ta_ch_mt2 where tgcol2 = 15') + tdSql.error('select * from ta_ch_mt2 where tgcol2 = 1') # TSIM: return -1 # TSIM: step25: # TSIM: @@ -382,12 +426,12 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step31 tdLog.info('select * from ta_ch_mt3 where tgcol1 = 1 -x step31') - tdSql.error('select * from ta_ch_mt3 where tgcol1 = 11') + tdSql.error('select * from ta_ch_mt3 where tgcol1 = 1') # TSIM: return -1 # TSIM: step31: # TSIM: sql select * from $mt where tgcol2 = 1 -x step32 tdLog.info('select * from ta_ch_mt3 where tgcol2 = 1 -x step32') - tdSql.error('select * from ta_ch_mt3 where tgcol2 = 12') + tdSql.error('select * from ta_ch_mt3 where tgcol2 = 1') # TSIM: return -1 # TSIM: step32: # TSIM: @@ -418,8 +462,8 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 2 - tdLog.info('select * from $mt where tgcol4 = 2') - tdSql.query('select * from $mt where tgcol4 = 2') + tdLog.info('select * from ta_ch_mt3 where tgcol4 = 2') + tdSql.query('select * from ta_ch_mt3 where tgcol4 = 2') # TSIM: print $data01 $data02 $data03 tdLog.info('$data01 $data02 $data03') # TSIM: if $rows != 1 then @@ -551,7 +595,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -577,7 +621,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -589,32 +633,32 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step61 tdLog.info('select * from ta_ch_mt6 where tgcol1 = 1 -x step61') - tdSql.error('select * from ta_ch_mt6 where tgcol1 = 11') + tdSql.error('select * from ta_ch_mt6 where tgcol1 = 1') # TSIM: return -1 # TSIM: step61: # TSIM: sql select * from $mt where tgcol2 = 1 -x step62 tdLog.info('select * from ta_ch_mt6 where tgcol2 = 1 -x step62') - tdSql.error('select * from ta_ch_mt6 where tgcol2 = 12') + tdSql.error('select * from ta_ch_mt6 where tgcol2 = 1') # TSIM: return -1 # TSIM: step62: # TSIM: sql select * from $mt where tgcol3 = 1 -x step63 tdLog.info('select * from ta_ch_mt6 where tgcol3 = 1 -x step63') - tdSql.error('select * from ta_ch_mt6 where tgcol3 = 13') + tdSql.error('select * from ta_ch_mt6 where tgcol3 = 1') # TSIM: return -1 # TSIM: step63: # TSIM: sql select * from $mt where tgcol4 = 1 -x step64 tdLog.info('select * from ta_ch_mt6 where tgcol4 = 1 -x step64') - tdSql.error('select * from ta_ch_mt6 where tgcol4 = 14') + tdSql.error('select * from ta_ch_mt6 where tgcol4 = 1') # TSIM: return -1 # TSIM: step64: # TSIM: sql select * from $mt where tgcol5 = 1 -x step65 tdLog.info('select * from ta_ch_mt6 where tgcol5 = 1 -x step65') - tdSql.error('select * from ta_ch_mt6 where tgcol5 = 15') + tdSql.error('select * from ta_ch_mt6 where tgcol5 = 1') # TSIM: return -1 # TSIM: step65: # TSIM: sql select * from $mt where tgcol6 = 1 -x step66 tdLog.info('select * from ta_ch_mt6 where tgcol6 = 1 -x step66') - tdSql.error('select * from ta_ch_mt6 where tgcol6 = 16') + tdSql.error('select * from ta_ch_mt6 where tgcol6 = 1') # TSIM: return -1 # TSIM: step66: # TSIM: @@ -634,8 +678,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -644,8 +688,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -654,13 +698,18 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -680,8 +729,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -690,8 +739,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4"")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -700,13 +749,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -726,8 +779,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -736,8 +789,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -746,13 +799,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -772,8 +829,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -782,8 +839,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -792,13 +849,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -818,8 +879,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -828,8 +889,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -838,13 +899,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: From 5684cc1aa5262f24ebf948e3290d71607fa12e84 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 15 Jun 2020 20:15:21 +0800 Subject: [PATCH 09/33] add change.py to regression test. --- tests/pytest/regressiontest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 50237f27c5..3b26aaf30d 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -29,14 +29,14 @@ python3 ./test.py -f tag_lite/3.py python3 ./test.py -f tag_lite/4.py python3 ./test.py -f tag_lite/5.py python3 ./test.py -f tag_lite/6.py -# python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/add.py python3 ./test.py -f tag_lite/bigint.py python3 ./test.py -f tag_lite/binary_binary.py python3 ./test.py -f tag_lite/binary.py python3 ./test.py -f tag_lite/bool_binary.py python3 ./test.py -f tag_lite/bool_int.py python3 ./test.py -f tag_lite/bool.py -# python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/change.py python3 ./test.py -f tag_lite/column.py # python3 ./test.py -f tag_lite/commit.py python3 ./test.py -f tag_lite/create.py From 7a2a998569e03c2134ad6764a1a656b0ed215577 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 15 Jun 2020 14:44:15 +0000 Subject: [PATCH 10/33] fix TD-647 --- src/common/src/tdataformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 77e91acc14..40cdac9833 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -588,7 +588,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { if (kvRowNCols(nrow) - colIdx - 1 > 0) { for (int i = colIdx + 1; i < kvRowNCols(nrow); i++) { kvRowColIdxAt(nrow, i)->colId = kvRowColIdxAt(row, i)->colId; - kvRowColIdxAt(nrow, i)->offset += diff; + kvRowColIdxAt(nrow, i)->offset = kvRowColIdxAt(row, i)->offset + diff; } memcpy(kvRowColVal(nrow, kvRowColIdxAt(nrow, colIdx + 1)), kvRowColVal(row, kvRowColIdxAt(row, colIdx + 1)), POINTER_DISTANCE(kvRowEnd(row), kvRowColVal(row, kvRowColIdxAt(row, colIdx + 1)))); From 20c4491974ae503af8af4ddc97a9ace181c9bdf8 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 15 Jun 2020 15:21:24 +0000 Subject: [PATCH 11/33] TD-649 --- src/tsdb/src/tsdbMeta.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 8eb259d38c..7795f25b71 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -424,6 +424,11 @@ int tsdbUpdateTable(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg) { pTable->schema[pTable->numOfSchemas-1] = tSchema; } + STSchema *lSchema = pTable->schema[pTable->numOfSchemas - 1]; + if (schemaNCols(lSchema) > pMeta->maxCols) pMeta->maxCols = schemaNCols(lSchema); + int bytes = dataRowMaxBytesFromSchema(lSchema); + if (bytes > pMeta->maxRowBytes) pMeta->maxRowBytes = bytes; + isChanged = true; } From df223f7573ab8a0199689c20c77076cf1398e175 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 09:18:59 +0800 Subject: [PATCH 12/33] [modify] --- src/plugins/http/src/httpSession.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c index 3e43fb87f9..c1e33706d5 100644 --- a/src/plugins/http/src/httpSession.c +++ b/src/plugins/http/src/httpSession.c @@ -30,7 +30,7 @@ void httpCreateSession(HttpContext *pContext, void *taos) { pthread_mutex_lock(&server->serverMutex); HttpSession session; - memset(&session, 0, sizeof(HttpSession); + memset(&session, 0, sizeof(HttpSession)); session.taos = taos; session.refCount = 1; snprintf(session.id, HTTP_SESSION_ID_LEN, "%s.%s", pContext->user, pContext->pass); From ddd45c38108f28717b3f0d94723d98d95ceb087e Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 11:31:14 +0800 Subject: [PATCH 13/33] [modify sim case] --- .../arbitrator/dn3_mn1_vnode_corruptFile_offline.sim | 8 +++++++- .../arbitrator/dn3_mn1_vnode_corruptFile_online.sim | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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 d556976a43..793c6da380 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -177,7 +177,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync ok +print ============== step5: stop dnode2, and check if dnode3 sync success system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: @@ -224,3 +224,9 @@ if $dnode3Vtatus != master then sleep 2000 goto wait_dnode3_vgroup_master endi + +sql select count(*) from $stb +print data00 $data00 +if $data00 != $totalRows then + return -1 +endi \ No newline at end of file diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim index 968a93156e..8c78e64a57 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim @@ -105,7 +105,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync ok +print ============== step5: stop dnode2, and check if dnode3 sync success system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: @@ -152,3 +152,9 @@ if $dnode3Vtatus != master then sleep 2000 goto wait_dnode3_vgroup_master endi + +sql select count(*) from $stb +print data00 $data00 +if $data00 != $totalRows then + return -1 +endi \ No newline at end of file From 34308601b6a62cc1fb4e8fcd26e9f4613169914d Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 11:34:21 +0800 Subject: [PATCH 14/33] [modify sim case] --- .../unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim | 2 +- .../unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 793c6da380..6062b07510 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -177,7 +177,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync success +print ============== step5: stop dnode2, and check if dnode3 sync ok system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim index 8c78e64a57..fc8577964d 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim @@ -105,7 +105,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step5: stop dnode2, and check if dnode3 sync success +print ============== step5: stop dnode2, and check if dnode3 sync ok system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer wait_dnode2_offline_0: From 9e6fc7dcc1fed484e1abbf9761a52e2faf65e0b6 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 14:33:11 +0800 Subject: [PATCH 15/33] fix tag_lite/commit.py [TD-478] --- tests/pytest/regressiontest.sh | 2 +- tests/pytest/tag_lite/commit.py | 210 +++++++++++++++++--------------- 2 files changed, 110 insertions(+), 102 deletions(-) diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 3b26aaf30d..cdb0192c70 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -38,7 +38,7 @@ python3 ./test.py -f tag_lite/bool_int.py python3 ./test.py -f tag_lite/bool.py python3 ./test.py -f tag_lite/change.py python3 ./test.py -f tag_lite/column.py -# python3 ./test.py -f tag_lite/commit.py +python3 ./test.py -f tag_lite/commit.py python3 ./test.py -f tag_lite/create.py # python3 ./test.py -f tag_lite/datatype.py python3 ./test.py -f tag_lite/datatype-without-alter.py diff --git a/tests/pytest/tag_lite/commit.py b/tests/pytest/tag_lite/commit.py index 478520a586..8b69d4aa5f 100644 --- a/tests/pytest/tag_lite/commit.py +++ b/tests/pytest/tag_lite/commit.py @@ -296,13 +296,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != 1 then - tdLog.info('tdSql.checkData(2, 3, 1)') - tdSql.checkData(2, 3, 1) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data33 != 2.000000 then - tdLog.info('tdSql.checkData(3, 3, 2.000000)') - tdSql.checkData(3, 3, 2.000000) + tdLog.info('tdSql.checkData(3, 3, "TAG")') + tdSql.checkData(3, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: @@ -395,8 +395,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -552,13 +552,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info('tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 6 then - tdLog.info('tdSql.checkData(0, 4, 6)') - tdSql.checkData(0, 4, 6) + tdLog.info('tdSql.checkData(0, 4, "6")') + tdSql.checkData(0, 4, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -583,13 +583,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info('tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 6 then - tdLog.info('tdSql.checkData(0, 4, 6)') - tdSql.checkData(0, 4, 6) + tdLog.info('tdSql.checkData(0, 4, "6")') + tdSql.checkData(0, 4, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -653,8 +653,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -778,8 +778,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -835,8 +835,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info('tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 1 then @@ -897,13 +897,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1021,29 +1021,29 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) - tdSql.error('alter table %s change tag tgcol1 tgcol403' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt)) # TSIM: return -1 # TSIM: step103: # TSIM: @@ -1095,13 +1095,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 0 then @@ -1111,18 +1111,22 @@ class TDTestCase: # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + try: + tdSql.checkData(0, 5, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) - tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step101: # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) - tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step102: # TSIM: @@ -1186,14 +1190,14 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) - tdSql.error('alter table %s change tag tgcol1 tgcol414' % (mt)) + tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt)) # TSIM: return -1 # TSIM: step114: # TSIM: @@ -1271,8 +1275,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 5 then @@ -1281,8 +1285,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 6 then - tdLog.info('tdSql.checkData(0, 5, 6)') - tdSql.checkData(0, 5, 6) + tdLog.info('tdSql.checkData(0, 5, "6")') + tdSql.checkData(0, 5, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 7 then @@ -1298,17 +1302,17 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) - tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step111: # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) - tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step112: # TSIM: sql select * from $mt where tgcol9 = 1 -x step113 tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt)) - tdSql.error('select * from %s where tgcol9 = 113' % (mt)) + tdSql.error('select * from %s where tgcol9 = 1' % (mt)) # TSIM: return -1 # TSIM: step113: # TSIM: @@ -1373,13 +1377,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1457,13 +1461,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 1 then - tdLog.info('tdSql.checkData(0, 3, 1)') - tdSql.checkData(0, 3, 1) + tdLog.info('tdSql.checkData(0, 3, "1")') + tdSql.checkData(0, 3, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 5 then - tdLog.info('tdSql.checkData(0, 4, 5)') - tdSql.checkData(0, 4, 5) + tdLog.info('tdSql.checkData(0, 4, "5")') + tdSql.checkData(0, 4, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then @@ -1472,8 +1476,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 3 then - tdLog.info('tdSql.checkData(0, 6, 3)') - tdSql.checkData(0, 6, 3) + tdLog.info('tdSql.checkData(0, 6, "3")') + tdSql.checkData(0, 6, "3") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 2 then @@ -1559,8 +1563,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -1574,8 +1578,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -1584,8 +1588,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1652,8 +1656,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 9 then @@ -1667,8 +1671,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 8 then - tdLog.info('tdSql.checkData(0, 5, 8)') - tdSql.checkData(0, 5, 8) + tdLog.info('tdSql.checkData(0, 5, "8")') + tdSql.checkData(0, 5, "8") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 10 then @@ -1867,13 +1871,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info('tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 6 then - tdLog.info('tdSql.checkData(0, 4, 6)') - tdSql.checkData(0, 4, 6) + tdLog.info('tdSql.checkData(0, 4, "6")') + tdSql.checkData(0, 4, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1898,13 +1902,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info(': tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 6 then - tdLog.info('tdSql.checkData(0, 4, 6)') - tdSql.checkData(0, 4, 6) + tdLog.info('tdSql.checkData(0, 4, "6")') + tdSql.checkData(0, 4, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1988,8 +1992,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 5 then - tdLog.info('tdSql.checkData(0, 3, 5)') - tdSql.checkData(0, 3, 5) + tdLog.info('tdSql.checkData(0, 3, "5")') + tdSql.checkData(0, 3, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 1 then @@ -2065,13 +2069,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 0 then @@ -2081,7 +2085,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + try: + tdSql.checkData(0, 5, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -2115,8 +2123,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 5 then @@ -2125,8 +2133,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 6 then - tdLog.info('tdSql.checkData(0, 5, 6)') - tdSql.checkData(0, 5, 6) + tdLog.info('tdSql.checkData(0, 5, "6")') + tdSql.checkData(0, 5, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 7 then @@ -2171,13 +2179,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 1 then - tdLog.info('tdSql.checkData(0, 3, 1)') - tdSql.checkData(0, 3, 1) + tdLog.info('tdSql.checkData(0, 3, "1")') + tdSql.checkData(0, 3, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 5 then - tdLog.info('tdSql.checkData(0, 4, 5)') - tdSql.checkData(0, 4, 5) + tdLog.info('tdSql.checkData(0, 4, "5")') + tdSql.checkData(0, 4, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then @@ -2186,8 +2194,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 3 then - tdLog.info('tdSql.checkData(0, 6, 3)') - tdSql.checkData(0, 6, 3) + tdLog.info('tdSql.checkData(0, 6, "3")') + tdSql.checkData(0, 6, "3") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 2 then @@ -2257,8 +2265,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 9 then @@ -2272,8 +2280,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 8 then - tdLog.info('tdSql.checkData(0, 5, 8)') - tdSql.checkData(0, 5, 8) + tdLog.info('tdSql.checkData(0, 5, "8")') + tdSql.checkData(0, 5, "8") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 10 then @@ -2290,8 +2298,8 @@ class TDTestCase: # TSIM: print =============== clear tdLog.info('=============== clear') # TSIM: sql drop database $db - tdLog.info('sql drop database $db') - tdSql.execute('sql drop database $db') + tdLog.info('drop database db') + tdSql.execute('drop database db') # TSIM: sql show databases tdLog.info('show databases') tdSql.query('show databases') From 95eb1466b08861d2b64ff190df2448c951d9915a Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 06:34:55 +0000 Subject: [PATCH 16/33] add rpc debug info --- CMakeFiles/feature_tests.bin | Bin 0 -> 12312 bytes CMakeFiles/feature_tests.c | 34 +++ CMakeFiles/feature_tests.cxx | 405 +++++++++++++++++++++++++++++++++++ src/rpc/src/rpcMain.c | 1 + 4 files changed, 440 insertions(+) create mode 100755 CMakeFiles/feature_tests.bin create mode 100644 CMakeFiles/feature_tests.c create mode 100644 CMakeFiles/feature_tests.cxx diff --git a/CMakeFiles/feature_tests.bin b/CMakeFiles/feature_tests.bin new file mode 100755 index 0000000000000000000000000000000000000000..ae0f49908c89c0ae48d68d46e0157414893eb334 GIT binary patch literal 12312 zcmeHNZ;%{C74N;hOD=G?w+TTmBqkdSny9y2LK2QYf!q6+IlTl7cNmp0%+Ad24eZVy zvoql?qFfoEvcO3ct3*Cv%JPGye28CE#G*D8pe(AW3RofvmJ~782|(@Qq(|vdU&_F{Z!YD=AwG2z;B|g$ED%v-R43KWt#g@VE z8n&7tTO-H(`fi^`$JY9CM9ac3qV#M z_N~ccA-RP=H|j^;ox4Z4A=uyKTC{m3{3C|-Z>+xi>cjDCE+pF{W-0t1j!!nT^(&V(H#W8&YGmD5w+#NVou2;Rp1y5a?@Ldf{PtZfSAF;V$3K6v z{DBuiJDqf;4Fkc%JGX>dkEJ6Pk^2<|5pKD&e|Awktd3q`=PXg zwXzv>G9=R{oFZNpLG>Ade;;U^T~uf1rvOL(=Y*d1g8w@lKaWj@g7dS2|5jlS#m07y z$CyC_N$6n^Z#st8cBZQOxTa<-TgzDoOekWNT68tXRr8u<6QUPA(6`R=uKW1hs>57c|%iri(=q z$L6Gs?Hn5H=~cHRwwFx$3EQLeS^%d$!n)}Ij$@V5OaP}C!@Ai39-P0GgQuI72b%V+ zN-*W#vfEHOp&Wd=`8cU#m2Hjj+b_zN&rEhZ&K{(2X>lIyGKReS8Z2mOTruHPxO_H77ei zziFr>u^>~vu-`mK02pQt8XpU))CRbwGUS7=< zoI5qgfDq7g$SLmy=);_)gT4j(3i=b?Fld%zLFSw~A#CQHEb$$Gan|=NdRw&&({`1s~Prw!S_vg}dQfiZi|9VSMz2*Z93d037eP8 zjkyxfLx?*LbWOd8quE&#qfJ(IC#**t^zr;tiDPD9S!C;`dI!uI*zpTSzhmaKabV%Y zNInAvCIg661BM#JzQj5!JL;-nea=+Vj;7ykx{^?J_G>v0Cm3O+grx}aSjY&+*0&@4 zt`&=>Bk37%5cVpL*;?J3@l8YTjJXUB`#j7Mvf0BObxh5G2!VjAH^g-`3t~BYj@i<) zExllv3v?N9K!4}wh9I9^>KpWIhgaFtwjK&_Mb>zMNx z7~7ie6c%D2cNWisSA1l3^lIE|;d*o9nM&ml&@P}yfhs`v0^ReEO6Au;$AL}*od((| z7N@v>#1uKOhegKYk<~3rn-52p#t~lw|I_bPDzs-oJ~=;Q8wCF&z>j-L7K;zW+CSHJ z{+-Q}?7EAu{`BP=_;wBDVfn-+fsfYC$c}B@4FBH%o7W?dipB41=xtqcGZ+L#l(`H3 z4?#WOTlK`^4>k0}+P@j?k0quWdtw_OY*J#K_bpLkT?d!$igi1&u2ifu72DVoO8_76 z_r#j{KKE(Ra}@Lh*WmyyrbQ1ddSKB5iym0?z@i5hJ+SD3MGq``V9^6o577Alod<~R zRP~#Gi;$x8npRP!^O#klOy{PnMVa+p|gM=H6kj` zT7k}rdfY2wdch|Q&(AQm`-EL6C=oh~D2ww3aqPj$q9L-QEClcj5fkZK>ldr`{;T5K z3x49F@I{>4e?;hm5AVE8ew-2I1ET(YQ6{^D`u`uH^XQMLkxAZ#iPuXY;L1)qD=8p%imOu zlUjTUqj;*tmon;?TD+N2f7as5s&P|`*Pmx%eH5beNa&o?$6MG@DL!|;TB~1j{>k;v zo!{2-$E)`QYVqal7yP3}5JfvzRL>2AHBoj!b==nC@byCyXHgh^G|p=I>(8IDJ}Nmk z_Hi10b6RjbHL`aqbBLeA`KbZVt3&?8Lw&?MX}}A?^#Z5)PQdI6$V3A6(D)tTc)cI; zLJ!TKq-TQj*ZcDkz-9LTnDe)>BVrO)~w@@Y)r1{rD2# z5x5sX3D;j$3rSOeU$bxhoT@ zn^$$bG*QHx5(PDzE2QDr#K0pkI4K-wbQowPuh@QNmz;@T#(+~lN1K2z?yfVzGWa!J zHN1R&0z?8O|J0_2)zt6=2fjoX-C`2H&NKDPLtPmkMXLt(q;~bI{k!{AxUo?ykJmGd zVnH3%Yy+=+^nGb}YS&m%1a6}Ew_)bJj#7J(rq%+MEKcNIEe+Ild^$=w z3l5o`F_yFou9-~r40gC$R+O@~mrQ#WTnn=dmc-JiRvcwXW5Nb~K6M?xMjTJq6jZ3g zQzjH(Nq)a3IhJ!7{v@*n$l&=lOY(a?NvFUs?*?$WzIe_XEzCpgbto@|F(f z;N71jT-{+wh~PX#rDUl5PY|w)VTe_4H_$qWD6NZ0Ir0Y6C!m0@2AUUXy+kw-WQM$0 zK3CDrkPFJwx{BzADyN?b%l82cM-2sPpVnVQ@yr90SmsvO%Rb83Zph$To#balhUii8 zz&Pz;me%F861WL4Tr-nAt>=i+egIf_3j6OCKyhtO^0e+FO3zRB6CcsrK_1uoRHpSI z(FAYR->(Gi7ce^j8T2X1mqkNWDj2E#@bljT^{AJYIkX=mdXbPPf^7v8-s=m>9}$X( zhL?p@Ci+lFp4P8K$zE!c%0zMf6KuaM+9!(d&tRf<3407OL3!GL5~Y0`@rR%PheDqG zKPe0&dM30^Opqc$9}mfg@8ez*;t#j~%aA;+!-+PBo}c_iYM+J-u4!rCNb4}VryJ&{ zGSL$t+ZK?g{rIf7|4e+q!V{H=z6vOI8MR+s|BDTBS=dkUNpjSW4}&bSkUZ@Z%Ig4x z)XjhAen_6^DX0p{SJ!0;UxwNt4J1e9Hz9)Wx>oj!Z@m*h89 z5kEunK}xX~WbID)r4wS{= 304 +"1" +#else +"0" +#endif +"c_function_prototypes\n" +"C_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +"1" +#else +"0" +#endif +"c_restrict\n" +"C_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L +"1" +#else +"0" +#endif +"c_static_assert\n" +"C_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +"1" +#else +"0" +#endif +"c_variadic_macros\n" + +}; + +int main(int argc, char** argv) { (void)argv; return features[argc]; } diff --git a/CMakeFiles/feature_tests.cxx b/CMakeFiles/feature_tests.cxx new file mode 100644 index 0000000000..b93418c6ed --- /dev/null +++ b/CMakeFiles/feature_tests.cxx @@ -0,0 +1,405 @@ + + const char features[] = {"\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L +"1" +#else +"0" +#endif +"cxx_aggregate_default_initializers\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_alias_templates\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_alignas\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_alignof\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_attributes\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_attribute_deprecated\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_auto_type\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_binary_literals\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_constexpr\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_contextual_conversions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_decltype\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_decltype_auto\n" +"CXX_FEATURE:" +#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_decltype_incomplete_return_types\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_default_function_template_args\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_defaulted_functions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_defaulted_move_initializers\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_delegating_constructors\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_deleted_functions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_digit_separators\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_enum_forward_declarations\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_explicit_conversions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_extended_friend_declarations\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_extern_templates\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_final\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_func_identifier\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_generalized_initializers\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_generic_lambdas\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_inheriting_constructors\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_inline_namespaces\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_lambdas\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_lambda_init_captures\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_local_type_template_args\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_long_long_type\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_noexcept\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_nonstatic_member_init\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_nullptr\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_override\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_range_for\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_raw_string_literals\n" +"CXX_FEATURE:" +#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_reference_qualified_functions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L +"1" +#else +"0" +#endif +"cxx_relaxed_constexpr\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L +"1" +#else +"0" +#endif +"cxx_return_type_deduction\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_right_angle_brackets\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_rvalue_references\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_sizeof_member\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_static_assert\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_strong_enums\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus +"1" +#else +"0" +#endif +"cxx_template_template_parameters\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_thread_local\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_trailing_return_types\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_unicode_literals\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_uniform_initialization\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_unrestricted_unions\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L +"1" +#else +"0" +#endif +"cxx_user_literals\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L +"1" +#else +"0" +#endif +"cxx_variable_templates\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_variadic_macros\n" +"CXX_FEATURE:" +#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) +"1" +#else +"0" +#endif +"cxx_variadic_templates\n" + +}; + +int main(int argc, char** argv) { (void)argv; return features[argc]; } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index f05416c0cd..9bb63b751a 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -695,6 +695,7 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, SRecvInfo *pRecv) { if (pConn) { if (pConn->linkUid != pHead->linkUid) { terrno = TSDB_CODE_RPC_MISMATCHED_LINK_ID; + tError("%s %p %p, linkUid:0x%x is not matched with received:0x%x", pRpc->label, pConn, pHead->ahandle, pConn->linkUid, pHead->linkUid); pConn = NULL; } } From d4c4b389f4bc7c956c281817b5d651dd675852e4 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 14:38:11 +0800 Subject: [PATCH 17/33] add tag_lite/datatype.py back to regression list. --- tests/pytest/regressiontest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index cdb0192c70..22cc9d9af2 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -40,7 +40,7 @@ python3 ./test.py -f tag_lite/change.py python3 ./test.py -f tag_lite/column.py python3 ./test.py -f tag_lite/commit.py python3 ./test.py -f tag_lite/create.py -# python3 ./test.py -f tag_lite/datatype.py +python3 ./test.py -f tag_lite/datatype.py python3 ./test.py -f tag_lite/datatype-without-alter.py # python3 ./test.py -f tag_lite/delete.py python3 ./test.py -f tag_lite/double.py From ba07f51b33d7bbed47c2a862d69a7c51ae220562 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 06:40:13 +0000 Subject: [PATCH 18/33] remove junk files --- CMakeFiles/feature_tests.bin | Bin 12312 -> 0 bytes CMakeFiles/feature_tests.c | 34 --- CMakeFiles/feature_tests.cxx | 405 ----------------------------------- 3 files changed, 439 deletions(-) delete mode 100755 CMakeFiles/feature_tests.bin delete mode 100644 CMakeFiles/feature_tests.c delete mode 100644 CMakeFiles/feature_tests.cxx diff --git a/CMakeFiles/feature_tests.bin b/CMakeFiles/feature_tests.bin deleted file mode 100755 index ae0f49908c89c0ae48d68d46e0157414893eb334..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12312 zcmeHNZ;%{C74N;hOD=G?w+TTmBqkdSny9y2LK2QYf!q6+IlTl7cNmp0%+Ad24eZVy zvoql?qFfoEvcO3ct3*Cv%JPGye28CE#G*D8pe(AW3RofvmJ~782|(@Qq(|vdU&_F{Z!YD=AwG2z;B|g$ED%v-R43KWt#g@VE z8n&7tTO-H(`fi^`$JY9CM9ac3qV#M z_N~ccA-RP=H|j^;ox4Z4A=uyKTC{m3{3C|-Z>+xi>cjDCE+pF{W-0t1j!!nT^(&V(H#W8&YGmD5w+#NVou2;Rp1y5a?@Ldf{PtZfSAF;V$3K6v z{DBuiJDqf;4Fkc%JGX>dkEJ6Pk^2<|5pKD&e|Awktd3q`=PXg zwXzv>G9=R{oFZNpLG>Ade;;U^T~uf1rvOL(=Y*d1g8w@lKaWj@g7dS2|5jlS#m07y z$CyC_N$6n^Z#st8cBZQOxTa<-TgzDoOekWNT68tXRr8u<6QUPA(6`R=uKW1hs>57c|%iri(=q z$L6Gs?Hn5H=~cHRwwFx$3EQLeS^%d$!n)}Ij$@V5OaP}C!@Ai39-P0GgQuI72b%V+ zN-*W#vfEHOp&Wd=`8cU#m2Hjj+b_zN&rEhZ&K{(2X>lIyGKReS8Z2mOTruHPxO_H77ei zziFr>u^>~vu-`mK02pQt8XpU))CRbwGUS7=< zoI5qgfDq7g$SLmy=);_)gT4j(3i=b?Fld%zLFSw~A#CQHEb$$Gan|=NdRw&&({`1s~Prw!S_vg}dQfiZi|9VSMz2*Z93d037eP8 zjkyxfLx?*LbWOd8quE&#qfJ(IC#**t^zr;tiDPD9S!C;`dI!uI*zpTSzhmaKabV%Y zNInAvCIg661BM#JzQj5!JL;-nea=+Vj;7ykx{^?J_G>v0Cm3O+grx}aSjY&+*0&@4 zt`&=>Bk37%5cVpL*;?J3@l8YTjJXUB`#j7Mvf0BObxh5G2!VjAH^g-`3t~BYj@i<) zExllv3v?N9K!4}wh9I9^>KpWIhgaFtwjK&_Mb>zMNx z7~7ie6c%D2cNWisSA1l3^lIE|;d*o9nM&ml&@P}yfhs`v0^ReEO6Au;$AL}*od((| z7N@v>#1uKOhegKYk<~3rn-52p#t~lw|I_bPDzs-oJ~=;Q8wCF&z>j-L7K;zW+CSHJ z{+-Q}?7EAu{`BP=_;wBDVfn-+fsfYC$c}B@4FBH%o7W?dipB41=xtqcGZ+L#l(`H3 z4?#WOTlK`^4>k0}+P@j?k0quWdtw_OY*J#K_bpLkT?d!$igi1&u2ifu72DVoO8_76 z_r#j{KKE(Ra}@Lh*WmyyrbQ1ddSKB5iym0?z@i5hJ+SD3MGq``V9^6o577Alod<~R zRP~#Gi;$x8npRP!^O#klOy{PnMVa+p|gM=H6kj` zT7k}rdfY2wdch|Q&(AQm`-EL6C=oh~D2ww3aqPj$q9L-QEClcj5fkZK>ldr`{;T5K z3x49F@I{>4e?;hm5AVE8ew-2I1ET(YQ6{^D`u`uH^XQMLkxAZ#iPuXY;L1)qD=8p%imOu zlUjTUqj;*tmon;?TD+N2f7as5s&P|`*Pmx%eH5beNa&o?$6MG@DL!|;TB~1j{>k;v zo!{2-$E)`QYVqal7yP3}5JfvzRL>2AHBoj!b==nC@byCyXHgh^G|p=I>(8IDJ}Nmk z_Hi10b6RjbHL`aqbBLeA`KbZVt3&?8Lw&?MX}}A?^#Z5)PQdI6$V3A6(D)tTc)cI; zLJ!TKq-TQj*ZcDkz-9LTnDe)>BVrO)~w@@Y)r1{rD2# z5x5sX3D;j$3rSOeU$bxhoT@ zn^$$bG*QHx5(PDzE2QDr#K0pkI4K-wbQowPuh@QNmz;@T#(+~lN1K2z?yfVzGWa!J zHN1R&0z?8O|J0_2)zt6=2fjoX-C`2H&NKDPLtPmkMXLt(q;~bI{k!{AxUo?ykJmGd zVnH3%Yy+=+^nGb}YS&m%1a6}Ew_)bJj#7J(rq%+MEKcNIEe+Ild^$=w z3l5o`F_yFou9-~r40gC$R+O@~mrQ#WTnn=dmc-JiRvcwXW5Nb~K6M?xMjTJq6jZ3g zQzjH(Nq)a3IhJ!7{v@*n$l&=lOY(a?NvFUs?*?$WzIe_XEzCpgbto@|F(f z;N71jT-{+wh~PX#rDUl5PY|w)VTe_4H_$qWD6NZ0Ir0Y6C!m0@2AUUXy+kw-WQM$0 zK3CDrkPFJwx{BzADyN?b%l82cM-2sPpVnVQ@yr90SmsvO%Rb83Zph$To#balhUii8 zz&Pz;me%F861WL4Tr-nAt>=i+egIf_3j6OCKyhtO^0e+FO3zRB6CcsrK_1uoRHpSI z(FAYR->(Gi7ce^j8T2X1mqkNWDj2E#@bljT^{AJYIkX=mdXbPPf^7v8-s=m>9}$X( zhL?p@Ci+lFp4P8K$zE!c%0zMf6KuaM+9!(d&tRf<3407OL3!GL5~Y0`@rR%PheDqG zKPe0&dM30^Opqc$9}mfg@8ez*;t#j~%aA;+!-+PBo}c_iYM+J-u4!rCNb4}VryJ&{ zGSL$t+ZK?g{rIf7|4e+q!V{H=z6vOI8MR+s|BDTBS=dkUNpjSW4}&bSkUZ@Z%Ig4x z)XjhAen_6^DX0p{SJ!0;UxwNt4J1e9Hz9)Wx>oj!Z@m*h89 z5kEunK}xX~WbID)r4wS{= 304 -"1" -#else -"0" -#endif -"c_function_prototypes\n" -"C_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -"1" -#else -"0" -#endif -"c_restrict\n" -"C_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L -"1" -#else -"0" -#endif -"c_static_assert\n" -"C_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -"1" -#else -"0" -#endif -"c_variadic_macros\n" - -}; - -int main(int argc, char** argv) { (void)argv; return features[argc]; } diff --git a/CMakeFiles/feature_tests.cxx b/CMakeFiles/feature_tests.cxx deleted file mode 100644 index b93418c6ed..0000000000 --- a/CMakeFiles/feature_tests.cxx +++ /dev/null @@ -1,405 +0,0 @@ - - const char features[] = {"\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L -"1" -#else -"0" -#endif -"cxx_aggregate_default_initializers\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_alias_templates\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_alignas\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_alignof\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_attributes\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_attribute_deprecated\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_auto_type\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_binary_literals\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_constexpr\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_contextual_conversions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_decltype\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_decltype_auto\n" -"CXX_FEATURE:" -#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_decltype_incomplete_return_types\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_default_function_template_args\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_defaulted_functions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_defaulted_move_initializers\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_delegating_constructors\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_deleted_functions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_digit_separators\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_enum_forward_declarations\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_explicit_conversions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_extended_friend_declarations\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_extern_templates\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_final\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_func_identifier\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_generalized_initializers\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_generic_lambdas\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_inheriting_constructors\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_inline_namespaces\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_lambdas\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_lambda_init_captures\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_local_type_template_args\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_long_long_type\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_noexcept\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_nonstatic_member_init\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_nullptr\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_override\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_range_for\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_raw_string_literals\n" -"CXX_FEATURE:" -#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_reference_qualified_functions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L -"1" -#else -"0" -#endif -"cxx_relaxed_constexpr\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L -"1" -#else -"0" -#endif -"cxx_return_type_deduction\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_right_angle_brackets\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_rvalue_references\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_sizeof_member\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_static_assert\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_strong_enums\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus -"1" -#else -"0" -#endif -"cxx_template_template_parameters\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_thread_local\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_trailing_return_types\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_unicode_literals\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_uniform_initialization\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_unrestricted_unions\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L -"1" -#else -"0" -#endif -"cxx_user_literals\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L -"1" -#else -"0" -#endif -"cxx_variable_templates\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_variadic_macros\n" -"CXX_FEATURE:" -#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) -"1" -#else -"0" -#endif -"cxx_variadic_templates\n" - -}; - -int main(int argc, char** argv) { (void)argv; return features[argc]; } From f3de9986825340db4a3277cb4bfd1cc0f05d3ff6 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 15:22:58 +0800 Subject: [PATCH 19/33] [TD-421] --- src/client/src/tscLocal.c | 22 +++++++++++----------- src/common/inc/tdataformat.h | 2 +- src/mnode/src/mnodeDb.c | 2 +- src/mnode/src/mnodeDnode.c | 2 +- src/mnode/src/mnodeMnode.c | 6 +++--- src/mnode/src/mnodeTable.c | 10 +++++----- src/mnode/src/mnodeUser.c | 5 ++--- src/mnode/src/mnodeVgroup.c | 4 ++-- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index eaf9c21bfb..a880f4487e 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -132,14 +132,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { for (int32_t i = 0; i < numOfRows; ++i) { TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); char* dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i; - STR_WITH_MAXSIZE_TO_VARSTR(dst, pSchema[i].name, TSDB_COL_NAME_LEN - 1); + STR_WITH_MAXSIZE_TO_VARSTR(dst, pSchema[i].name, pField->bytes); char *type = tDataTypeDesc[pSchema[i].type].aName; pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1); dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * totalNumOfRows + pField->bytes * i; - STR_TO_VARSTR(dst, type); + STR_WITH_MAXSIZE_TO_VARSTR(dst, type, pField->bytes); int32_t bytes = pSchema[i].bytes; if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { @@ -157,7 +157,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; const char *src = "TAG"; - STR_WITH_SIZE_TO_VARSTR(output, src, strlen(src)); + STR_WITH_MAXSIZE_TO_VARSTR(output, src, pField->bytes); } } @@ -171,7 +171,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // field name TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i; - STR_WITH_MAXSIZE_TO_VARSTR(output, pSchema[i].name, TSDB_COL_NAME_LEN - 1); + STR_WITH_MAXSIZE_TO_VARSTR(output, pSchema[i].name, pField->bytes); // type name pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1); @@ -193,7 +193,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; const char *src = "TAG"; - STR_WITH_SIZE_TO_VARSTR(target, src, strlen(src)); + STR_WITH_MAXSIZE_TO_VARSTR(target, src, pField->bytes); pTagValue += pSchema[i].bytes; } @@ -220,15 +220,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols, rowLen += ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE); - f.bytes = typeColLength; + f.bytes = typeColLength + VARSTR_HEADER_SIZE; f.type = TSDB_DATA_TYPE_BINARY; tstrncpy(f.name, "Type", sizeof(f.name)); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); - pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, typeColLength, + pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, typeColLength + VARSTR_HEADER_SIZE, typeColLength, false); - rowLen += typeColLength; + rowLen += typeColLength + VARSTR_HEADER_SIZE; f.bytes = sizeof(int32_t); f.type = TSDB_DATA_TYPE_INT; @@ -240,15 +240,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols, rowLen += sizeof(int32_t); - f.bytes = noteColLength; + f.bytes = noteColLength + VARSTR_HEADER_SIZE; f.type = TSDB_DATA_TYPE_BINARY; tstrncpy(f.name, "Note", sizeof(f.name)); pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); - pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, noteColLength, + pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, noteColLength + VARSTR_HEADER_SIZE, noteColLength, false); - rowLen += noteColLength; + rowLen += noteColLength + VARSTR_HEADER_SIZE; return rowLen; } diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index ea0eb9ff29..3ad2df8d3a 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -36,7 +36,7 @@ extern "C" { #define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \ do { \ - char *_e = stpncpy(varDataVal(x), (str), (_maxs)); \ + char *_e = stpncpy(varDataVal(x), (str), (_maxs)-VARSTR_HEADER_SIZE); \ varDataSetLen(x, (_e - (x)-VARSTR_HEADER_SIZE)); \ } while (0) diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 69783defc7..aeb6f4beb9 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -613,7 +613,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; char* name = mnodeGetDbStr(pDb->name); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, TSDB_DB_NAME_LEN - 1); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 88f2c74778..fda3f48da5 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -593,7 +593,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index 43ee45f3b1..41bd6974db 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -401,9 +401,9 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId); if (pDnode != NULL) { - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]); } else { - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, "invalid ep", pShow->bytes[cols] - VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, "invalid ep", pShow->bytes[cols]); } mnodeDecDnodeRef(pDnode); @@ -411,7 +411,7 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; char* roles = mnodeGetMnodeRoleStr(pMnode->role); - STR_TO_VARSTR(pWrite, roles); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, roles, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 0ff198bf8f..a2deeaa489 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -2103,7 +2103,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void cols++; SSchema tbCol = tGetTableNameColumnSchema(); - pShow->bytes[cols] = tbCol.bytes; + pShow->bytes[cols] = tbCol.bytes + VARSTR_HEADER_SIZE; pSchema[cols].type = tbCol.type; strcpy(pSchema[cols].name, "stable_name"); pSchema[cols].bytes = htons(pShow->bytes[cols]); @@ -2161,7 +2161,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -2182,7 +2182,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows memset(tableName, 0, sizeof(tableName)); if (pTable->info.type == TSDB_CHILD_TABLE) { mnodeExtractTableName(pTable->superTable->info.tableId, tableName); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]); } cols++; @@ -2352,7 +2352,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, sizeof(tableName) - 1); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -2364,7 +2364,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pTable->sql, TSDB_MAX_SQL_SHOW_LEN); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pTable->sql, pShow->bytes[cols]); cols++; numOfRows++; diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c index 95457c83a0..053ea3ef75 100644 --- a/src/mnode/src/mnodeUser.c +++ b/src/mnode/src/mnodeUser.c @@ -315,8 +315,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - size_t size = sizeof(pUser->user); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -337,7 +336,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, sizeof(pUser->user)); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->acct, pShow->bytes[cols]); cols++; numOfRows++; diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 25b9daf00c..bc6c2665c8 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -479,12 +479,12 @@ int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pC if (pDnode != NULL) { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; char *role = mnodeGetMnodeRoleStr(pVgroup->vnodeGid[i].role); - STR_TO_VARSTR(pWrite, role); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, role, pShow->bytes[cols]); cols++; } else { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; From ba60b4bd1b574861f94b8234e5aef09644f87289 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 16:34:39 +0800 Subject: [PATCH 20/33] modify format by autopep8. --- tests/pytest/query/filterAllIntTypes.py | 50 ++-- tests/pytest/query/filterFloatAndDouble.py | 36 +-- tests/pytest/query/filterOtherTypes.py | 141 +++++------ tests/pytest/query/querySort.py | 60 ++--- tests/pytest/random-test/random-test.py | 2 + tests/pytest/table/tablename-boundary.py | 5 +- tests/pytest/tag_lite/change.py | 16 +- tests/pytest/tag_lite/delete.py | 262 ++++++++++++--------- tests/pytest/util/sql.py | 36 +-- 9 files changed, 341 insertions(+), 267 deletions(-) diff --git a/tests/pytest/query/filterAllIntTypes.py b/tests/pytest/query/filterAllIntTypes.py index 32e635d6da..cf65d2b102 100644 --- a/tests/pytest/query/filterAllIntTypes.py +++ b/tests/pytest/query/filterAllIntTypes.py @@ -22,12 +22,12 @@ class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) - + self.powers = [7, 15, 31, 63] self.types = ["tinyint", "smallint", "int", "bigint"] self.rowNum = 10 - self.ts = 1537146000000 - + self.ts = 1537146000000 + def run(self): tdSql.prepare() @@ -35,20 +35,30 @@ class TDTestCase: curType = self.types[i] print("======= Verify filter for %s type =========" % (curType)) tdLog.debug( - "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) + "create table st%s(ts timestamp, num %s) tags(id %s)" % + (curType, curType, curType)) tdSql.execute( - "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) - - #create 10 tables, insert 10 rows for each table - for j in range(self.rowNum): - tdSql.execute("create table st%s%d using st%s tags(%d)" % (curType, j + 1, curType, j + 1)) - for k in range(self.rowNum): - tdSql.execute("insert into st%s%d values(%d, %d)" % (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) - - tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 11, pow(2, self.powers[i]))) - tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) - tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 13, pow(-2, self.powers[i]))) - tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) + "create table st%s(ts timestamp, num %s) tags(id %s)" % + (curType, curType, curType)) + + # create 10 tables, insert 10 rows for each table + for j in range(self.rowNum): + tdSql.execute( + "create table st%s%d using st%s tags(%d)" % + (curType, j + 1, curType, j + 1)) + for k in range(self.rowNum): + tdSql.execute( + "insert into st%s%d values(%d, %d)" % + (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) + + tdSql.error("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 11, pow(2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) + tdSql.error("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 13, pow(-2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) # > for int type on column tdSql.query("select * from st%s where num > 50" % curType) @@ -104,10 +114,12 @@ class TDTestCase: # != for int type on tag tdSql.query("select * from st%s where id != 5" % curType) - tdSql.checkRows(92) + tdSql.checkRows(92) + + print( + "======= Verify filter for %s type finished =========" % + curType) - print("======= Verify filter for %s type finished =========" % curType) - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/filterFloatAndDouble.py b/tests/pytest/query/filterFloatAndDouble.py index bea41be11c..bd349a2a25 100644 --- a/tests/pytest/query/filterFloatAndDouble.py +++ b/tests/pytest/query/filterFloatAndDouble.py @@ -21,28 +21,28 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor()) self.rowNum = 10 self.ts = 1537146000000 - + def run(self): tdSql.prepare() print("======= Verify filter for float and double type =========") tdLog.debug( - "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") tdSql.execute( - "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") - - for j in range(self.rowNum): - tdSql.execute( - "insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % (self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + + for j in range(self.rowNum): + tdSql.execute("insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % ( + self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) # > for float type on column tdSql.query("select * from st where num > 5.5") tdSql.checkRows(5) - + # >= for float type on column tdSql.query("select * from st where num >= 5.5") tdSql.checkRows(6) @@ -70,11 +70,11 @@ class TDTestCase: # > for float type on tag tdSql.query("select * from st where tagcol1 > 1.1") tdSql.checkRows(0) - + # >= for float type on tag tdSql.query("select * from st where tagcol1 >= 1.1") tdSql.checkRows(10) - + # = for float type on tag tdSql.query("select * from st where tagcol1 = 1.1") tdSql.checkRows(10) @@ -86,7 +86,7 @@ class TDTestCase: # != for float type on tag tdSql.query("select * from st where tagcol1 != 1.1") tdSql.checkRows(0) - + # <= for float type on tag tdSql.query("select * from st where tagcol1 <= 1.1") tdSql.checkRows(10) @@ -94,11 +94,11 @@ class TDTestCase: # < for float type on tag tdSql.query("select * from st where tagcol1 < 1.1") tdSql.checkRows(0) - + # > for double type on column tdSql.query("select * from st where speed > 11.5") tdSql.checkRows(5) - + # >= for double type on column tdSql.query("select * from st where speed >= 11.5") tdSql.checkRows(6) @@ -126,11 +126,11 @@ class TDTestCase: # > for double type on tag tdSql.query("select * from st where tagcol2 > 2.3") tdSql.checkRows(0) - + # >= for double type on tag tdSql.query("select * from st where tagcol2 >= 2.3") tdSql.checkRows(10) - + # = for double type on tag tdSql.query("select * from st where tagcol2 = 2.3") tdSql.checkRows(10) @@ -142,7 +142,7 @@ class TDTestCase: # != for double type on tag tdSql.query("select * from st where tagcol2 != 2.3") tdSql.checkRows(0) - + # <= for double type on tag tdSql.query("select * from st where tagcol2 <= 2.3") tdSql.checkRows(10) @@ -150,7 +150,7 @@ class TDTestCase: # < for double type on tag tdSql.query("select * from st where tagcol2 < 2.3") tdSql.checkRows(0) - + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/filterOtherTypes.py b/tests/pytest/query/filterOtherTypes.py index f09ac596c7..bc7df18c8d 100644 --- a/tests/pytest/query/filterOtherTypes.py +++ b/tests/pytest/query/filterOtherTypes.py @@ -21,33 +21,39 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - + tdSql.init(conn.cursor()) + self.ts = 1537146000000 - + def run(self): tdSql.prepare() - + print("======= Verify filter for bool, nchar and binary type =========") tdLog.debug( "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") tdSql.execute( - "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") tdSql.execute("create table st1 using st tags(true, 'table1', '水表')") - for i in range(1, 6): - tdSql.execute("insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + for i in range(1, 6): + tdSql.execute( + "insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % + (self.ts + i, i % + 2, i, i)) tdSql.execute("create table st2 using st tags(false, 'table2', '电表')") - for i in range(6, 11): - tdSql.execute("insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + for i in range(6, 11): + tdSql.execute( + "insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % + (self.ts + i, i % + 2, i, i)) # =============Verify stable columns==================== # > for bool type on column tdSql.error("select * from st where tbcol1 > false") # >= for bool type on column - tdSql.error("select * from st where tbcol1 >= false") + tdSql.error("select * from st where tbcol1 >= false") # = for bool type on column tdSql.query("select * from st where tbcol1 = false") @@ -77,18 +83,18 @@ class TDTestCase: tdSql.error("select * from st where tbcol2 > 'taosdata'") # >= for nchar type on column - tdSql.error("select * from st where tbcol2 >= 'taosdata'") + tdSql.error("select * from st where tbcol2 >= 'taosdata'") # = for nchar type on column tdSql.query("select * from st where tbcol2 = 'taosdata1'") tdSql.checkRows(1) # <> for nchar type on column - tdSql.query("select * from st where tbcol2 <> 'taosdata1'") + tdSql.query("select * from st where tbcol2 <> 'taosdata1'") tdSql.checkRows(9) # != for nchar type on column - tdSql.query("select * from st where tbcol2 != 'taosdata1'") + tdSql.query("select * from st where tbcol2 != 'taosdata1'") tdSql.checkRows(9) # > for nchar type on column @@ -98,57 +104,57 @@ class TDTestCase: tdSql.error("select * from st where tbcol2 <= 'taodata'") # % for nchar type on column case 1 - tdSql.query("select * from st where tbcol2 like '%'") + tdSql.query("select * from st where tbcol2 like '%'") tdSql.checkRows(10) # % for nchar type on column case 2 - tdSql.query("select * from st where tbcol2 like 'a%'") + tdSql.query("select * from st where tbcol2 like 'a%'") tdSql.checkRows(0) # % for nchar type on column case 3 - tdSql.query("select * from st where tbcol2 like 't%_'") + tdSql.query("select * from st where tbcol2 like 't%_'") tdSql.checkRows(10) # % for nchar type on column case 4 - tdSql.query("select * from st where tbcol2 like '%1'") + tdSql.query("select * from st where tbcol2 like '%1'") # tdSql.checkRows(2) # _ for nchar type on column case 1 - tdSql.query("select * from st where tbcol2 like '____________'") - tdSql.checkRows(0) + tdSql.query("select * from st where tbcol2 like '____________'") + tdSql.checkRows(0) # _ for nchar type on column case 2 - tdSql.query("select * from st where tbcol2 like '__________'") + tdSql.query("select * from st where tbcol2 like '__________'") tdSql.checkRows(1) # _ for nchar type on column case 3 - tdSql.query("select * from st where tbcol2 like '_________'") + tdSql.query("select * from st where tbcol2 like '_________'") tdSql.checkRows(9) # _ for nchar type on column case 4 - tdSql.query("select * from st where tbcol2 like 't________'") + tdSql.query("select * from st where tbcol2 like 't________'") tdSql.checkRows(9) # _ for nchar type on column case 5 - tdSql.query("select * from st where tbcol2 like '%________'") + tdSql.query("select * from st where tbcol2 like '%________'") tdSql.checkRows(10) # > for binary type on column tdSql.error("select * from st where tbcol3 > '涛思数据'") # >= for binary type on column - tdSql.error("select * from st where tbcol3 >= '涛思数据'") + tdSql.error("select * from st where tbcol3 >= '涛思数据'") # = for binary type on column tdSql.query("select * from st where tbcol3 = '涛思数据1'") tdSql.checkRows(1) # <> for binary type on column - tdSql.query("select * from st where tbcol3 <> '涛思数据1'") + tdSql.query("select * from st where tbcol3 <> '涛思数据1'") tdSql.checkRows(9) # != for binary type on column - tdSql.query("select * from st where tbcol3 != '涛思数据1'") + tdSql.query("select * from st where tbcol3 != '涛思数据1'") tdSql.checkRows(9) # > for binary type on column @@ -158,39 +164,39 @@ class TDTestCase: tdSql.error("select * from st where tbcol3 <= '涛思数据'") # % for binary type on column case 1 - tdSql.query("select * from st where tbcol3 like '%'") + tdSql.query("select * from st where tbcol3 like '%'") tdSql.checkRows(10) # % for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '陶%'") + tdSql.query("select * from st where tbcol3 like '陶%'") tdSql.checkRows(0) # % for binary type on column case 3 - tdSql.query("select * from st where tbcol3 like '涛%_'") + tdSql.query("select * from st where tbcol3 like '涛%_'") tdSql.checkRows(10) # % for binary type on column case 4 - tdSql.query("select * from st where tbcol3 like '%1'") + tdSql.query("select * from st where tbcol3 like '%1'") tdSql.checkRows(1) # _ for binary type on column case 1 - tdSql.query("select * from st where tbcol3 like '_______'") - tdSql.checkRows(0) + tdSql.query("select * from st where tbcol3 like '_______'") + tdSql.checkRows(0) # _ for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '______'") + tdSql.query("select * from st where tbcol3 like '______'") tdSql.checkRows(1) # _ for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '_____'") + tdSql.query("select * from st where tbcol3 like '_____'") tdSql.checkRows(9) # _ for binary type on column case 3 - tdSql.query("select * from st where tbcol3 like '____'") + tdSql.query("select * from st where tbcol3 like '____'") tdSql.checkRows(0) # _ for binary type on column case 4 - tdSql.query("select * from st where tbcol3 like 't____'") + tdSql.query("select * from st where tbcol3 like 't____'") tdSql.checkRows(0) # =============Verify stable tags==================== @@ -198,7 +204,7 @@ class TDTestCase: tdSql.error("select * from st where tagcol1 > false") # >= for bool type on tag - tdSql.error("select * from st where tagcol1 >= false") + tdSql.error("select * from st where tagcol1 >= false") # = for bool type on tag tdSql.query("select * from st where tagcol1 = false") @@ -228,18 +234,18 @@ class TDTestCase: tdSql.error("select * from st where tagcol2 > 'table'") # >= for nchar type on tag - tdSql.error("select * from st where tagcol2 >= 'table'") + tdSql.error("select * from st where tagcol2 >= 'table'") # = for nchar type on tag tdSql.query("select * from st where tagcol2 = 'table1'") tdSql.checkRows(5) # <> for nchar type on tag - tdSql.query("select * from st where tagcol2 <> 'table1'") + tdSql.query("select * from st where tagcol2 <> 'table1'") tdSql.checkRows(5) # != for nchar type on tag - tdSql.query("select * from st where tagcol2 != 'table'") + tdSql.query("select * from st where tagcol2 != 'table'") tdSql.checkRows(10) # > for nchar type on tag @@ -249,57 +255,57 @@ class TDTestCase: tdSql.error("select * from st where tagcol2 <= 'table'") # % for nchar type on tag case 1 - tdSql.query("select * from st where tagcol2 like '%'") + tdSql.query("select * from st where tagcol2 like '%'") tdSql.checkRows(10) # % for nchar type on tag case 2 - tdSql.query("select * from st where tagcol2 like 'a%'") + tdSql.query("select * from st where tagcol2 like 'a%'") tdSql.checkRows(0) # % for nchar type on tag case 3 - tdSql.query("select * from st where tagcol2 like 't%_'") + tdSql.query("select * from st where tagcol2 like 't%_'") tdSql.checkRows(10) # % for nchar type on tag case 4 - tdSql.query("select * from st where tagcol2 like '%1'") + tdSql.query("select * from st where tagcol2 like '%1'") tdSql.checkRows(5) # _ for nchar type on tag case 1 - tdSql.query("select * from st where tagcol2 like '_______'") - tdSql.checkRows(0) + tdSql.query("select * from st where tagcol2 like '_______'") + tdSql.checkRows(0) # _ for nchar type on tag case 2 - tdSql.query("select * from st where tagcol2 like '______'") + tdSql.query("select * from st where tagcol2 like '______'") tdSql.checkRows(10) # _ for nchar type on tag case 3 - tdSql.query("select * from st where tagcol2 like 't_____'") + tdSql.query("select * from st where tagcol2 like 't_____'") tdSql.checkRows(10) # _ for nchar type on tag case 4 - tdSql.query("select * from st where tagcol2 like 's________'") + tdSql.query("select * from st where tagcol2 like 's________'") tdSql.checkRows(0) # _ for nchar type on tag case 5 - tdSql.query("select * from st where tagcol2 like '%__'") + tdSql.query("select * from st where tagcol2 like '%__'") tdSql.checkRows(10) # > for binary type on tag tdSql.error("select * from st where tagcol3 > '表'") # >= for binary type on tag - tdSql.error("select * from st where tagcol3 >= '表'") + tdSql.error("select * from st where tagcol3 >= '表'") # = for binary type on tag tdSql.query("select * from st where tagcol3 = '水表'") tdSql.checkRows(5) # <> for binary type on tag - tdSql.query("select * from st where tagcol3 <> '水表'") + tdSql.query("select * from st where tagcol3 <> '水表'") tdSql.checkRows(5) # != for binary type on tag - tdSql.query("select * from st where tagcol3 != '水表'") + tdSql.query("select * from st where tagcol3 != '水表'") tdSql.checkRows(5) # > for binary type on tag @@ -309,54 +315,53 @@ class TDTestCase: tdSql.error("select * from st where tagcol3 <= '水表'") # % for binary type on tag case 1 - tdSql.query("select * from st where tagcol3 like '%'") + tdSql.query("select * from st where tagcol3 like '%'") tdSql.checkRows(10) # % for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '水%'") + tdSql.query("select * from st where tagcol3 like '水%'") tdSql.checkRows(5) # % for binary type on tag case 3 - tdSql.query("select * from st where tagcol3 like '数%_'") + tdSql.query("select * from st where tagcol3 like '数%_'") tdSql.checkRows(0) # % for binary type on tag case 4 - tdSql.query("select * from st where tagcol3 like '%表'") + tdSql.query("select * from st where tagcol3 like '%表'") tdSql.checkRows(10) # % for binary type on tag case 5 - tdSql.query("select * from st where tagcol3 like '%据'") + tdSql.query("select * from st where tagcol3 like '%据'") tdSql.checkRows(0) # _ for binary type on tag case 1 - tdSql.query("select * from st where tagcol3 like '__'") - tdSql.checkRows(10) + tdSql.query("select * from st where tagcol3 like '__'") + tdSql.checkRows(10) # _ for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '水_'") + tdSql.query("select * from st where tagcol3 like '水_'") tdSql.checkRows(5) # _ for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '_表'") + tdSql.query("select * from st where tagcol3 like '_表'") tdSql.checkRows(10) # _ for binary type on tag case 3 - tdSql.query("select * from st where tagcol3 like '___'") + tdSql.query("select * from st where tagcol3 like '___'") tdSql.checkRows(0) # _ for binary type on tag case 4 - tdSql.query("select * from st where tagcol3 like '数_'") + tdSql.query("select * from st where tagcol3 like '数_'") tdSql.checkRows(0) # _ for binary type on tag case 5 - tdSql.query("select * from st where tagcol3 like '_据'") + tdSql.query("select * from st where tagcol3 like '_据'") tdSql.checkRows(0) - + def stop(self): tdSql.close() - tdLog.success("%s successfully executed" % __file__) + tdLog.success("%s successfully executed" % __file__) tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) - diff --git a/tests/pytest/query/querySort.py b/tests/pytest/query/querySort.py index bb806c27bc..3858701379 100644 --- a/tests/pytest/query/querySort.py +++ b/tests/pytest/query/querySort.py @@ -21,56 +21,60 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor()) self.rowNum = 10 self.ts = 1537146000000 - + def run(self): tdSql.prepare() print("======= step 1: create table and insert data =========") tdLog.debug( - ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, - tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, + ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, + tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') tdSql.execute( - ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, - tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, + ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, + tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') - - for i in range(self.rowNum): - tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), - 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1)) - for j in range(self.rowNum): - tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (i + 1, self.ts + 10 * (i + 1) + j + 1, - j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1)) - - print("======= step 2: verify order for each column =========") - # sort for timestamp in asc order + for i in range(self.rowNum): + tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % ( + i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1)) + for j in range(self.rowNum): + tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % ( + i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1)) + + print("======= step 2: verify order for each column =========") + # sort for timestamp in asc order tdSql.query("select * from st order by ts asc") tdSql.checkColumnSorted(0, "asc") - # sort for timestamp in desc order + # sort for timestamp in desc order tdSql.query("select * from st order by ts desc") tdSql.checkColumnSorted(0, "desc") + for i in range(1, 10): + tdSql.error("select * from st order by tbcol%d" % i) + tdSql.error("select * from st order by tbcol%d asc" % i) + tdSql.error("select * from st order by tbcol%d desc" % i) - for i in range(1, 10): - tdSql.error("select * from st order by tbcol%d" % i) - tdSql.error("select * from st order by tbcol%d asc" % i) - tdSql.error("select * from st order by tbcol%d desc" % i) - - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d" % (i, i)) + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d" % + (i, i)) tdSql.checkColumnSorted(1, "") - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" % (i, i)) + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" % + (i, i)) tdSql.checkColumnSorted(1, "asc") - - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" % (i, i)) - tdSql.checkColumnSorted(1, "desc") - + + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" % + (i, i)) + tdSql.checkColumnSorted(1, "desc") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index 5eb356960a..31ce70e90a 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -97,6 +97,8 @@ class Test: "create table %s using %s tags (1, '表1')" % (current_tb, self.last_stb)) self.last_tb = current_tb + self.written = 0 + tdSql.execute( "insert into %s values (now, 27, '我是nchar字符串')" % self.last_tb) diff --git a/tests/pytest/table/tablename-boundary.py b/tests/pytest/table/tablename-boundary.py index 6ce986c51e..0755e75355 100644 --- a/tests/pytest/table/tablename-boundary.py +++ b/tests/pytest/table/tablename-boundary.py @@ -18,7 +18,10 @@ class TDTestCase: tdSql.prepare() getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'" - tableNameMaxLen = int( subprocess.check_output(getTableNameLen, shell=True)) - 1 + tableNameMaxLen = int( + subprocess.check_output( + getTableNameLen, + shell=True)) - 1 tdLog.info("table name max length is %d" % tableNameMaxLen) chars = string.ascii_uppercase + string.ascii_lowercase tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index 7cbef188b2..b8ddc3ff87 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -93,9 +93,13 @@ class TDTestCase: tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2") # TSIM: return -1 # TSIM: step22: - # TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 - tdLog.info("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") - tdSql.error("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + # TSIM: sql alter table $mt change tag tgcol1 + # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x + # step20 + tdLog.info( + "alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + tdSql.error( + "alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # TSIM: return -1 # TSIM: step20: # TSIM: @@ -267,8 +271,10 @@ class TDTestCase: tdSql.execute( 'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))') # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) - tdLog.info("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") - tdSql.execute("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") + tdLog.info( + "create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") + tdSql.execute( + "create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") # TSIM: sql insert into $tb values(now, 1) tdLog.info("insert into tb6 values(now, 1)") tdSql.execute("insert into tb6 values(now, 1)") diff --git a/tests/pytest/tag_lite/delete.py b/tests/pytest/tag_lite/delete.py index 88615e0406..17b4deb815 100644 --- a/tests/pytest/tag_lite/delete.py +++ b/tests/pytest/tag_lite/delete.py @@ -208,14 +208,14 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != 1 then - tdLog.info('tdSql.checkData(2, 3, 1)') - tdSql.checkData(2, 3, 1) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step40 tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt)) - tdSql.error('alter table %s drop tag tgcol10' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step40: # TSIM: sql alter table $mt drop tag tgcol2 @@ -263,14 +263,14 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step50 tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt)) - tdSql.error('alter table %s drop tag tgcol10' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step50: # TSIM: sql alter table $mt drop tag tgcol2 @@ -381,8 +381,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -420,18 +420,18 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != 1 then - tdLog.info('tdSql.checkData(2, 3, 1)') - tdSql.checkData(2, 3, 1) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data33 != 2 then - tdLog.info('tdSql.checkData(3, 3, 2)') - tdSql.checkData(3, 3, 2) + tdLog.info('tdSql.checkData(3, 3, "TAG")') + tdSql.checkData(3, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data43 != 3 then - tdLog.info('tdSql.checkData(4, 3, 3)') - tdSql.checkData(4, 3, 3) + tdLog.info('tdSql.checkData(4, 3, "TAG")') + tdSql.checkData(4, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: @@ -488,8 +488,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -543,13 +543,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -600,23 +600,23 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: @@ -690,8 +690,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: @@ -766,13 +766,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -830,8 +830,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -845,8 +845,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -855,8 +855,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -903,7 +903,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -944,7 +948,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -985,7 +993,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1026,7 +1038,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1067,23 +1083,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step51 tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step51: # TSIM: sql select * from $mt where tgcol3 = 1 -x step52 tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step52: # TSIM: @@ -1118,23 +1138,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step71: # TSIM: sql select * from $mt where tgcol3 = 1 -x step72 tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step72: # TSIM: @@ -1169,23 +1193,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step81: # TSIM: sql select * from $mt where tgcol3 = 1 -x step82 tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step82: # TSIM: @@ -1220,23 +1248,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) - tdSql.error('select * from %s where tgcol3 = 11' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step91: # TSIM: sql select * from $mt where tgcol2 = 1 -x step92 tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) - tdSql.error('select * from %s where tgcol2 = 12' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step92: # TSIM: @@ -1265,39 +1297,43 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) - tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step101: # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) - tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step102: # TSIM: sql select * from $mt where tgcol4 = 1 -x step103 tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt)) - tdSql.error('select * from %s where tgcol4 = 103' % (mt)) + tdSql.error('select * from %s where tgcol4 = 1' % (mt)) # TSIM: return -1 # TSIM: step103: # TSIM: @@ -1336,34 +1372,34 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) - tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step111: # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) - tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step112: # TSIM: sql select * from $mt where tgcol5 = 1 -x step113 tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt)) - tdSql.error('select * from %s where tgcol5 = 113' % (mt)) + tdSql.error('select * from %s where tgcol5 = 1' % (mt)) # TSIM: return -1 # TSIM: step113: # TSIM: @@ -1402,44 +1438,44 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then - tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + tdLog.info('tdSql.checkData(0, 7, NULL) out of range') + # tdSql.checkData(0, 7, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step120 tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt)) - tdSql.error('select * from %s where tgcol2 = 120' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step120: # TSIM: sql select * from $mt where tgcol3 = 1 -x step121 tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt)) - tdSql.error('select * from %s where tgcol3 = 121' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step121: # TSIM: sql select * from $mt where tgcol5 = 1 -x step122 tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt)) - tdSql.error('select * from %s where tgcol5 = 122' % (mt)) + tdSql.error('select * from %s where tgcol5 = 1' % (mt)) # TSIM: return -1 # TSIM: step122: # TSIM: sql select * from $mt where tgcol6 = 1 -x step123 tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt)) - tdSql.error('select * from %s where tgcol6 = 123' % (mt)) + tdSql.error('select * from %s where tgcol6 = 1' % (mt)) # TSIM: return -1 # TSIM: step123: # TSIM: @@ -1471,8 +1507,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -1486,34 +1522,34 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then - tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + tdLog.info('tdSql.checkData(0, 7, NULL) out of range') + # tdSql.checkData(0, 7, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step130 tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt)) - tdSql.error('select * from %s where tgcol3 = 130' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step130: # TSIM: sql select * from $mt where tgcol4 = 1 -x step131 tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt)) - tdSql.error('select * from %s where tgcol4 = 131' % (mt)) + tdSql.error('select * from %s where tgcol4 = 1' % (mt)) # TSIM: return -1 # TSIM: step131: # TSIM: sql select * from $mt where tgcol6 = 1 -x step133 tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt)) - tdSql.error('select * from %s where tgcol6 = 133' % (mt)) + tdSql.error('select * from %s where tgcol6 = 1' % (mt)) # TSIM: return -1 # TSIM: step133: # TSIM: @@ -1542,23 +1578,23 @@ class TDTestCase: # TSIM: # TSIM: sql alter table xxmt drop tag tag1 -x step141 tdLog.info('alter table xxmt drop tag tag1 -x step141') - tdSql.error('alter table xxmt drop tag tag141') + tdSql.error('alter table xxmt drop tag tag1') # TSIM: return -1 # TSIM: step141: # TSIM: sql alter table $tb drop tag tag1 -x step142 tdLog.info('alter table %s drop tag tag1 -x step142' % (tb)) - tdSql.error('alter table %s drop tag tag142' % (tb)) + tdSql.error('alter table %s drop tag tag1' % (tb)) # TSIM: return -1 # TSIM: step142: # TSIM: sql alter table $mt drop tag tag1 -x step143 tdLog.info('alter table %s drop tag tag1 -x step143' % (mt)) - tdSql.error('alter table %s drop tag tag143' % (mt)) + tdSql.error('alter table %s drop tag tag1' % (mt)) # TSIM: return -1 # TSIM: step143: # TSIM: # TSIM: sql alter table $mt drop tag tagcol1 -x step144 tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt)) - tdSql.error('alter table %s drop tag tagcol144' % (mt)) + tdSql.error('alter table %s drop tag tagcol1' % (mt)) # TSIM: return -1 # TSIM: step144: # TSIM: @@ -1567,15 +1603,15 @@ class TDTestCase: tdSql.execute('alter table %s drop tag tgcol2' % (mt)) # TSIM: sql alter table $mt drop tag tgcol1 -x step145 tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt)) - tdSql.error('alter table %s drop tag tgcol145' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step145: # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') # TSIM: sql drop database $db - tdLog.info('sql drop database $db') - tdSql.execute('sql drop database $db') + tdLog.info('drop database db') + tdSql.execute('drop database db') # TSIM: sql show databases tdLog.info('show databases') tdSql.query('show databases') diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 367217cd49..f3fd178088 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -205,31 +205,37 @@ class TDSql: if col < 0: tdLog.exit( "%s failed: sql:%s, col:%d is smaller than zero" % - (callerFilename, self.sql, col)) + (callerFilename, self.sql, col)) if col > self.queryCols: tdLog.exit( "%s failed: sql:%s, col:%d is larger than queryCols:%d" % (callerFilename, self.sql, col, self.queryCols)) - - matrix = np.array(self.queryResult) - list = matrix[:, 0] - if order == "" or order.upper() == "ASC": - if all(sorted(list) == list): - tdLog.info("sql:%s, column :%d is sorted in accending order as expected" % + matrix = np.array(self.queryResult) + list = matrix[:, 0] + + if order == "" or order.upper() == "ASC": + if all(sorted(list) == list): + tdLog.info( + "sql:%s, column :%d is sorted in accending order as expected" % (self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, col:%d is not sorted in accesnind order" % + tdLog.exit( + "%s failed: sql:%s, col:%d is not sorted in accesnind order" % (callerFilename, self.sql, col)) - elif order.upper() == "DESC": - if all(sorted(list, reverse=True) == list): - tdLog.info("sql:%s, column :%d is sorted in decending order as expected" % + elif order.upper() == "DESC": + if all(sorted(list, reverse=True) == list): + tdLog.info( + "sql:%s, column :%d is sorted in decending order as expected" % (self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, col:%d is not sorted in decending order" % - (callerFilename, self.sql, col)) + tdLog.exit( + "%s failed: sql:%s, col:%d is not sorted in decending order" % + (callerFilename, self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, the order provided for col:%d is not correct" % - (callerFilename, self.sql, col)) + tdLog.exit( + "%s failed: sql:%s, the order provided for col:%d is not correct" % + (callerFilename, self.sql, col)) + tdSql = TDSql() From 5761e2aa776be215084bf9fd0fca9a1bb123c886 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 16:34:39 +0800 Subject: [PATCH 21/33] modify format by autopep8. --- tests/pytest/query/filterAllIntTypes.py | 50 ++-- tests/pytest/query/filterFloatAndDouble.py | 36 +-- tests/pytest/query/filterOtherTypes.py | 141 +++++------ tests/pytest/query/querySort.py | 60 ++--- tests/pytest/random-test/random-test.py | 2 + tests/pytest/table/tablename-boundary.py | 5 +- tests/pytest/tag_lite/change.py | 16 +- tests/pytest/tag_lite/delete.py | 262 ++++++++++++--------- tests/pytest/util/sql.py | 36 +-- 9 files changed, 341 insertions(+), 267 deletions(-) diff --git a/tests/pytest/query/filterAllIntTypes.py b/tests/pytest/query/filterAllIntTypes.py index 32e635d6da..cf65d2b102 100644 --- a/tests/pytest/query/filterAllIntTypes.py +++ b/tests/pytest/query/filterAllIntTypes.py @@ -22,12 +22,12 @@ class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) - + self.powers = [7, 15, 31, 63] self.types = ["tinyint", "smallint", "int", "bigint"] self.rowNum = 10 - self.ts = 1537146000000 - + self.ts = 1537146000000 + def run(self): tdSql.prepare() @@ -35,20 +35,30 @@ class TDTestCase: curType = self.types[i] print("======= Verify filter for %s type =========" % (curType)) tdLog.debug( - "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) + "create table st%s(ts timestamp, num %s) tags(id %s)" % + (curType, curType, curType)) tdSql.execute( - "create table st%s(ts timestamp, num %s) tags(id %s)" % (curType, curType, curType)) - - #create 10 tables, insert 10 rows for each table - for j in range(self.rowNum): - tdSql.execute("create table st%s%d using st%s tags(%d)" % (curType, j + 1, curType, j + 1)) - for k in range(self.rowNum): - tdSql.execute("insert into st%s%d values(%d, %d)" % (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) - - tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 11, pow(2, self.powers[i]))) - tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) - tdSql.error("insert into st%s10 values(%d, %d)" % (curType, self.ts + 13, pow(-2, self.powers[i]))) - tdSql.execute("insert into st%s10 values(%d, %d)" % (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) + "create table st%s(ts timestamp, num %s) tags(id %s)" % + (curType, curType, curType)) + + # create 10 tables, insert 10 rows for each table + for j in range(self.rowNum): + tdSql.execute( + "create table st%s%d using st%s tags(%d)" % + (curType, j + 1, curType, j + 1)) + for k in range(self.rowNum): + tdSql.execute( + "insert into st%s%d values(%d, %d)" % + (curType, j + 1, self.ts + k + 1, j * 10 + k + 1)) + + tdSql.error("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 11, pow(2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 12, pow(2, self.powers[i]) - 1)) + tdSql.error("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 13, pow(-2, self.powers[i]))) + tdSql.execute("insert into st%s10 values(%d, %d)" % + (curType, self.ts + 14, pow(-2, self.powers[i]) + 1)) # > for int type on column tdSql.query("select * from st%s where num > 50" % curType) @@ -104,10 +114,12 @@ class TDTestCase: # != for int type on tag tdSql.query("select * from st%s where id != 5" % curType) - tdSql.checkRows(92) + tdSql.checkRows(92) + + print( + "======= Verify filter for %s type finished =========" % + curType) - print("======= Verify filter for %s type finished =========" % curType) - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/filterFloatAndDouble.py b/tests/pytest/query/filterFloatAndDouble.py index bea41be11c..bd349a2a25 100644 --- a/tests/pytest/query/filterFloatAndDouble.py +++ b/tests/pytest/query/filterFloatAndDouble.py @@ -21,28 +21,28 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor()) self.rowNum = 10 self.ts = 1537146000000 - + def run(self): tdSql.prepare() print("======= Verify filter for float and double type =========") tdLog.debug( - "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") tdSql.execute( - "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") - - for j in range(self.rowNum): - tdSql.execute( - "insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % (self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) + "create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)") + + for j in range(self.rowNum): + tdSql.execute("insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)" % ( + self.ts + j + 1, 1.1 * (j + 1), 2.3 * (j + 1))) # > for float type on column tdSql.query("select * from st where num > 5.5") tdSql.checkRows(5) - + # >= for float type on column tdSql.query("select * from st where num >= 5.5") tdSql.checkRows(6) @@ -70,11 +70,11 @@ class TDTestCase: # > for float type on tag tdSql.query("select * from st where tagcol1 > 1.1") tdSql.checkRows(0) - + # >= for float type on tag tdSql.query("select * from st where tagcol1 >= 1.1") tdSql.checkRows(10) - + # = for float type on tag tdSql.query("select * from st where tagcol1 = 1.1") tdSql.checkRows(10) @@ -86,7 +86,7 @@ class TDTestCase: # != for float type on tag tdSql.query("select * from st where tagcol1 != 1.1") tdSql.checkRows(0) - + # <= for float type on tag tdSql.query("select * from st where tagcol1 <= 1.1") tdSql.checkRows(10) @@ -94,11 +94,11 @@ class TDTestCase: # < for float type on tag tdSql.query("select * from st where tagcol1 < 1.1") tdSql.checkRows(0) - + # > for double type on column tdSql.query("select * from st where speed > 11.5") tdSql.checkRows(5) - + # >= for double type on column tdSql.query("select * from st where speed >= 11.5") tdSql.checkRows(6) @@ -126,11 +126,11 @@ class TDTestCase: # > for double type on tag tdSql.query("select * from st where tagcol2 > 2.3") tdSql.checkRows(0) - + # >= for double type on tag tdSql.query("select * from st where tagcol2 >= 2.3") tdSql.checkRows(10) - + # = for double type on tag tdSql.query("select * from st where tagcol2 = 2.3") tdSql.checkRows(10) @@ -142,7 +142,7 @@ class TDTestCase: # != for double type on tag tdSql.query("select * from st where tagcol2 != 2.3") tdSql.checkRows(0) - + # <= for double type on tag tdSql.query("select * from st where tagcol2 <= 2.3") tdSql.checkRows(10) @@ -150,7 +150,7 @@ class TDTestCase: # < for double type on tag tdSql.query("select * from st where tagcol2 < 2.3") tdSql.checkRows(0) - + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/query/filterOtherTypes.py b/tests/pytest/query/filterOtherTypes.py index f09ac596c7..bc7df18c8d 100644 --- a/tests/pytest/query/filterOtherTypes.py +++ b/tests/pytest/query/filterOtherTypes.py @@ -21,33 +21,39 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - + tdSql.init(conn.cursor()) + self.ts = 1537146000000 - + def run(self): tdSql.prepare() - + print("======= Verify filter for bool, nchar and binary type =========") tdLog.debug( "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") tdSql.execute( - "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") tdSql.execute("create table st1 using st tags(true, 'table1', '水表')") - for i in range(1, 6): - tdSql.execute("insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + for i in range(1, 6): + tdSql.execute( + "insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')" % + (self.ts + i, i % + 2, i, i)) tdSql.execute("create table st2 using st tags(false, 'table2', '电表')") - for i in range(6, 11): - tdSql.execute("insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % (self.ts + i, i % 2, i, i)) + for i in range(6, 11): + tdSql.execute( + "insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')" % + (self.ts + i, i % + 2, i, i)) # =============Verify stable columns==================== # > for bool type on column tdSql.error("select * from st where tbcol1 > false") # >= for bool type on column - tdSql.error("select * from st where tbcol1 >= false") + tdSql.error("select * from st where tbcol1 >= false") # = for bool type on column tdSql.query("select * from st where tbcol1 = false") @@ -77,18 +83,18 @@ class TDTestCase: tdSql.error("select * from st where tbcol2 > 'taosdata'") # >= for nchar type on column - tdSql.error("select * from st where tbcol2 >= 'taosdata'") + tdSql.error("select * from st where tbcol2 >= 'taosdata'") # = for nchar type on column tdSql.query("select * from st where tbcol2 = 'taosdata1'") tdSql.checkRows(1) # <> for nchar type on column - tdSql.query("select * from st where tbcol2 <> 'taosdata1'") + tdSql.query("select * from st where tbcol2 <> 'taosdata1'") tdSql.checkRows(9) # != for nchar type on column - tdSql.query("select * from st where tbcol2 != 'taosdata1'") + tdSql.query("select * from st where tbcol2 != 'taosdata1'") tdSql.checkRows(9) # > for nchar type on column @@ -98,57 +104,57 @@ class TDTestCase: tdSql.error("select * from st where tbcol2 <= 'taodata'") # % for nchar type on column case 1 - tdSql.query("select * from st where tbcol2 like '%'") + tdSql.query("select * from st where tbcol2 like '%'") tdSql.checkRows(10) # % for nchar type on column case 2 - tdSql.query("select * from st where tbcol2 like 'a%'") + tdSql.query("select * from st where tbcol2 like 'a%'") tdSql.checkRows(0) # % for nchar type on column case 3 - tdSql.query("select * from st where tbcol2 like 't%_'") + tdSql.query("select * from st where tbcol2 like 't%_'") tdSql.checkRows(10) # % for nchar type on column case 4 - tdSql.query("select * from st where tbcol2 like '%1'") + tdSql.query("select * from st where tbcol2 like '%1'") # tdSql.checkRows(2) # _ for nchar type on column case 1 - tdSql.query("select * from st where tbcol2 like '____________'") - tdSql.checkRows(0) + tdSql.query("select * from st where tbcol2 like '____________'") + tdSql.checkRows(0) # _ for nchar type on column case 2 - tdSql.query("select * from st where tbcol2 like '__________'") + tdSql.query("select * from st where tbcol2 like '__________'") tdSql.checkRows(1) # _ for nchar type on column case 3 - tdSql.query("select * from st where tbcol2 like '_________'") + tdSql.query("select * from st where tbcol2 like '_________'") tdSql.checkRows(9) # _ for nchar type on column case 4 - tdSql.query("select * from st where tbcol2 like 't________'") + tdSql.query("select * from st where tbcol2 like 't________'") tdSql.checkRows(9) # _ for nchar type on column case 5 - tdSql.query("select * from st where tbcol2 like '%________'") + tdSql.query("select * from st where tbcol2 like '%________'") tdSql.checkRows(10) # > for binary type on column tdSql.error("select * from st where tbcol3 > '涛思数据'") # >= for binary type on column - tdSql.error("select * from st where tbcol3 >= '涛思数据'") + tdSql.error("select * from st where tbcol3 >= '涛思数据'") # = for binary type on column tdSql.query("select * from st where tbcol3 = '涛思数据1'") tdSql.checkRows(1) # <> for binary type on column - tdSql.query("select * from st where tbcol3 <> '涛思数据1'") + tdSql.query("select * from st where tbcol3 <> '涛思数据1'") tdSql.checkRows(9) # != for binary type on column - tdSql.query("select * from st where tbcol3 != '涛思数据1'") + tdSql.query("select * from st where tbcol3 != '涛思数据1'") tdSql.checkRows(9) # > for binary type on column @@ -158,39 +164,39 @@ class TDTestCase: tdSql.error("select * from st where tbcol3 <= '涛思数据'") # % for binary type on column case 1 - tdSql.query("select * from st where tbcol3 like '%'") + tdSql.query("select * from st where tbcol3 like '%'") tdSql.checkRows(10) # % for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '陶%'") + tdSql.query("select * from st where tbcol3 like '陶%'") tdSql.checkRows(0) # % for binary type on column case 3 - tdSql.query("select * from st where tbcol3 like '涛%_'") + tdSql.query("select * from st where tbcol3 like '涛%_'") tdSql.checkRows(10) # % for binary type on column case 4 - tdSql.query("select * from st where tbcol3 like '%1'") + tdSql.query("select * from st where tbcol3 like '%1'") tdSql.checkRows(1) # _ for binary type on column case 1 - tdSql.query("select * from st where tbcol3 like '_______'") - tdSql.checkRows(0) + tdSql.query("select * from st where tbcol3 like '_______'") + tdSql.checkRows(0) # _ for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '______'") + tdSql.query("select * from st where tbcol3 like '______'") tdSql.checkRows(1) # _ for binary type on column case 2 - tdSql.query("select * from st where tbcol3 like '_____'") + tdSql.query("select * from st where tbcol3 like '_____'") tdSql.checkRows(9) # _ for binary type on column case 3 - tdSql.query("select * from st where tbcol3 like '____'") + tdSql.query("select * from st where tbcol3 like '____'") tdSql.checkRows(0) # _ for binary type on column case 4 - tdSql.query("select * from st where tbcol3 like 't____'") + tdSql.query("select * from st where tbcol3 like 't____'") tdSql.checkRows(0) # =============Verify stable tags==================== @@ -198,7 +204,7 @@ class TDTestCase: tdSql.error("select * from st where tagcol1 > false") # >= for bool type on tag - tdSql.error("select * from st where tagcol1 >= false") + tdSql.error("select * from st where tagcol1 >= false") # = for bool type on tag tdSql.query("select * from st where tagcol1 = false") @@ -228,18 +234,18 @@ class TDTestCase: tdSql.error("select * from st where tagcol2 > 'table'") # >= for nchar type on tag - tdSql.error("select * from st where tagcol2 >= 'table'") + tdSql.error("select * from st where tagcol2 >= 'table'") # = for nchar type on tag tdSql.query("select * from st where tagcol2 = 'table1'") tdSql.checkRows(5) # <> for nchar type on tag - tdSql.query("select * from st where tagcol2 <> 'table1'") + tdSql.query("select * from st where tagcol2 <> 'table1'") tdSql.checkRows(5) # != for nchar type on tag - tdSql.query("select * from st where tagcol2 != 'table'") + tdSql.query("select * from st where tagcol2 != 'table'") tdSql.checkRows(10) # > for nchar type on tag @@ -249,57 +255,57 @@ class TDTestCase: tdSql.error("select * from st where tagcol2 <= 'table'") # % for nchar type on tag case 1 - tdSql.query("select * from st where tagcol2 like '%'") + tdSql.query("select * from st where tagcol2 like '%'") tdSql.checkRows(10) # % for nchar type on tag case 2 - tdSql.query("select * from st where tagcol2 like 'a%'") + tdSql.query("select * from st where tagcol2 like 'a%'") tdSql.checkRows(0) # % for nchar type on tag case 3 - tdSql.query("select * from st where tagcol2 like 't%_'") + tdSql.query("select * from st where tagcol2 like 't%_'") tdSql.checkRows(10) # % for nchar type on tag case 4 - tdSql.query("select * from st where tagcol2 like '%1'") + tdSql.query("select * from st where tagcol2 like '%1'") tdSql.checkRows(5) # _ for nchar type on tag case 1 - tdSql.query("select * from st where tagcol2 like '_______'") - tdSql.checkRows(0) + tdSql.query("select * from st where tagcol2 like '_______'") + tdSql.checkRows(0) # _ for nchar type on tag case 2 - tdSql.query("select * from st where tagcol2 like '______'") + tdSql.query("select * from st where tagcol2 like '______'") tdSql.checkRows(10) # _ for nchar type on tag case 3 - tdSql.query("select * from st where tagcol2 like 't_____'") + tdSql.query("select * from st where tagcol2 like 't_____'") tdSql.checkRows(10) # _ for nchar type on tag case 4 - tdSql.query("select * from st where tagcol2 like 's________'") + tdSql.query("select * from st where tagcol2 like 's________'") tdSql.checkRows(0) # _ for nchar type on tag case 5 - tdSql.query("select * from st where tagcol2 like '%__'") + tdSql.query("select * from st where tagcol2 like '%__'") tdSql.checkRows(10) # > for binary type on tag tdSql.error("select * from st where tagcol3 > '表'") # >= for binary type on tag - tdSql.error("select * from st where tagcol3 >= '表'") + tdSql.error("select * from st where tagcol3 >= '表'") # = for binary type on tag tdSql.query("select * from st where tagcol3 = '水表'") tdSql.checkRows(5) # <> for binary type on tag - tdSql.query("select * from st where tagcol3 <> '水表'") + tdSql.query("select * from st where tagcol3 <> '水表'") tdSql.checkRows(5) # != for binary type on tag - tdSql.query("select * from st where tagcol3 != '水表'") + tdSql.query("select * from st where tagcol3 != '水表'") tdSql.checkRows(5) # > for binary type on tag @@ -309,54 +315,53 @@ class TDTestCase: tdSql.error("select * from st where tagcol3 <= '水表'") # % for binary type on tag case 1 - tdSql.query("select * from st where tagcol3 like '%'") + tdSql.query("select * from st where tagcol3 like '%'") tdSql.checkRows(10) # % for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '水%'") + tdSql.query("select * from st where tagcol3 like '水%'") tdSql.checkRows(5) # % for binary type on tag case 3 - tdSql.query("select * from st where tagcol3 like '数%_'") + tdSql.query("select * from st where tagcol3 like '数%_'") tdSql.checkRows(0) # % for binary type on tag case 4 - tdSql.query("select * from st where tagcol3 like '%表'") + tdSql.query("select * from st where tagcol3 like '%表'") tdSql.checkRows(10) # % for binary type on tag case 5 - tdSql.query("select * from st where tagcol3 like '%据'") + tdSql.query("select * from st where tagcol3 like '%据'") tdSql.checkRows(0) # _ for binary type on tag case 1 - tdSql.query("select * from st where tagcol3 like '__'") - tdSql.checkRows(10) + tdSql.query("select * from st where tagcol3 like '__'") + tdSql.checkRows(10) # _ for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '水_'") + tdSql.query("select * from st where tagcol3 like '水_'") tdSql.checkRows(5) # _ for binary type on tag case 2 - tdSql.query("select * from st where tagcol3 like '_表'") + tdSql.query("select * from st where tagcol3 like '_表'") tdSql.checkRows(10) # _ for binary type on tag case 3 - tdSql.query("select * from st where tagcol3 like '___'") + tdSql.query("select * from st where tagcol3 like '___'") tdSql.checkRows(0) # _ for binary type on tag case 4 - tdSql.query("select * from st where tagcol3 like '数_'") + tdSql.query("select * from st where tagcol3 like '数_'") tdSql.checkRows(0) # _ for binary type on tag case 5 - tdSql.query("select * from st where tagcol3 like '_据'") + tdSql.query("select * from st where tagcol3 like '_据'") tdSql.checkRows(0) - + def stop(self): tdSql.close() - tdLog.success("%s successfully executed" % __file__) + tdLog.success("%s successfully executed" % __file__) tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) - diff --git a/tests/pytest/query/querySort.py b/tests/pytest/query/querySort.py index bb806c27bc..3858701379 100644 --- a/tests/pytest/query/querySort.py +++ b/tests/pytest/query/querySort.py @@ -21,56 +21,60 @@ from util.sql import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor()) self.rowNum = 10 self.ts = 1537146000000 - + def run(self): tdSql.prepare() print("======= step 1: create table and insert data =========") tdLog.debug( - ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, - tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, + ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, + tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') tdSql.execute( - ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, - tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, + ''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double, + tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float, tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))''') - - for i in range(self.rowNum): - tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % (i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), - 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1)) - for j in range(self.rowNum): - tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % (i + 1, self.ts + 10 * (i + 1) + j + 1, - j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1)) - - print("======= step 2: verify order for each column =========") - # sort for timestamp in asc order + for i in range(self.rowNum): + tdSql.execute("create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')" % ( + i + 1, i + 1, i + 1, i + 1, i + 1, 1.1 * (i + 1), 1.23 * (i + 1), (i + 1) % 2, i + 1, i + 1)) + for j in range(self.rowNum): + tdSql.execute("insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" % ( + i + 1, self.ts + 10 * (i + 1) + j + 1, j + 1, j + 1, j + 1, j + 1, 1.1 * (j + 1), 1.23 * (j + 1), (j + 1) % 2, j + 1, j + 1)) + + print("======= step 2: verify order for each column =========") + # sort for timestamp in asc order tdSql.query("select * from st order by ts asc") tdSql.checkColumnSorted(0, "asc") - # sort for timestamp in desc order + # sort for timestamp in desc order tdSql.query("select * from st order by ts desc") tdSql.checkColumnSorted(0, "desc") + for i in range(1, 10): + tdSql.error("select * from st order by tbcol%d" % i) + tdSql.error("select * from st order by tbcol%d asc" % i) + tdSql.error("select * from st order by tbcol%d desc" % i) - for i in range(1, 10): - tdSql.error("select * from st order by tbcol%d" % i) - tdSql.error("select * from st order by tbcol%d asc" % i) - tdSql.error("select * from st order by tbcol%d desc" % i) - - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d" % (i, i)) + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d" % + (i, i)) tdSql.checkColumnSorted(1, "") - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" % (i, i)) + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc" % + (i, i)) tdSql.checkColumnSorted(1, "asc") - - tdSql.query("select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" % (i, i)) - tdSql.checkColumnSorted(1, "desc") - + + tdSql.query( + "select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc" % + (i, i)) + tdSql.checkColumnSorted(1, "desc") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index 5eb356960a..31ce70e90a 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -97,6 +97,8 @@ class Test: "create table %s using %s tags (1, '表1')" % (current_tb, self.last_stb)) self.last_tb = current_tb + self.written = 0 + tdSql.execute( "insert into %s values (now, 27, '我是nchar字符串')" % self.last_tb) diff --git a/tests/pytest/table/tablename-boundary.py b/tests/pytest/table/tablename-boundary.py index 6ce986c51e..0755e75355 100644 --- a/tests/pytest/table/tablename-boundary.py +++ b/tests/pytest/table/tablename-boundary.py @@ -18,7 +18,10 @@ class TDTestCase: tdSql.prepare() getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'" - tableNameMaxLen = int( subprocess.check_output(getTableNameLen, shell=True)) - 1 + tableNameMaxLen = int( + subprocess.check_output( + getTableNameLen, + shell=True)) - 1 tdLog.info("table name max length is %d" % tableNameMaxLen) chars = string.ascii_uppercase + string.ascii_lowercase tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index 7cbef188b2..b8ddc3ff87 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -93,9 +93,13 @@ class TDTestCase: tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2") # TSIM: return -1 # TSIM: step22: - # TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 - tdLog.info("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") - tdSql.error("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + # TSIM: sql alter table $mt change tag tgcol1 + # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x + # step20 + tdLog.info( + "alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + tdSql.error( + "alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # TSIM: return -1 # TSIM: step20: # TSIM: @@ -267,8 +271,10 @@ class TDTestCase: tdSql.execute( 'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))') # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) - tdLog.info("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") - tdSql.execute("create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") + tdLog.info( + "create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") + tdSql.execute( + "create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )") # TSIM: sql insert into $tb values(now, 1) tdLog.info("insert into tb6 values(now, 1)") tdSql.execute("insert into tb6 values(now, 1)") diff --git a/tests/pytest/tag_lite/delete.py b/tests/pytest/tag_lite/delete.py index 88615e0406..17b4deb815 100644 --- a/tests/pytest/tag_lite/delete.py +++ b/tests/pytest/tag_lite/delete.py @@ -208,14 +208,14 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != 1 then - tdLog.info('tdSql.checkData(2, 3, 1)') - tdSql.checkData(2, 3, 1) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step40 tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt)) - tdSql.error('alter table %s drop tag tgcol10' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step40: # TSIM: sql alter table $mt drop tag tgcol2 @@ -263,14 +263,14 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step50 tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt)) - tdSql.error('alter table %s drop tag tgcol10' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step50: # TSIM: sql alter table $mt drop tag tgcol2 @@ -381,8 +381,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -420,18 +420,18 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != 1 then - tdLog.info('tdSql.checkData(2, 3, 1)') - tdSql.checkData(2, 3, 1) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data33 != 2 then - tdLog.info('tdSql.checkData(3, 3, 2)') - tdSql.checkData(3, 3, 2) + tdLog.info('tdSql.checkData(3, 3, "TAG")') + tdSql.checkData(3, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data43 != 3 then - tdLog.info('tdSql.checkData(4, 3, 3)') - tdSql.checkData(4, 3, 3) + tdLog.info('tdSql.checkData(4, 3, "TAG")') + tdSql.checkData(4, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: @@ -488,8 +488,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -543,13 +543,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: @@ -600,23 +600,23 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 3 then - tdLog.info('tdSql.checkData(0, 4, 3)') - tdSql.checkData(0, 4, 3) + tdLog.info('tdSql.checkData(0, 4, "3")') + tdSql.checkData(0, 4, "3") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: @@ -690,8 +690,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: @@ -766,13 +766,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5 then - tdLog.info('tdSql.checkData(0, 6, 5)') - tdSql.checkData(0, 6, 5) + tdLog.info('tdSql.checkData(0, 6, "5")') + tdSql.checkData(0, 6, "5") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -830,8 +830,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -845,8 +845,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -855,8 +855,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -903,7 +903,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -944,7 +948,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -985,7 +993,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1026,7 +1038,11 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -1067,23 +1083,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step51 tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step51: # TSIM: sql select * from $mt where tgcol3 = 1 -x step52 tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step52: # TSIM: @@ -1118,23 +1138,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step71: # TSIM: sql select * from $mt where tgcol3 = 1 -x step72 tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step72: # TSIM: @@ -1169,23 +1193,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) - tdSql.error('select * from %s where tgcol2 = 11' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step81: # TSIM: sql select * from $mt where tgcol3 = 1 -x step82 tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt)) - tdSql.error('select * from %s where tgcol3 = 12' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step82: # TSIM: @@ -1220,23 +1248,27 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) - tdSql.error('select * from %s where tgcol3 = 11' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step91: # TSIM: sql select * from $mt where tgcol2 = 1 -x step92 tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt)) - tdSql.error('select * from %s where tgcol2 = 12' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step92: # TSIM: @@ -1265,39 +1297,43 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') - tdSql.checkData(0, 3, None) + try: + tdSql.checkData(0, 3, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) - tdSql.error('select * from %s where tgcol2 = 101' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step101: # TSIM: sql select * from $mt where tgcol3 = 1 -x step102 tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt)) - tdSql.error('select * from %s where tgcol3 = 102' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step102: # TSIM: sql select * from $mt where tgcol4 = 1 -x step103 tdLog.info('select * from %s where tgcol4 = 1 -x step103' % (mt)) - tdSql.error('select * from %s where tgcol4 = 103' % (mt)) + tdSql.error('select * from %s where tgcol4 = 1' % (mt)) # TSIM: return -1 # TSIM: step103: # TSIM: @@ -1336,34 +1372,34 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) - tdSql.error('select * from %s where tgcol2 = 111' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step111: # TSIM: sql select * from $mt where tgcol3 = 1 -x step112 tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt)) - tdSql.error('select * from %s where tgcol3 = 112' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step112: # TSIM: sql select * from $mt where tgcol5 = 1 -x step113 tdLog.info('select * from %s where tgcol5 = 1 -x step113' % (mt)) - tdSql.error('select * from %s where tgcol5 = 113' % (mt)) + tdSql.error('select * from %s where tgcol5 = 1' % (mt)) # TSIM: return -1 # TSIM: step113: # TSIM: @@ -1402,44 +1438,44 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != NULL then - tdLog.info('tdSql.checkData(0, 4, NULL)') - tdSql.checkData(0, 4, None) + tdLog.info('tdSql.checkData(0, 4, NULL) out of range') + # tdSql.checkData(0, 4, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then - tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + tdLog.info('tdSql.checkData(0, 7, NULL) out of range') + # tdSql.checkData(0, 7, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step120 tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt)) - tdSql.error('select * from %s where tgcol2 = 120' % (mt)) + tdSql.error('select * from %s where tgcol2 = 1' % (mt)) # TSIM: return -1 # TSIM: step120: # TSIM: sql select * from $mt where tgcol3 = 1 -x step121 tdLog.info('select * from %s where tgcol3 = 1 -x step121' % (mt)) - tdSql.error('select * from %s where tgcol3 = 121' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step121: # TSIM: sql select * from $mt where tgcol5 = 1 -x step122 tdLog.info('select * from %s where tgcol5 = 1 -x step122' % (mt)) - tdSql.error('select * from %s where tgcol5 = 122' % (mt)) + tdSql.error('select * from %s where tgcol5 = 1' % (mt)) # TSIM: return -1 # TSIM: step122: # TSIM: sql select * from $mt where tgcol6 = 1 -x step123 tdLog.info('select * from %s where tgcol6 = 1 -x step123' % (mt)) - tdSql.error('select * from %s where tgcol6 = 123' % (mt)) + tdSql.error('select * from %s where tgcol6 = 1' % (mt)) # TSIM: return -1 # TSIM: step123: # TSIM: @@ -1471,8 +1507,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -1486,34 +1522,34 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != NULL then - tdLog.info('tdSql.checkData(0, 5, NULL)') - tdSql.checkData(0, 5, None) + tdLog.info('tdSql.checkData(0, 5, NULL) out of range') + # tdSql.checkData(0, 5, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != NULL then - tdLog.info('tdSql.checkData(0, 6, NULL)') - tdSql.checkData(0, 6, None) + tdLog.info('tdSql.checkData(0, 6, NULL) out of range') + # tdSql.checkData(0, 6, None) # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then - tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + tdLog.info('tdSql.checkData(0, 7, NULL) out of range') + # tdSql.checkData(0, 7, None) # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step130 tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt)) - tdSql.error('select * from %s where tgcol3 = 130' % (mt)) + tdSql.error('select * from %s where tgcol3 = 1' % (mt)) # TSIM: return -1 # TSIM: step130: # TSIM: sql select * from $mt where tgcol4 = 1 -x step131 tdLog.info('select * from %s where tgcol4 = 1 -x step131' % (mt)) - tdSql.error('select * from %s where tgcol4 = 131' % (mt)) + tdSql.error('select * from %s where tgcol4 = 1' % (mt)) # TSIM: return -1 # TSIM: step131: # TSIM: sql select * from $mt where tgcol6 = 1 -x step133 tdLog.info('select * from %s where tgcol6 = 1 -x step133' % (mt)) - tdSql.error('select * from %s where tgcol6 = 133' % (mt)) + tdSql.error('select * from %s where tgcol6 = 1' % (mt)) # TSIM: return -1 # TSIM: step133: # TSIM: @@ -1542,23 +1578,23 @@ class TDTestCase: # TSIM: # TSIM: sql alter table xxmt drop tag tag1 -x step141 tdLog.info('alter table xxmt drop tag tag1 -x step141') - tdSql.error('alter table xxmt drop tag tag141') + tdSql.error('alter table xxmt drop tag tag1') # TSIM: return -1 # TSIM: step141: # TSIM: sql alter table $tb drop tag tag1 -x step142 tdLog.info('alter table %s drop tag tag1 -x step142' % (tb)) - tdSql.error('alter table %s drop tag tag142' % (tb)) + tdSql.error('alter table %s drop tag tag1' % (tb)) # TSIM: return -1 # TSIM: step142: # TSIM: sql alter table $mt drop tag tag1 -x step143 tdLog.info('alter table %s drop tag tag1 -x step143' % (mt)) - tdSql.error('alter table %s drop tag tag143' % (mt)) + tdSql.error('alter table %s drop tag tag1' % (mt)) # TSIM: return -1 # TSIM: step143: # TSIM: # TSIM: sql alter table $mt drop tag tagcol1 -x step144 tdLog.info('alter table %s drop tag tagcol1 -x step144' % (mt)) - tdSql.error('alter table %s drop tag tagcol144' % (mt)) + tdSql.error('alter table %s drop tag tagcol1' % (mt)) # TSIM: return -1 # TSIM: step144: # TSIM: @@ -1567,15 +1603,15 @@ class TDTestCase: tdSql.execute('alter table %s drop tag tgcol2' % (mt)) # TSIM: sql alter table $mt drop tag tgcol1 -x step145 tdLog.info('alter table %s drop tag tgcol1 -x step145' % (mt)) - tdSql.error('alter table %s drop tag tgcol145' % (mt)) + tdSql.error('alter table %s drop tag tgcol1' % (mt)) # TSIM: return -1 # TSIM: step145: # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') # TSIM: sql drop database $db - tdLog.info('sql drop database $db') - tdSql.execute('sql drop database $db') + tdLog.info('drop database db') + tdSql.execute('drop database db') # TSIM: sql show databases tdLog.info('show databases') tdSql.query('show databases') diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 367217cd49..f3fd178088 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -205,31 +205,37 @@ class TDSql: if col < 0: tdLog.exit( "%s failed: sql:%s, col:%d is smaller than zero" % - (callerFilename, self.sql, col)) + (callerFilename, self.sql, col)) if col > self.queryCols: tdLog.exit( "%s failed: sql:%s, col:%d is larger than queryCols:%d" % (callerFilename, self.sql, col, self.queryCols)) - - matrix = np.array(self.queryResult) - list = matrix[:, 0] - if order == "" or order.upper() == "ASC": - if all(sorted(list) == list): - tdLog.info("sql:%s, column :%d is sorted in accending order as expected" % + matrix = np.array(self.queryResult) + list = matrix[:, 0] + + if order == "" or order.upper() == "ASC": + if all(sorted(list) == list): + tdLog.info( + "sql:%s, column :%d is sorted in accending order as expected" % (self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, col:%d is not sorted in accesnind order" % + tdLog.exit( + "%s failed: sql:%s, col:%d is not sorted in accesnind order" % (callerFilename, self.sql, col)) - elif order.upper() == "DESC": - if all(sorted(list, reverse=True) == list): - tdLog.info("sql:%s, column :%d is sorted in decending order as expected" % + elif order.upper() == "DESC": + if all(sorted(list, reverse=True) == list): + tdLog.info( + "sql:%s, column :%d is sorted in decending order as expected" % (self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, col:%d is not sorted in decending order" % - (callerFilename, self.sql, col)) + tdLog.exit( + "%s failed: sql:%s, col:%d is not sorted in decending order" % + (callerFilename, self.sql, col)) else: - tdLog.exit("%s failed: sql:%s, the order provided for col:%d is not correct" % - (callerFilename, self.sql, col)) + tdLog.exit( + "%s failed: sql:%s, the order provided for col:%d is not correct" % + (callerFilename, self.sql, col)) + tdSql = TDSql() From b8c5d4f445afd97c9a56facb83a685f5f3106295 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 17:11:56 +0800 Subject: [PATCH 22/33] add tag_lite/set.py to regression test. --- tests/pytest/regressiontest.sh | 2 +- tests/pytest/tag_lite/set.py | 126 +++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 54 deletions(-) diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 22cc9d9af2..474124f4be 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -48,7 +48,7 @@ python3 ./test.py -f tag_lite/float.py python3 ./test.py -f tag_lite/int_binary.py python3 ./test.py -f tag_lite/int_float.py python3 ./test.py -f tag_lite/int.py -# python3 ./test.py -f tag_lite/set.py +python3 ./test.py -f tag_lite/set.py python3 ./test.py -f tag_lite/smallint.py python3 ./test.py -f tag_lite/tinyint.py diff --git a/tests/pytest/tag_lite/set.py b/tests/pytest/tag_lite/set.py index 2573600dc4..1e3cdfaa93 100644 --- a/tests/pytest/tag_lite/set.py +++ b/tests/pytest/tag_lite/set.py @@ -178,13 +178,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data23 != false then - tdLog.info('tdSql.checkData(2, 3, false)') - tdSql.checkData(2, 3, false) + tdLog.info('tdSql.checkData(2, 3, "TAG")') + tdSql.checkData(2, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: if $data33 != 4 then - tdLog.info('tdSql.checkData(3, 3, 4)') - tdSql.checkData(3, 3, 4) + tdLog.info('tdSql.checkData(3, 3, "TAG")') + tdSql.checkData(3, 3, "TAG") # TSIM: return -1 # TSIM: endi # TSIM: @@ -458,8 +458,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then - tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdLog.info('tdSql.checkData(0, 3, "2")') + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -495,8 +495,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: @@ -521,8 +521,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 4 then - tdLog.info('tdSql.checkData(0, 3, 4)') - tdSql.checkData(0, 3, 4) + tdLog.info('tdSql.checkData(0, 3, "4")') + tdSql.checkData(0, 3, "4") # TSIM: return -1 # TSIM: endi # TSIM: @@ -567,8 +567,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -582,8 +582,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 4 then - tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdLog.info('tdSql.checkData(0, 5, "4")') + tdSql.checkData(0, 5, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -592,8 +592,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != 6 then - tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdLog.info('tdSql.checkData(0, 7, "6")') + tdSql.checkData(0, 7, "6") # TSIM: return -1 # TSIM: endi # TSIM: @@ -636,8 +636,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 8 then @@ -646,8 +646,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 9 then - tdLog.info('tdSql.checkData(0, 4, 9)') - tdSql.checkData(0, 4, 9) + tdLog.info('tdSql.checkData(0, 4, "9")') + tdSql.checkData(0, 4, "9") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 10.000000000 then @@ -656,13 +656,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 11 then - tdLog.info('tdSql.checkData(0, 6, 11)') - tdSql.checkData(0, 6, 11) + tdLog.info('tdSql.checkData(0, 6, "11")') + tdSql.checkData(0, 6, "11") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -682,8 +686,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 8 then @@ -692,8 +696,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 9 then - tdLog.info('tdSql.checkData(0, 4, 9)') - tdSql.checkData(0, 4, 9) + tdLog.info('tdSql.checkData(0, 4, "9")') + tdSql.checkData(0, 4, "9") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 10.000000000 then @@ -702,13 +706,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 11 then - tdLog.info('tdSql.checkData(0, 6, 11)') - tdSql.checkData(0, 6, 11) + tdLog.info('tdSql.checkData(0, 6, "11")') + tdSql.checkData(0, 6, "11") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -728,8 +736,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 8 then @@ -738,8 +746,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 9 then - tdLog.info('tdSql.checkData(0, 4, 9)') - tdSql.checkData(0, 4, 9) + tdLog.info('tdSql.checkData(0, 4, "9")') + tdSql.checkData(0, 4, "9") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 10.000000000 then @@ -748,13 +756,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 11 then - tdLog.info('tdSql.checkData(0, 6, 11)') - tdSql.checkData(0, 6, 11) + tdLog.info('tdSql.checkData(0, 6, "11")') + tdSql.checkData(0, 6, "11") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -774,8 +786,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 8 then @@ -784,8 +796,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 9 then - tdLog.info('tdSql.checkData(0, 4, 9)') - tdSql.checkData(0, 4, 9) + tdLog.info('tdSql.checkData(0, 4, "9")') + tdSql.checkData(0, 4, "9") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 10.000000000 then @@ -794,13 +806,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 11 then - tdLog.info('tdSql.checkData(0, 6, 11)') - tdSql.checkData(0, 6, 11) + tdLog.info('tdSql.checkData(0, 6, "11")') + tdSql.checkData(0, 6, "11") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -820,8 +836,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 7 then - tdLog.info('tdSql.checkData(0, 2, 7)') - tdSql.checkData(0, 2, 7) + tdLog.info('tdSql.checkData(0, 2, "7")') + tdSql.checkData(0, 2, "7") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 8 then @@ -830,8 +846,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 9 then - tdLog.info('tdSql.checkData(0, 4, 9)') - tdSql.checkData(0, 4, 9) + tdLog.info('tdSql.checkData(0, 4, "9")') + tdSql.checkData(0, 4, "9") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 10.000000000 then @@ -840,21 +856,25 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 11 then - tdLog.info('tdSql.checkData(0, 6, 11)') - tdSql.checkData(0, 6, 11) + tdLog.info('tdSql.checkData(0, 6, "11")') + tdSql.checkData(0, 6, "11") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') # TSIM: sql drop database $db - tdLog.info('sql drop database $db') - tdSql.execute('sql drop database $db') + tdLog.info('drop database db') + tdSql.execute('drop database db') # TSIM: sql show databases tdLog.info('show databases') tdSql.query('show databases') From 30aa06ecca024c329f21ce09259cad808ba864f1 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 16 Jun 2020 17:23:53 +0800 Subject: [PATCH 23/33] fix del_stable.py issue. --- tests/pytest/fulltest.sh | 2 +- tests/pytest/regressiontest.sh | 2 +- tests/pytest/table/del_stable.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 58ab8b99b4..dfa3b55048 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -127,7 +127,7 @@ python3 ./test.py -f user/user_create.py python3 ./test.py -f user/pass_len.py # table -#python3 ./test.py -f table/del_stable.py +python3 ./test.py -f table/del_stable.py #query python3 ./test.py -f query/filter.py diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 22cc9d9af2..536af8e3f1 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -127,7 +127,7 @@ python3 ./test.py -f user/user_create.py python3 ./test.py -f user/pass_len.py # table -# python3 ./test.py -f table/del_stable.py +python3 ./test.py -f table/del_stable.py #query python3 ./test.py -f query/filter.py diff --git a/tests/pytest/table/del_stable.py b/tests/pytest/table/del_stable.py index e7fd0f1fb1..e458b6679f 100644 --- a/tests/pytest/table/del_stable.py +++ b/tests/pytest/table/del_stable.py @@ -40,13 +40,13 @@ class TDTestCase: try: tdSql.execute("select * from db.st") except Exception as e: - if e.args[0] != 'invalid table name': + if e.args[0] != 'mnode invalid table name': tdLog.exit(e) try: tdSql.execute("select * from db.tb") except Exception as e: - if e.args[0] != 'invalid table name': + if e.args[0] != 'mnode invalid table name': tdLog.exit(e) def stop(self): From 3d56707049707a4d67880b09de98c11f09216a31 Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Tue, 16 Jun 2020 18:19:03 +0800 Subject: [PATCH 24/33] fix td-642 --- src/client/src/tscSQLParser.c | 9 ++++-- src/tsdb/src/tsdbMeta.c | 4 +++ src/vnode/src/vnodeMain.c | 10 +++--- tests/script/general/parser/stream.sim | 44 ++++++++++---------------- 4 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 64c38f011c..db12693c29 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6082,11 +6082,14 @@ int32_t exprTreeFromSqlExpr(tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray* } } + if ((*pExpr)->_node.optr != TSDB_RELATION_EQUAL && (*pExpr)->_node.optr != TSDB_RELATION_NOT_EQUAL) { if (pRight->nodeType == TSQL_NODE_VALUE) { - if ( pRight->pVal->nType == TSDB_DATA_TYPE_BOOL - || pRight->pVal->nType == TSDB_DATA_TYPE_BINARY - || pRight->pVal->nType == TSDB_DATA_TYPE_NCHAR) { + if (pRight->pVal->nType == TSDB_DATA_TYPE_BOOL) { + return TSDB_CODE_TSC_INVALID_SQL; + } + if ((pRight->pVal->nType == TSDB_DATA_TYPE_BINARY || pRight->pVal->nType == TSDB_DATA_TYPE_NCHAR) + && (*pExpr)->_node.optr != TSDB_RELATION_LIKE) { return TSDB_CODE_TSC_INVALID_SQL; } } diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 7795f25b71..1f31f18ce1 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -600,6 +600,10 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { return -1; } + if (pTable->cqhandle != NULL) { + pRepo->appH.cqDropFunc(pTable->cqhandle); + } + tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name), tableId.tid, tableId.uid); if (tsdbRemoveTableFromMeta(pMeta, pTable, true) < 0) return -1; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 0882ee983d..fef0b071a6 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -325,6 +325,11 @@ void vnodeRelease(void *pVnodeRaw) { tsdbCloseRepo(pVnode->tsdb, 1); pVnode->tsdb = NULL; + // stop continuous query + if (pVnode->cq) + cqClose(pVnode->cq); + pVnode->cq = NULL; + if (pVnode->wal) walClose(pVnode->wal); pVnode->wal = NULL; @@ -436,11 +441,6 @@ static void vnodeCleanUp(SVnodeObj *pVnode) { pVnode->sync = NULL; } - // stop continuous query - if (pVnode->cq) - cqClose(pVnode->cq); - pVnode->cq = NULL; - // release local resources only after cutting off outside connections vnodeRelease(pVnode); } diff --git a/tests/script/general/parser/stream.sim b/tests/script/general/parser/stream.sim index 6c8d8f93ea..fca5f37d74 100644 --- a/tests/script/general/parser/stream.sim +++ b/tests/script/general/parser/stream.sim @@ -51,19 +51,20 @@ sql drop table strm ## [TBASE304] print ====== TBASE-304 sleep 10000 -print create mt -sql create table mt (ts timestamp, c1 int) tags(t1 int, t2 int) +# we cannot reset query cache in server side, as a workaround, +# set super table name to mt304, need to change back to mt later +print create mt304 +sql create table mt304 (ts timestamp, c1 int) tags(t1 int, t2 int) print create tb1 -sql create table tb1 using mt tags(1, 1) +sql create table tb1 using mt304 tags(1, 1) print create tb2 -sql create table tb2 using mt tags(1, -1) +sql create table tb2 using mt304 tags(1, -1) print create strm -sql create table strm as select count(*), avg(c1) from mt where t2 >= 0 interval(4s) sliding(2s) +sql create table strm as select count(*), avg(c1) from mt304 where t2 >= 0 interval(4s) sliding(2s) sql insert into tb1 values (now,1) sql insert into tb2 values (now,2) -sleep 20000 +sleep 100000 sql select * from strm; -sleep 1000 if $rows != 2 then print ==== expect rows = 2, actually returned rows = $rows return -1 @@ -75,11 +76,11 @@ print data02 = $data02 if $data02 != 1.000000000 then return -1 endi -sql alter table mt drop tag t2; +sql alter table mt304 drop tag t2; sql insert into tb2 values (now,2); sql insert into tb1 values (now,1); sql select * from strm; -sql alter table mt add tag t2 int; +sql alter table mt304 add tag t2 int; sleep 10000 sql select * from strm @@ -98,7 +99,7 @@ sleep 4000 sql insert into tb2 values (now, 2, 'tb2') sleep 4000 sql insert into tb3 values (now, 0, 'tb3') -sleep 6000 +sleep 60000 sql describe strm if $rows == 0 then @@ -134,11 +135,9 @@ endi ## The vnode client needs to refresh metadata cache to allow strm calculate tb4's data. But the current refreshing frequency is every 10 min ## commented out the case below to save running time sql create table tb4 using stb tags('a4') -sleep 6000 sql insert into tb4 values(now, 4, 'tb4') -sleep 10000 +sleep 60000 sql select * from strm order by ts desc -sleep 1000 print ======== data0: $data00 $data01 $data02 $data03 #print ======== data1: $data10 $data11 $data12 $data13 #print ======== data2: $data20 $data21 $data22 $data23 @@ -160,7 +159,7 @@ sleep 3000 # waiting for new tag valid sql insert into tb1 values (now, 1, 'tb1_a1') sleep 4000 sql insert into tb4 values (now, -4, 'tb4_b4') -sleep 10000 +sleep 100000 sql select * from strm order by ts desc sleep 1000 print ======== data0: $data00 $data01 $data02 $data03 @@ -191,9 +190,9 @@ sql create table tb3 using stb tags(3, 'tb3') sql create table tb4 using stb tags(4, 'tb4') sql create table strm0 as select count(ts), count(c1), max(c2), min(c4), first(c5), last(c6) from stb where ts < now + 30s interval(4s) sliding(2s) -sleep 10000 +sleep 1000 sql insert into tb0 values (now, 0, 0, 0, 0, 'binary0', '涛思0', true) tb1 values (now, 1, 1, 1, 1, 'binary1', '涛思1', false) tb2 values (now, 2, 2, 2, 2, 'binary2', '涛思2', true) tb3 values (now, 3, 3, 3, 3, 'binary3', '涛思3', false) tb4 values (now, 4, 4, 4, 4, 'binary4', '涛思4', true) -sleep 5000 +sleep 20000 sql select * from strm0 order by ts desc sleep 1000 if $rows != 2 then @@ -202,7 +201,7 @@ if $rows != 2 then endi sql insert into tb0 values (now, 10, 10, 10, 10, 'binary0', '涛思0', true) tb1 values (now, 11, 11, 11, 11, 'binary1', '涛思1', false) tb2 values (now, 12, 12, 12, 12, 'binary2', '涛思2', true) tb3 values (now, 13, 13, 13, 13, 'binary3', '涛思3', false) tb4 values (now, 14, 14, 14, 14, 'binary4', '涛思4', true) -sleep 5000 +sleep 30000 sql select * from strm0 order by ts desc sleep 1000 if $rows != 4 then @@ -210,15 +209,4 @@ if $rows != 4 then return -1 endi -sql drop database if exists strm_db_0 -sql show databases -if $rows != 0 then - return -1 -endi - -sql create database $db -sql use $db -sql create table stb (ts timestamp, c1 int) tags(t1 int) -sql create table tb1 using stb tags(1) - system sh/exec.sh -n dnode1 -s stop -x SIGINT From f75af3364e8a70e6230cc6def247a2e7980bcb1a Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 18:27:49 +0800 Subject: [PATCH 25/33] [TD-421] --- src/mnode/src/mnodeProfile.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c index 7552ea5c25..31ca47929c 100644 --- a/src/mnode/src/mnodeProfile.c +++ b/src/mnode/src/mnodeProfile.c @@ -235,14 +235,12 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - size_t size = sizeof(pConnObj->user); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - size = sizeof(ipStr); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -356,18 +354,16 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId)); pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, QUERY_ID_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - size_t size = sizeof(pConnObj->user); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - size = sizeof(ipStr); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -379,7 +375,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, TSDB_SHOW_SQL_LEN); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]); cols++; numOfRows++; @@ -479,18 +475,16 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->streamId)); pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, QUERY_ID_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - size_t size = sizeof(pConnObj->user); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - size = sizeof(ipStr); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, size); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -506,7 +500,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, TSDB_SHOW_SQL_LEN); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; From 646b5e53a7aba1d1e861c614b67040ab7939d5a1 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 11:03:23 +0000 Subject: [PATCH 26/33] remove race condition in retry timer --- src/rpc/src/rpcMain.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 9bb63b751a..f812d95188 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -555,18 +555,10 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort, return pConn; } -static void rpcCloseConn(void *thandle) { - SRpcConn *pConn = (SRpcConn *)thandle; +static void rpcReleaseConn(SRpcConn *pConn) { SRpcInfo *pRpc = pConn->pRpc; if (pConn->user[0] == 0) return; - rpcLockConn(pConn); - - if (pConn->user[0] == 0) { - rpcUnlockConn(pConn); - return; - } - pConn->user[0] = 0; if (taosCloseConn[pConn->connType]) (*taosCloseConn[pConn->connType])(pConn->chandle); @@ -591,7 +583,21 @@ static void rpcCloseConn(void *thandle) { taosFreeId(pRpc->idPool, pConn->sid); pConn->pContext = NULL; - tTrace("%s, rpc connection is closed", pConn->info); + tTrace("%s, rpc connection is released", pConn->info); +} + +static void rpcCloseConn(void *thandle) { + SRpcConn *pConn = (SRpcConn *)thandle; + if (pConn->user[0] == 0) return; + + rpcLockConn(pConn); + + if (pConn->user[0] == 0) { + rpcUnlockConn(pConn); + return; + } + + rpcReleaseConn(pConn); rpcUnlockConn(pConn); } @@ -911,8 +917,8 @@ static void rpcProcessBrokenLink(SRpcConn *pConn) { if (pConn->inType) rpcReportBrokenLinkToServer(pConn); + rpcReleaseConn(pConn); rpcUnlockConn(pConn); - rpcCloseConn(pConn); } static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) { @@ -1217,7 +1223,6 @@ static void rpcProcessConnError(void *param, void *id) { static void rpcProcessRetryTimer(void *param, void *tmrId) { SRpcConn *pConn = (SRpcConn *)param; SRpcInfo *pRpc = pConn->pRpc; - int reportDisc = 0; rpcLockConn(pConn); @@ -1233,19 +1238,17 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { } else { // close the connection tTrace("%s, failed to send msg:%s to %s:%hu", pConn->info, taosMsg[pConn->outType], pConn->peerFqdn, pConn->peerPort); - reportDisc = 1; + if (pConn->pContext) { + pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + rpcProcessConnError(pConn->pContext, NULL); + rpcReleaseConn(pConn); + } } } else { tTrace("%s, retry timer not processed", pConn->info); } rpcUnlockConn(pConn); - - if (reportDisc && pConn->pContext) { - pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - rpcProcessConnError(pConn->pContext, NULL); - rpcCloseConn(pConn); - } } static void rpcProcessIdleTimer(void *param, void *tmrId) { From c96e3b7ccc5b125716aea72b898edaee600c367d Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 19:20:06 +0800 Subject: [PATCH 27/33] [modify] --- .../dn3_mn1_vnode_corruptFile_offline.sim | 157 +++++++++++++++++- 1 file changed, 152 insertions(+), 5 deletions(-) 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 6062b07510..a7529d5bbc 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -93,7 +93,7 @@ if $data00 != $totalRows then return -1 endi -print ============== step3: stop dnode3, then corrupt vnode data file in dnode3 +print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3 system sh/exec.sh -n dnode3 -s stop -x SIGINT sleep $sleepTimer wait_dnode3_offline_0: @@ -141,13 +141,26 @@ if $dnode2Vtatus != master then goto wait_dnode3_vgroup_offline endi -# del the second row -system sed '2d' ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v1849.data -sleep 1000 +#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | sed 's/^[ \t]*//g' +#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | sed 's/[ \t]*$//g' +#print --2-->dnode3 data files: [ $system_content ] + +system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l +print ---->dnode2 data files: [ $system_content ], expect is 0 + +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 + +#system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/f1643.data +#sleep 1000 print ============== step4: restart dnode3, and run query system sh/exec.sh -n dnode3 -s start sleep $sleepTimer + wait_dnode3_reready: sql show dnodes if $rows != 3 then @@ -171,12 +184,49 @@ if $dnode3Status != ready then goto wait_dnode3_reready endi +wait_dnode3_vgroup_slave: +sql show vgroups +if $rows != 1 then + sleep 2000 + goto wait_dnode3_vgroup_slave +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 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 +$dnode2Vtatus = $data7_2 +$dnode3Vtatus = $data4_2 + +if $dnode2Vtatus != master then + sleep 2000 + goto wait_dnode3_vgroup_slave +endi +if $dnode3Vtatus != slave then + sleep 2000 + goto wait_dnode3_vgroup_slave +endi + sql select count(*) from $stb print data00 $data00 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 0 +#if $system_content != 0 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 0 +#if $system_content != 0 then +# print there should be no data file in dnode3 after sync +# return -1 +#endi + +return -1 + print ============== step5: stop dnode2, and check if dnode3 sync ok system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer @@ -229,4 +279,101 @@ sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 -endi \ No newline at end of file +endi + +print ============== step6: stop dnode3 for falling disck +system sh/exec.sh -n dnode3 -s stop -x SIGINT +sleep $sleepTimer +sql show dnodes +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 + +sql show vgroups +print show vgroups: +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 +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 +system sh/exec.sh -n dnode3 -s start +sleep $sleepTimer +$loopCnt = 0 +wait_dnode3_reready_2: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi +sql show dnodes +if $rows != 3 then + sleep 2000 + goto wait_dnode3_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 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 + +if $dnode3Status != ready then + sleep 2000 + goto wait_dnode3_reready_2 +endi + +$loopCnt = 0 +wait_dnode3_vgroup_master_2: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi +sql show vgroups +if $rows != 1 then + sleep 2000 + goto wait_dnode3_vgroup_master_2 +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 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 +$dnode2Vtatus = $data7_2 +$dnode3Vtatus = $data4_2 + +if $dnode2Vtatus != offline then + sleep 2000 + goto wait_dnode3_vgroup_master_2 +endi +if $dnode3Vtatus != master then + sleep 2000 + goto wait_dnode3_vgroup_master_2 +endi + +sql select count(*) from $stb +print data00 $data00 +if $data00 != $totalRows then + return -1 +endi + + + + + + + + + + + + + + + + + + + + + + + From 2ab6298003e6d0904126584bf19f75eec53baf4b Mon Sep 17 00:00:00 2001 From: Hui Li Date: Tue, 16 Jun 2020 19:34:19 +0800 Subject: [PATCH 28/33] [modify] --- .../arbitrator/dn2_mn1_cache_file_sync.sim | 77 +++++++++++++++---- 1 file changed, 63 insertions(+), 14 deletions(-) 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 cfd992db3a..2620746d38 100644 --- a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim +++ b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim @@ -1,11 +1,11 @@ # Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode # step 1: start dnode1 # step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode) -# step 3: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841) -# step 4: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc -# step 5: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2 -# step 6: insert two data rows: now-21d, now-41d -# step 7: restart dnode2, waiting sync end +# step 2: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841) +# step 3: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc +# step 4: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2 +# step 5: insert two data rows: now-21d, now-41d +# step 6: restart dnode2, waiting sync end # expect: in dnode2, the files 1837 and 1839 will be removed system sh/stop_dnodes.sh @@ -113,15 +113,15 @@ sql insert into $tb values ( now - 20d , -20 ) sql insert into $tb values ( now - 40d , -40 ) $totalRows = $totalRows + 2 -print ============== step4: stop dnode2, so date rows falling disc, generate two new files in dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT +print ============== step4: stop dnode3, so date rows falling disc, generate two new files in dnode3 +system sh/exec.sh -n dnode3 -s stop -x SIGINT sleep $sleepTimer -wait_dnode2_offline: +wait_dnode3_offline: sql show dnodes if $rows != 3 then sleep 2000 - goto wait_dnode2_offline + goto wait_dnode3_offline endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 @@ -135,13 +135,13 @@ $dnode3Status = $data4_3 #$dnode4Status = $data4_4 #$dnode5Status = $data4_5 -if $dnode2Status != offline then +if $dnode3Status != offline then sleep 2000 - goto wait_dnode2_offline + goto wait_dnode3_offline endi -if $dnode3Status != ready then +if $dnode2Status != ready then sleep 2000 - goto wait_dnode2_offline + goto wait_dnode3_offline endi sleep $sleepTimer # waitting for move master vnode of dnode2 to dnode3 @@ -152,6 +152,12 @@ 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 + print ============== step5: insert two data rows: now-16d, now+16d, sql insert into $tb values ( now - 21d , -21 ) sql insert into $tb values ( now - 41d , -41 ) @@ -163,4 +169,47 @@ if $data00 != $totalRows then return -1 endi -print ============== step6: please check there should be 3 file in sim/dnode2/data/vnode/vnode2/tsdb/data/, and 1 file sim/dnode3/data/vnode/vnode2/tsdb/data/ +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 + +print ============== step7: restart dnode3, waiting sync end +system sh/exec.sh -n dnode3 -s start +sleep 3000 + +wait_dnode3_ready: +sql show dnodes +if $rows != 3 then + sleep 2000 + goto wait_dnode3_ready +endi +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 + +if $dnode3Status != ready then + sleep 2000 + goto wait_dnode3_ready +endi + +sql select count(*) from $stb +print data00 $data00 +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 From 4e87a28e8d0c980f2ea1c5d00cf530145d88a955 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 12:03:36 +0000 Subject: [PATCH 29/33] fix deadlock --- src/rpc/src/rpcMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index f812d95188..d455cd645f 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1240,7 +1240,7 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { tTrace("%s, failed to send msg:%s to %s:%hu", pConn->info, taosMsg[pConn->outType], pConn->peerFqdn, pConn->peerPort); if (pConn->pContext) { pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - rpcProcessConnError(pConn->pContext, NULL); + taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl); rpcReleaseConn(pConn); } } From 58922d86002a7d3772faba8229ef48e0951e693a Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 12:05:25 +0000 Subject: [PATCH 30/33] compiling error --- src/rpc/src/rpcMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index d455cd645f..2e2202a31b 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1240,7 +1240,7 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { tTrace("%s, failed to send msg:%s to %s:%hu", pConn->info, taosMsg[pConn->outType], pConn->peerFqdn, pConn->peerPort); if (pConn->pContext) { pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl); + taosTmrStart(rpcProcessConnError, 0, pConn->pContext, pRpc->tmrCtrl); rpcReleaseConn(pConn); } } From 387f162ddf2f0e562858eafd37827e8cf8df602f Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 12:36:58 +0000 Subject: [PATCH 31/33] add lock in all timer processing --- src/rpc/src/rpcMain.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 2e2202a31b..90f11bb3de 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -490,6 +490,7 @@ void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pMsg, SRpcMsg int rpcReportProgress(void *handle, char *pCont, int contLen) { SRpcConn *pConn = (SRpcConn *)handle; + rpcLockConn(pConn); if (pConn->user[0]) { // pReqMsg and reqMsgLen is re-used to store the context from app server pConn->pReqMsg = pCont; @@ -499,6 +500,8 @@ int rpcReportProgress(void *handle, char *pCont, int contLen) { tTrace("%s, rpc connection is already released", pConn->info); rpcFreeCont(pCont); + rpcUnlockConn(pConn); + return -1; } @@ -1254,13 +1257,17 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { static void rpcProcessIdleTimer(void *param, void *tmrId) { SRpcConn *pConn = (SRpcConn *)param; + rpcLockConn(pConn); + if (pConn->user[0]) { tTrace("%s, close the connection since no activity", pConn->info); if (pConn->inType) rpcReportBrokenLinkToServer(pConn); - rpcCloseConn(pConn); + rpcReleaseConn(pConn); } else { tTrace("%s, idle timer:%p not processed", pConn->info, tmrId); } + + rpcUnlockConn(pConn); } static void rpcProcessProgressTimer(void *param, void *tmrId) { From f3f0e39ab16f4bf6fb4675c8b62e28b6a8480a47 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 13:12:27 +0000 Subject: [PATCH 32/33] deadlock --- src/rpc/src/rpcMain.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 90f11bb3de..1558de37ea 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -489,20 +489,22 @@ void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pMsg, SRpcMsg // this API is used by server app to keep an APP context in case connection is broken int rpcReportProgress(void *handle, char *pCont, int contLen) { SRpcConn *pConn = (SRpcConn *)handle; + int code = 0; rpcLockConn(pConn); + if (pConn->user[0]) { // pReqMsg and reqMsgLen is re-used to store the context from app server pConn->pReqMsg = pCont; pConn->reqMsgLen = contLen; - return 0; - } + } else { + tTrace("%s, rpc connection is already released", pConn->info); + rpcFreeCont(pCont); + code = -1; + } - tTrace("%s, rpc connection is already released", pConn->info); - rpcFreeCont(pCont); rpcUnlockConn(pConn); - - return -1; + return code; } /* todo: cancel process may have race condition, pContext may have been released From a703510f1bd0598634dfa04b5f54fa533e6c4e03 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 16 Jun 2020 13:40:18 +0000 Subject: [PATCH 33/33] tune up code --- src/rpc/src/rpcMain.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 1558de37ea..989021eb52 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -593,16 +593,11 @@ static void rpcReleaseConn(SRpcConn *pConn) { static void rpcCloseConn(void *thandle) { SRpcConn *pConn = (SRpcConn *)thandle; - if (pConn->user[0] == 0) return; rpcLockConn(pConn); - if (pConn->user[0] == 0) { - rpcUnlockConn(pConn); - return; - } - - rpcReleaseConn(pConn); + if (pConn->user[0]) + rpcReleaseConn(pConn); rpcUnlockConn(pConn); }