diff --git a/2.0/src/query/tests/astTest.cpp b/2.0/src/query/tests/astTest.cpp index b7df7499831817c676c59a1547e5af59c3d42504..1109d25f298d1975e15c8a8c5462445e60670811 100644 --- a/2.0/src/query/tests/astTest.cpp +++ b/2.0/src/query/tests/astTest.cpp @@ -632,4 +632,6 @@ void exprSerializeTest2() { TEST(testCase, astTest) { // exprSerializeTest2(); } -#endif \ No newline at end of file +#endif + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/cSortTest.cpp b/2.0/src/query/tests/cSortTest.cpp index aa5aa89afc211678cfc521dccd46fbdb533fbff1..64e3b41b49244b9170670fedf86e9e87a9500752 100644 --- a/2.0/src/query/tests/cSortTest.cpp +++ b/2.0/src/query/tests/cSortTest.cpp @@ -5,6 +5,7 @@ #include "tsdb.h" #include "qExtbuffer.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -121,4 +122,6 @@ TEST(testCase, columnsort_test) { printf("\n"); destroyColumnModel(pModel); -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/histogramTest.cpp b/2.0/src/query/tests/histogramTest.cpp index 0266ecffc11348dcd0184030584ed7b721d39aff..ff5ac08cdc065aae9bfa60e627dffa9a0cac10fb 100644 --- a/2.0/src/query/tests/histogramTest.cpp +++ b/2.0/src/query/tests/histogramTest.cpp @@ -6,6 +6,7 @@ #include "taos.h" #include "qHistogram.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -140,3 +141,5 @@ TEST(testCase, heapsort) { // // free(pEntry); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/patternMatchTest.cpp b/2.0/src/query/tests/patternMatchTest.cpp index 091604c65c0e8b7fcf998fdd69f6f82f101f8157..3b46c91bc39087660013f302d5b1a5df8fd30c72 100644 --- a/2.0/src/query/tests/patternMatchTest.cpp +++ b/2.0/src/query/tests/patternMatchTest.cpp @@ -6,6 +6,7 @@ #include "qAggMain.h" #include "tcompare.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -84,3 +85,5 @@ TEST(testCase, patternMatchTest) { ret = patternMatch("%9", str, 2, &info); EXPECT_EQ(ret, TSDB_PATTERN_MATCH); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/percentileTest.cpp b/2.0/src/query/tests/percentileTest.cpp index 1b6951201af5908378fb253b38cea01de1210d57..7c4d85b3aed5d897dca554f8091df749f228d86a 100644 --- a/2.0/src/query/tests/percentileTest.cpp +++ b/2.0/src/query/tests/percentileTest.cpp @@ -7,6 +7,7 @@ #include "qPercentile.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -255,3 +256,5 @@ TEST(testCase, percentileTest) { unsignedDataTest(); largeDataTest(); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/rangeMergeTest.cpp b/2.0/src/query/tests/rangeMergeTest.cpp index f7fc558ccfa71ffc186725ea820e81eb90045d7b..9bbf47e56d1f0148682a83088dc3580e0c470b73 100644 --- a/2.0/src/query/tests/rangeMergeTest.cpp +++ b/2.0/src/query/tests/rangeMergeTest.cpp @@ -7,6 +7,7 @@ #include "qFilter.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -365,3 +366,5 @@ TEST(testCase, rangeMergeTest) { intDataTest(); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/resultBufferTest.cpp b/2.0/src/query/tests/resultBufferTest.cpp index 54ac0bf4e5c78f2fcc7f0e3271eb3409ea072db7..9724b98f7cf90f41035ad9f168fba787e0d878c8 100644 --- a/2.0/src/query/tests/resultBufferTest.cpp +++ b/2.0/src/query/tests/resultBufferTest.cpp @@ -6,6 +6,7 @@ #include "taos.h" #include "tsdb.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -161,3 +162,5 @@ TEST(testCase, resultBufferTest) { writeDownTest(); recyclePageTest(); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/tsBufTest.cpp b/2.0/src/query/tests/tsBufTest.cpp index 04c5a152520d08329408253af271c4d43c5c0fe3..62ffa785c65a3f9e2a47383bd88519e170bf4989 100644 --- a/2.0/src/query/tests/tsBufTest.cpp +++ b/2.0/src/query/tests/tsBufTest.cpp @@ -9,6 +9,7 @@ #include "ttoken.h" #include "tutil.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" @@ -513,3 +514,5 @@ TEST(testCase, tsBufTest) { mergeDiffVnodeBufferTest(); mergeIdenticalVnodeBufferTest(); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/2.0/src/query/tests/unitTest.cpp b/2.0/src/query/tests/unitTest.cpp index 1ed4cde40653aaed99031fca81a8719a3f748b6b..57f66ef466503fca7e9398eecd0af89d67e81375 100644 --- a/2.0/src/query/tests/unitTest.cpp +++ b/2.0/src/query/tests/unitTest.cpp @@ -4,6 +4,7 @@ #include "taos.h" #include "tsdb.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" @@ -910,3 +911,4 @@ TEST(testCase, getTempFilePath_test) { printf("%s\n", path); } +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 99e48006b19b0d12d9faa3ce2d51987d1cf4bfe7..0383cc8aed9292ce18911662319d421ae2e3b3c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(CMAKE_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_CONTRIB_DIR "${CMAKE_SOURCE_DIR}/contrib") include(${CMAKE_SUPPORT_DIR}/cmake.options) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -gdwarf-2 -msse4.2 -mfma -g3") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -gdwarf-2 -msse4.2 -mfma -g3") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -fPIC -gdwarf-2 -msse4.2 -mfma -g3") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fPIC -gdwarf-2 -msse4.2 -mfma -g3") # contrib add_subdirectory(contrib) diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 736a47273fd68fa9fa15fc2f3d8d0bb821b360f3..b0f7645d82f39082afdd4f553fa80b84b565cebe 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -17,8 +17,9 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -678,4 +679,6 @@ TEST(testCase, create_topic_Test) { // // taos_free_result(pRes); // taos_close(pConn); -//} \ No newline at end of file +//} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/common/test/commonTests.cpp b/source/common/test/commonTests.cpp index 2f821ee8b91dd8c5d9ff6b7e18c129c51618074e..b91b6b06f227eacfa2a23608afe56dea2e506b91 100644 --- a/source/common/test/commonTests.cpp +++ b/source/common/test/commonTests.cpp @@ -1,7 +1,8 @@ #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-but-set-variable" @@ -94,3 +95,5 @@ TEST(testCase, toInteger_test) { ret = toInteger(s, strlen(s), 10, &val, &sign); ASSERT_EQ(ret, -1); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/dnode/vnode/inc/tq.h b/source/dnode/vnode/inc/tq.h index 8c4effa221f437acebab25fa34386135f9572bb4..2685ac4964b16d06e8346c0c85fc728d5d6baa90 100644 --- a/source/dnode/vnode/inc/tq.h +++ b/source/dnode/vnode/inc/tq.h @@ -320,6 +320,8 @@ void tqClose(STQ*); int tqPushMsg(STQ*, void* msg, int64_t version); int tqCommit(STQ*); +int tqSetCursor(STQ*, STqSetCurReq* pMsg); + #if 0 int tqConsume(STQ*, SRpcMsg* pReq, SRpcMsg** pRsp); int tqSetCursor(STQ*, STqSetCurReq* pMsg); diff --git a/source/dnode/vnode/src/meta/metaTbCfg.c b/source/dnode/vnode/src/meta/metaTbCfg.c index 4e02b64ce043c41ff40b04abdfedd2f2296f9bff..d71d319a79d4ddd2dc94fb388bbac7030b9ad955 100644 --- a/source/dnode/vnode/src/meta/metaTbCfg.c +++ b/source/dnode/vnode/src/meta/metaTbCfg.c @@ -32,7 +32,7 @@ size_t metaEncodeTbObjFromTbOptions(const STbCfg *pTbOptions, void *pBuf, size_t switch (pTbOptions->type) { case META_SUPER_TABLE: tlen += taosEncodeFixedU64(ppBuf, pTbOptions->stbCfg.suid); - tlen += tdEncodeSchema(ppBuf, pTbOptions->stbCfg.pTagSchema); + tlen += tdEncodeSchema(ppBuf, (STSchema *)pTbOptions->stbCfg.pTagSchema); // TODO: encode schema version array break; case META_CHILD_TABLE: diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index dd1e5ba9ae302746d4d29f198deaf7705f694f65..9390e1952386758823f050b321717edd4f3ade37 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -19,7 +19,10 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg); static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); -int vnodeQueryOpen(SVnode *pVnode) { return qWorkerInit(NODE_TYPE_VNODE, pVnode->vgId, NULL, &pVnode->pQuery, pVnode, vnodePutReqToVQueryQ); } +int vnodeQueryOpen(SVnode *pVnode) { + return qWorkerInit(NODE_TYPE_VNODE, pVnode->vgId, NULL, (void **)&pVnode->pQuery, pVnode, + (putReqToQueryQFp)vnodePutReqToVQueryQ); +} int vnodeProcessQueryReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { vTrace("query message is processing"); diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index 436593f9d6fef03304fd7791787f2fe6e125d564..a01c3bcf5de3bce63bff4823cfdc182f3b29fb99 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -16,27 +16,28 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#include "os.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" -#include "os.h" +#pragma GCC diagnostic ignored "-Wformat" +#include "addr_any.h" +#include "catalog.h" +#include "stub.h" #include "taos.h" #include "tdef.h" -#include "tvariant.h" -#include "catalog.h" #include "tep.h" #include "trpc.h" -#include "stub.h" -#include "addr_any.h" - - +#include "tvariant.h" namespace { -extern "C" int32_t ctgGetTableMetaFromCache(struct SCatalog* pCatalog, const SName* pTableName, STableMeta** pTableMeta, int32_t *exist); +extern "C" int32_t ctgGetTableMetaFromCache(struct SCatalog *pCatalog, const SName *pTableName, STableMeta **pTableMeta, + int32_t *exist); extern "C" int32_t ctgUpdateTableMetaCache(struct SCatalog *pCatalog, STableMetaOutput *output); void ctgTestSetPrepareTableMeta(); @@ -44,9 +45,9 @@ void ctgTestSetPrepareCTableMeta(); void ctgTestSetPrepareSTableMeta(); void ctgTestSetPrepareMultiSTableMeta(); -bool ctgTestStop = false; -bool ctgTestEnableSleep = false; -bool ctgTestDeadLoop = false; +bool ctgTestStop = false; +bool ctgTestEnableSleep = false; +bool ctgTestDeadLoop = false; int32_t ctgTestPrintNum = 200000; int32_t ctgTestMTRunSec = 30; @@ -61,14 +62,13 @@ int32_t ctgTestSuid = 2; int64_t ctgTestDbId = 33; uint64_t ctgTestClusterId = 0x1; -char *ctgTestDbname = "1.db1"; -char *ctgTestTablename = "table1"; -char *ctgTestCTablename = "ctable1"; -char *ctgTestSTablename = "stable1"; - +char *ctgTestDbname = "1.db1"; +char *ctgTestTablename = "table1"; +char *ctgTestCTablename = "ctable1"; +char *ctgTestSTablename = "stable1"; void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) { - SCreateDbReq* pReq = (SCreateDbReq*)rpcMallocCont(sizeof(SCreateDbReq)); + SCreateDbReq *pReq = (SCreateDbReq *)rpcMallocCont(sizeof(SCreateDbReq)); strcpy(pReq->db, "1.db1"); pReq->numOfVgroups = htonl(2); pReq->cacheBlockSize = htonl(16); @@ -89,7 +89,7 @@ void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) { pReq->update = 0; pReq->cacheLastRow = 0; pReq->ignoreExist = 1; - + SRpcMsg rpcMsg = {0}; rpcMsg.pCont = pReq; rpcMsg.contLen = sizeof(SCreateDbReq); @@ -103,8 +103,8 @@ void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) { } void ctgTestInitLogFile() { - const char *defaultLogFileNamePrefix = "taoslog"; - const int32_t maxLogFileNum = 10; + const char *defaultLogFileNamePrefix = "taoslog"; + const int32_t maxLogFileNum = 10; tsAsyncLog = 0; @@ -113,7 +113,6 @@ void ctgTestInitLogFile() { if (taosInitLog(temp, tsNumOfLogLines, maxLogFileNum) < 0) { printf("failed to open log file in directory:%s\n", tsLogDir); } - } int32_t ctgTestGetVgNumFromVgVersion(int32_t vgVersion) { @@ -152,10 +151,10 @@ void ctgTestBuildCTableMetaOutput(STableMetaOutput *output) { output->tbMeta->tableInfo.numOfColumns = ctgTestColNum; output->tbMeta->tableInfo.numOfTags = ctgTestTagNum; - + output->tbMeta->sversion = ctgTestSVersion; output->tbMeta->tversion = ctgTestTVersion; - + SSchema *s = NULL; s = &output->tbMeta->schema[0]; s->type = TSDB_DATA_TYPE_TIMESTAMP; @@ -174,18 +173,17 @@ void ctgTestBuildCTableMetaOutput(STableMetaOutput *output) { s->colId = 3; s->bytes = 12; strcpy(s->name, "tag1s"); - } void ctgTestBuildDBVgroup(SDBVgroupInfo *dbVgroup) { static int32_t vgVersion = ctgTestVgVersion + 1; - int32_t vgNum = 0; - SVgroupInfo vgInfo = {0}; - + int32_t vgNum = 0; + SVgroupInfo vgInfo = {0}; + dbVgroup->vgVersion = vgVersion++; - + ctgTestCurrentVgVersion = dbVgroup->vgVersion; - + dbVgroup->hashMethod = 0; dbVgroup->dbId = ctgTestDbId; dbVgroup->vgInfo = taosHashInit(ctgTestVgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK); @@ -210,9 +208,9 @@ void ctgTestBuildDBVgroup(SDBVgroupInfo *dbVgroup) { } void ctgTestPrepareDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { - SUseDbRsp *rspMsg = NULL; //todo + SUseDbRsp *rspMsg = NULL; // todo - pRsp->code =0; + pRsp->code = 0; pRsp->contLen = sizeof(SUseDbRsp) + ctgTestVgNum * sizeof(SVgroupInfo); pRsp->pCont = calloc(1, pRsp->contLen); rspMsg = (SUseDbRsp *)pRsp->pCont; @@ -224,7 +222,7 @@ void ctgTestPrepareDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcM rspMsg->uid = htobe64(ctgTestDbId); SVgroupInfo *vg = NULL; - uint32_t hashUnit = UINT32_MAX / ctgTestVgNum; + uint32_t hashUnit = UINT32_MAX / ctgTestVgNum; for (int32_t i = 0; i < ctgTestVgNum; ++i) { vg = &rspMsg->vgroupInfo[i]; @@ -245,13 +243,10 @@ void ctgTestPrepareDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcM return; } - - - void ctgTestPrepareTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { - STableMetaRsp *rspMsg = NULL; //todo + STableMetaRsp *rspMsg = NULL; // todo - pRsp->code =0; + pRsp->code = 0; pRsp->contLen = sizeof(STableMetaRsp) + (ctgTestColNum + ctgTestTagNum) * sizeof(SSchema); pRsp->pCont = calloc(1, pRsp->contLen); rspMsg = (STableMetaRsp *)pRsp->pCont; @@ -279,15 +274,14 @@ void ctgTestPrepareTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcM s->colId = htonl(2); s->bytes = htonl(4); strcpy(s->name, "col1"); - + return; } - void ctgTestPrepareCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { - STableMetaRsp *rspMsg = NULL; //todo + STableMetaRsp *rspMsg = NULL; // todo - pRsp->code =0; + pRsp->code = 0; pRsp->contLen = sizeof(STableMetaRsp) + (ctgTestColNum + ctgTestTagNum) * sizeof(SSchema); pRsp->pCont = calloc(1, pRsp->contLen); rspMsg = (STableMetaRsp *)pRsp->pCont; @@ -323,15 +317,13 @@ void ctgTestPrepareCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpc s->bytes = htonl(12); strcpy(s->name, "tag1s"); - return; } - void ctgTestPrepareSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { - STableMetaRsp *rspMsg = NULL; //todo + STableMetaRsp *rspMsg = NULL; // todo - pRsp->code =0; + pRsp->code = 0; pRsp->contLen = sizeof(STableMetaRsp) + (ctgTestColNum + ctgTestTagNum) * sizeof(SSchema); pRsp->pCont = calloc(1, pRsp->contLen); rspMsg = (STableMetaRsp *)pRsp->pCont; @@ -367,15 +359,14 @@ void ctgTestPrepareSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpc s->bytes = htonl(12); strcpy(s->name, "tag1s"); - return; } void ctgTestPrepareMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { - STableMetaRsp *rspMsg = NULL; //todo + STableMetaRsp *rspMsg = NULL; // todo static int32_t idx = 1; - pRsp->code =0; + pRsp->code = 0; pRsp->contLen = sizeof(STableMetaRsp) + (ctgTestColNum + ctgTestTagNum) * sizeof(SSchema); pRsp->pCont = calloc(1, pRsp->contLen); rspMsg = (STableMetaRsp *)pRsp->pCont; @@ -412,55 +403,50 @@ void ctgTestPrepareMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, strcpy(s->name, "tag1s"); ++idx; - + return; } - - void ctgTestPrepareDbVgroupsAndNormalMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { ctgTestPrepareDbVgroups(shandle, pEpSet, pMsg, pRsp); - + ctgTestSetPrepareTableMeta(); - + return; } - void ctgTestPrepareDbVgroupsAndChildMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { ctgTestPrepareDbVgroups(shandle, pEpSet, pMsg, pRsp); - + ctgTestSetPrepareCTableMeta(); - + return; } void ctgTestPrepareDbVgroupsAndSuperMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { ctgTestPrepareDbVgroups(shandle, pEpSet, pMsg, pRsp); - + ctgTestSetPrepareSTableMeta(); - + return; } void ctgTestPrepareDbVgroupsAndMultiSuperMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { ctgTestPrepareDbVgroups(shandle, pEpSet, pMsg, pRsp); - + ctgTestSetPrepareMultiSTableMeta(); - + return; } - - void ctgTestSetPrepareDbVgroups() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareDbVgroups); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareDbVgroups); } } @@ -470,10 +456,10 @@ void ctgTestSetPrepareTableMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareTableMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareTableMeta); } } @@ -483,10 +469,10 @@ void ctgTestSetPrepareCTableMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareCTableMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareCTableMeta); } } @@ -496,10 +482,10 @@ void ctgTestSetPrepareSTableMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareSTableMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareSTableMeta); } } @@ -509,38 +495,36 @@ void ctgTestSetPrepareMultiSTableMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareMultiSTableMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareMultiSTableMeta); } } } - void ctgTestSetPrepareDbVgroupsAndNormalMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareDbVgroupsAndNormalMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareDbVgroupsAndNormalMeta); } } } - void ctgTestSetPrepareDbVgroupsAndChildMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareDbVgroupsAndChildMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareDbVgroupsAndChildMeta); } } @@ -550,10 +534,10 @@ void ctgTestSetPrepareDbVgroupsAndSuperMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareDbVgroupsAndSuperMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareDbVgroupsAndSuperMeta); } } @@ -563,25 +547,24 @@ void ctgTestSetPrepareDbVgroupsAndMultiSuperMeta() { static Stub stub; stub.set(rpcSendRecv, ctgTestPrepareDbVgroupsAndMultiSuperMeta); { - AddrAny any("libtransport.so"); - std::map result; + AddrAny any("libtransport.so"); + std::map result; any.get_global_func_addr_dynsym("^rpcSendRecv$", result); - for (const auto& f : result) { + for (const auto &f : result) { stub.set(f.second, ctgTestPrepareDbVgroupsAndMultiSuperMeta); } } } - -} +} // namespace void *ctgTestGetDbVgroupThread(void *param) { - struct SCatalog* pCtg = (struct SCatalog*)param; - int32_t code = 0; - void *mockPointer = (void *)0x1; - SArray *vgList = NULL; - int32_t n = 0; - + struct SCatalog *pCtg = (struct SCatalog *)param; + int32_t code = 0; + void *mockPointer = (void *)0x1; + SArray *vgList = NULL; + int32_t n = 0; + while (!ctgTestStop) { code = catalogGetDBVgroup(pCtg, mockPointer, (const SEpSet *)mockPointer, ctgTestDbname, false, &vgList); if (code) { @@ -593,7 +576,7 @@ void *ctgTestGetDbVgroupThread(void *param) { } if (ctgTestEnableSleep) { - usleep(rand()%5); + usleep(rand() % 5); } if (++n % ctgTestPrintNum == 0) { printf("Get:%d\n", n); @@ -604,11 +587,11 @@ void *ctgTestGetDbVgroupThread(void *param) { } void *ctgTestSetDbVgroupThread(void *param) { - struct SCatalog* pCtg = (struct SCatalog*)param; - int32_t code = 0; - SDBVgroupInfo dbVgroup = {0}; - int32_t n = 0; - + struct SCatalog *pCtg = (struct SCatalog *)param; + int32_t code = 0; + SDBVgroupInfo dbVgroup = {0}; + int32_t n = 0; + while (!ctgTestStop) { ctgTestBuildDBVgroup(&dbVgroup); code = catalogUpdateDBVgroup(pCtg, ctgTestDbname, &dbVgroup); @@ -616,8 +599,8 @@ void *ctgTestSetDbVgroupThread(void *param) { assert(0); } - if (ctgTestEnableSleep) { - usleep(rand()%5); + if (ctgTestEnableSleep) { + usleep(rand() % 5); } if (++n % ctgTestPrintNum == 0) { printf("Set:%d\n", n); @@ -625,20 +608,19 @@ void *ctgTestSetDbVgroupThread(void *param) { } return NULL; - } void *ctgTestGetCtableMetaThread(void *param) { - struct SCatalog* pCtg = (struct SCatalog*)param; - int32_t code = 0; - int32_t n = 0; - STableMeta* tbMeta = NULL; - int32_t exist = 0; + struct SCatalog *pCtg = (struct SCatalog *)param; + int32_t code = 0; + int32_t n = 0; + STableMeta *tbMeta = NULL; + int32_t exist = 0; SName cn = {.type = TSDB_TABLE_NAME_T, .acctId = 1}; strcpy(cn.dbname, "db1"); strcpy(cn.tname, ctgTestCTablename); - + while (!ctgTestStop) { code = ctgGetTableMetaFromCache(pCtg, &cn, &tbMeta, &exist); if (code || 0 == exist) { @@ -648,9 +630,9 @@ void *ctgTestGetCtableMetaThread(void *param) { tfree(tbMeta); if (ctgTestEnableSleep) { - usleep(rand()%5); + usleep(rand() % 5); } - + if (++n % ctgTestPrintNum == 0) { printf("Get:%d\n", n); } @@ -660,22 +642,22 @@ void *ctgTestGetCtableMetaThread(void *param) { } void *ctgTestSetCtableMetaThread(void *param) { - struct SCatalog* pCtg = (struct SCatalog*)param; - int32_t code = 0; - SDBVgroupInfo dbVgroup = {0}; - int32_t n = 0; + struct SCatalog *pCtg = (struct SCatalog *)param; + int32_t code = 0; + SDBVgroupInfo dbVgroup = {0}; + int32_t n = 0; STableMetaOutput output = {0}; ctgTestBuildCTableMetaOutput(&output); - + while (!ctgTestStop) { code = ctgUpdateTableMetaCache(pCtg, &output); if (code) { assert(0); } - if (ctgTestEnableSleep) { - usleep(rand()%5); + if (ctgTestEnableSleep) { + usleep(rand() % 5); } if (++n % ctgTestPrintNum == 0) { printf("Set:%d\n", n); @@ -685,21 +667,19 @@ void *ctgTestSetCtableMetaThread(void *param) { tfree(output.tbMeta); return NULL; - } - TEST(tableMeta, normalTable) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; ctgTestSetPrepareDbVgroups(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); @@ -715,7 +695,6 @@ TEST(tableMeta, normalTable) { ASSERT_EQ(vgInfo.vgId, 8); ASSERT_EQ(vgInfo.numOfEps, 3); - ctgTestSetPrepareTableMeta(); STableMeta *tableMeta = NULL; @@ -742,19 +721,19 @@ TEST(tableMeta, normalTable) { ASSERT_EQ(tableMeta->tableInfo.precision, 1); ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); - SDbVgVersion *dbs = NULL; + SDbVgVersion *dbs = NULL; SSTableMetaVersion *stb = NULL; - uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; - int32_t i = 0; + uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; + int32_t i = 0; while (i < 5) { ++i; code = catalogGetExpiredDBs(pCtg, &dbs, &dbNum); ASSERT_EQ(code, 0); code = catalogGetExpiredSTables(pCtg, &stb, &stbNum); ASSERT_EQ(code, 0); - + if (dbNum) { - printf("got expired db,dbId:%"PRId64"\n", dbs->dbId); + printf("got expired db,dbId:%" PRId64 "\n", dbs->dbId); free(dbs); dbs = NULL; } else { @@ -762,7 +741,7 @@ TEST(tableMeta, normalTable) { } if (stbNum) { - printf("got expired stb,suid:%"PRId64"\n", stb->suid); + printf("got expired stb,suid:%" PRId64 "\n", stb->suid); free(stb); stb = NULL; } else { @@ -773,7 +752,7 @@ TEST(tableMeta, normalTable) { allStbNum += stbNum; sleep(2); } - + ASSERT_EQ(allDbNum, 1); ASSERT_EQ(allStbNum, 0); @@ -781,18 +760,18 @@ TEST(tableMeta, normalTable) { } TEST(tableMeta, childTableCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; ctgTestSetPrepareDbVgroupsAndChildMeta(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); - + code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); @@ -838,19 +817,19 @@ TEST(tableMeta, childTableCase) { ASSERT_EQ(tableMeta->tableInfo.precision, 1); ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); - SDbVgVersion *dbs = NULL; + SDbVgVersion *dbs = NULL; SSTableMetaVersion *stb = NULL; - uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; - int32_t i = 0; + uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; + int32_t i = 0; while (i < 5) { ++i; code = catalogGetExpiredDBs(pCtg, &dbs, &dbNum); ASSERT_EQ(code, 0); code = catalogGetExpiredSTables(pCtg, &stb, &stbNum); ASSERT_EQ(code, 0); - + if (dbNum) { - printf("got expired db,dbId:%"PRId64"\n", dbs->dbId); + printf("got expired db,dbId:%" PRId64 "\n", dbs->dbId); free(dbs); dbs = NULL; } else { @@ -858,7 +837,7 @@ TEST(tableMeta, childTableCase) { } if (stbNum) { - printf("got expired stb,suid:%"PRId64"\n", stb->suid); + printf("got expired stb,suid:%" PRId64 "\n", stb->suid); free(stb); stb = NULL; } else { @@ -869,18 +848,17 @@ TEST(tableMeta, childTableCase) { allStbNum += stbNum; sleep(2); } - + ASSERT_EQ(allDbNum, 1); ASSERT_EQ(allStbNum, 1); - catalogDestroy(); } TEST(tableMeta, superTableCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; ctgTestSetPrepareDbVgroupsAndSuperMeta(); @@ -889,7 +867,7 @@ TEST(tableMeta, superTableCase) { int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); @@ -940,19 +918,19 @@ TEST(tableMeta, superTableCase) { ASSERT_EQ(tableMeta->tableInfo.precision, 1); ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); - SDbVgVersion *dbs = NULL; + SDbVgVersion *dbs = NULL; SSTableMetaVersion *stb = NULL; - uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; - int32_t i = 0; + uint32_t dbNum = 0, stbNum = 0, allDbNum = 0, allStbNum = 0; + int32_t i = 0; while (i < 5) { ++i; code = catalogGetExpiredDBs(pCtg, &dbs, &dbNum); ASSERT_EQ(code, 0); code = catalogGetExpiredSTables(pCtg, &stb, &stbNum); ASSERT_EQ(code, 0); - + if (dbNum) { - printf("got expired db,dbId:%"PRId64"\n", dbs->dbId); + printf("got expired db,dbId:%" PRId64 "\n", dbs->dbId); free(dbs); dbs = NULL; } else { @@ -960,7 +938,7 @@ TEST(tableMeta, superTableCase) { } if (stbNum) { - printf("got expired stb,suid:%"PRId64"\n", stb->suid); + printf("got expired stb,suid:%" PRId64 "\n", stb->suid); free(stb); stb = NULL; } else { @@ -971,19 +949,18 @@ TEST(tableMeta, superTableCase) { allStbNum += stbNum; sleep(2); } - + ASSERT_EQ(allDbNum, 1); ASSERT_EQ(allStbNum, 1); - catalogDestroy(); } TEST(tableDistVgroup, normalTable) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo *vgInfo = NULL; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo *vgInfo = NULL; + SArray *vgList = NULL; ctgTestSetPrepareDbVgroupsAndNormalMeta(); @@ -992,8 +969,8 @@ TEST(tableDistVgroup, normalTable) { int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); @@ -1012,17 +989,17 @@ TEST(tableDistVgroup, normalTable) { } TEST(tableDistVgroup, childTableCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo *vgInfo = NULL; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo *vgInfo = NULL; + SArray *vgList = NULL; ctgTestSetPrepareDbVgroupsAndChildMeta(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); @@ -1040,15 +1017,14 @@ TEST(tableDistVgroup, childTableCase) { ASSERT_EQ(vgInfo->vgId, 9); ASSERT_EQ(vgInfo->numOfEps, 4); - catalogDestroy(); } TEST(tableDistVgroup, superTableCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo *vgInfo = NULL; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo *vgInfo = NULL; + SArray *vgList = NULL; ctgTestSetPrepareDbVgroupsAndSuperMeta(); @@ -1057,7 +1033,7 @@ TEST(tableDistVgroup, superTableCase) { int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); @@ -1078,24 +1054,23 @@ TEST(tableDistVgroup, superTableCase) { ASSERT_EQ(vgInfo->vgId, 3); ASSERT_EQ(vgInfo->numOfEps, 3); - catalogDestroy(); } TEST(dbVgroup, getSetDbVgroupCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; - SVgroupInfo *pvgInfo = NULL; - SDBVgroupInfo dbVgroup = {0}; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; + SVgroupInfo *pvgInfo = NULL; + SDBVgroupInfo dbVgroup = {0}; + SArray *vgList = NULL; ctgTestSetPrepareDbVgroupsAndNormalMeta(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); @@ -1109,7 +1084,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { code = catalogGetDBVgroup(pCtg, mockPointer, (const SEpSet *)mockPointer, ctgTestDbname, false, &vgList); ASSERT_EQ(code, 0); ASSERT_EQ(taosArrayGetSize((const SArray *)vgList), ctgTestVgNum); - + code = catalogGetTableHashVgroup(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &vgInfo); ASSERT_EQ(code, 0); ASSERT_EQ(vgInfo.vgId, 8); @@ -1139,27 +1114,27 @@ TEST(dbVgroup, getSetDbVgroupCase) { ASSERT_EQ(pvgInfo->vgId, 8); ASSERT_EQ(pvgInfo->numOfEps, 3); taosArrayDestroy(vgList); - + catalogDestroy(); } TEST(multiThread, getSetDbVgroupCase) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; - SVgroupInfo *pvgInfo = NULL; - SDBVgroupInfo dbVgroup = {0}; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; + SVgroupInfo *pvgInfo = NULL; + SDBVgroupInfo dbVgroup = {0}; + SArray *vgList = NULL; ctgTestStop = false; ctgTestInitLogFile(); - + ctgTestSetPrepareDbVgroups(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); @@ -1187,28 +1162,28 @@ TEST(multiThread, getSetDbVgroupCase) { break; } } - + ctgTestStop = true; sleep(1); - + catalogDestroy(); } TEST(multiThread, ctableMeta) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; - SVgroupInfo *pvgInfo = NULL; - SDBVgroupInfo dbVgroup = {0}; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; + SVgroupInfo *pvgInfo = NULL; + SDBVgroupInfo dbVgroup = {0}; + SArray *vgList = NULL; ctgTestStop = false; ctgTestSetPrepareDbVgroupsAndChildMeta(); initQueryModuleMsgHandle(); - //sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); - + // sendCreateDbMsg(pConn->pTransporter, &pConn->pAppInfo->mgmtEp.epSet); + int32_t code = catalogInit(NULL); ASSERT_EQ(code, 0); @@ -1235,25 +1210,24 @@ TEST(multiThread, ctableMeta) { break; } } - + ctgTestStop = true; sleep(1); - + catalogDestroy(); } - TEST(rentTest, allRent) { - struct SCatalog* pCtg = NULL; - void *mockPointer = (void *)0x1; - SVgroupInfo vgInfo = {0}; - SVgroupInfo *pvgInfo = NULL; - SDBVgroupInfo dbVgroup = {0}; - SArray *vgList = NULL; + struct SCatalog *pCtg = NULL; + void *mockPointer = (void *)0x1; + SVgroupInfo vgInfo = {0}; + SVgroupInfo *pvgInfo = NULL; + SDBVgroupInfo dbVgroup = {0}; + SArray *vgList = NULL; ctgTestStop = false; - SDbVgVersion *dbs = NULL; + SDbVgVersion *dbs = NULL; SSTableMetaVersion *stable = NULL; - uint32_t num = 0; + uint32_t num = 0; ctgTestSetPrepareDbVgroupsAndMultiSuperMeta(); @@ -1265,7 +1239,6 @@ TEST(rentTest, allRent) { code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); - SName n = {.type = TSDB_TABLE_NAME_T, .acctId = 1}; strcpy(n.dbname, "db1"); @@ -1285,41 +1258,37 @@ TEST(rentTest, allRent) { ASSERT_EQ(tableMeta->tableInfo.numOfTags, ctgTestTagNum); ASSERT_EQ(tableMeta->tableInfo.precision, 1); ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); - + code = catalogGetExpiredDBs(pCtg, &dbs, &num); ASSERT_EQ(code, 0); printf("%d - expired dbNum:%d\n", i, num); if (dbs) { - printf("%d - expired dbId:%"PRId64", vgVersion:%d\n", i, dbs->dbId, dbs->vgVersion); + printf("%d - expired dbId:%" PRId64 ", vgVersion:%d\n", i, dbs->dbId, dbs->vgVersion); free(dbs); dbs = NULL; } - + code = catalogGetExpiredSTables(pCtg, &stable, &num); ASSERT_EQ(code, 0); printf("%d - expired stableNum:%d\n", i, num); if (stable) { for (int32_t n = 0; n < num; ++n) { - printf("suid:%"PRId64", sversion:%d, tversion:%d\n", stable[n].suid, stable[n].sversion, stable[n].tversion); + printf("suid:%" PRId64 ", sversion:%d, tversion:%d\n", stable[n].suid, stable[n].sversion, stable[n].tversion); } free(stable); stable = NULL; } printf("*************************************************\n"); - + sleep(2); } - + catalogDestroy(); } - - -int main(int argc, char** argv) { +int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } - - - \ No newline at end of file +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/executor/test/executorTests.cpp b/source/libs/executor/test/executorTests.cpp index c528d879a30af3748ea01d561c865c9524b8369a..5e0b641b285927c7b02644bce2f2ae831ff2dcb8 100644 --- a/source/libs/executor/test/executorTests.cpp +++ b/source/libs/executor/test/executorTests.cpp @@ -17,8 +17,9 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -219,4 +220,6 @@ TEST(testCase, build_executor_tree_Test) { SExecTaskInfo* pTaskInfo = nullptr; DataSinkHandle sinkHandle = nullptr; int32_t code = qCreateExecTask((void*) 1, 2, NULL, (void**) &pTaskInfo, &sinkHandle); -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index e8d975c22e93ac2a30882301d36e7aaa22a959c2..d68b04a384e06bd8d9be1b30c901ed6ab62ce9ad 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -18,8 +18,14 @@ #include #include "stub.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" + #include "addr_any.h" +#pragma GCC diagnostic pop + namespace { void generateTestT1(MockCatalogService* mcs) { diff --git a/source/libs/parser/test/parserTests.cpp b/source/libs/parser/test/parserTests.cpp index 4847b500824e5f484fc8fa7081d29e25161ce839..b408e15abe8518261560be7ef902ed1f0cab24cd 100644 --- a/source/libs/parser/test/parserTests.cpp +++ b/source/libs/parser/test/parserTests.cpp @@ -17,8 +17,9 @@ #include #include #include "tglobal.h" -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -781,4 +782,6 @@ TEST(testCase, create_user_Test) { ASSERT_NE(output, nullptr); destroySqlInfo(&info1); -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/parser/test/plannerTest.cpp b/source/libs/parser/test/plannerTest.cpp index a278e0053c468c39c6f388d43359af5fed45b00c..43daff9fec1c747d96916b7b852d198158421930 100644 --- a/source/libs/parser/test/plannerTest.cpp +++ b/source/libs/parser/test/plannerTest.cpp @@ -17,8 +17,9 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -203,4 +204,6 @@ TEST(testCase, displayPlan) { // Projection(cols: [ts #0], [a #1], [b #2]) filters:(nil) // TableScan(t.1abc #110) time_range: -9223372036854775808 - 9223372036854775807 -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/parser/test/tokenizerTest.cpp b/source/libs/parser/test/tokenizerTest.cpp index 7ed052e8cc3526a3143a85bcf8380f64f2f050fd..888eeae73b8639cbaed3e9143993ab7aadadd7cd 100644 --- a/source/libs/parser/test/tokenizerTest.cpp +++ b/source/libs/parser/test/tokenizerTest.cpp @@ -1,7 +1,8 @@ #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -722,3 +723,4 @@ TEST(testCase, extractMeta_test) { destroySqlInfo(&info1); } +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/planner/test/plannerTests.cpp b/source/libs/planner/test/plannerTests.cpp index 4b408e67db5035eaf032e16d957e05817bcebcba..765651a31abc9c9fff80e1251c34769394cd1d47 100644 --- a/source/libs/planner/test/plannerTests.cpp +++ b/source/libs/planner/test/plannerTests.cpp @@ -22,8 +22,8 @@ #include "parser.h" #include "mockCatalog.h" +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wwrite-strings" - #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -102,4 +102,6 @@ TEST(testCase, planner_test) { // destroyQueryInfo(pQueryInfo); // qParserCleanupMetaRequestInfo(&req); // destroySqlInfo(&info1); -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index 2cde28baf91b7f8408282fa4d8eea5a48e0880bb..52e632ffbb28c3a9f0b6febcbd9c69be3f0b4106 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -18,6 +18,9 @@ #include "query.h" #include "trpc.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-truncation" + int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char **msg, int32_t msgSize, int32_t *msgLen) = {0}; int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char *msg, int32_t msgSize) = {0}; @@ -288,7 +291,4 @@ void initQueryModuleMsgHandle() { queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_USE_DB)] = queryProcessUseDBRsp; } - - - - +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/qcom/test/queryTest.cpp b/source/libs/qcom/test/queryTest.cpp index 8fc6b7e5297057c6d8b41c434eb4a1b3f3f86cfc..9ca7442d55fd35d3db8ef084f237a49f4b90c82b 100644 --- a/source/libs/qcom/test/queryTest.cpp +++ b/source/libs/qcom/test/queryTest.cpp @@ -18,8 +18,9 @@ #include "tmsg.h" #include "query.h" #include "trpc.h" -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" @@ -82,3 +83,5 @@ TEST(testCase, error_in_async_test) { usleep(1000); printf("Error code:%d after asynchronously exec function\n", code); } + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/qworker/inc/qworkerInt.h b/source/libs/qworker/inc/qworkerInt.h index 5f9b33f7e301b326c019eb6e1fdf83c85e455355..15c7c0d64b6e9e285c29ebed66693fc7bd482e67 100644 --- a/source/libs/qworker/inc/qworkerInt.h +++ b/source/libs/qworker/inc/qworkerInt.h @@ -219,8 +219,7 @@ typedef struct SQWorkerMgmt { } \ } while (0) - - +int32_t qwBuildAndSendCancelRsp(SRpcMsg *pMsg, int32_t code); #ifdef __cplusplus } diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index d1cc9f03d15a3fe38b3763235101b26078e279e7..0ed5c0c816bc7348badf74cd430bb5bb2093ffac 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -16,11 +16,17 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + #include "os.h" #include "taos.h" @@ -461,11 +467,11 @@ void *controlThread(void *param) { } void *queryQueueThread(void *param) { - + return NULL; } void *fetchQueueThread(void *param) { - + return NULL; } @@ -783,5 +789,4 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } - - +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 6b047eb96ee121fa6d3c0ef102914d3ac911bd96..a82c75d295fe8e828bf3280615a9f95fab61006f 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -146,12 +146,15 @@ typedef struct SSchJob { #define SCH_SET_JOB_TYPE(pAttr, type) (pAttr)->queryJob = ((type) != QUERY_TYPE_MODIFY) #define SCH_JOB_NEED_FETCH(pAttr) ((pAttr)->queryJob) -#define SCH_JOB_ELOG(param, ...) qError("QID:%"PRIx64" " param, pJob->queryId, __VA_ARGS__) -#define SCH_JOB_DLOG(param, ...) qDebug("QID:%"PRIx64" " param, pJob->queryId, __VA_ARGS__) - -#define SCH_TASK_ELOG(param, ...) qError("QID:%"PRIx64",TID:%"PRId64" " param, pJob->queryId, pTask->taskId, __VA_ARGS__) -#define SCH_TASK_DLOG(param, ...) qDebug("QID:%"PRIx64",TID:%"PRId64" " param, pJob->queryId, pTask->taskId, __VA_ARGS__) -#define SCH_TASK_WLOG(param, ...) qWarn("QID:%"PRIx64",TID:%"PRId64" " param, pJob->queryId, pTask->taskId, __VA_ARGS__) +#define SCH_JOB_ELOG(param, ...) qError("QID:%" PRIx64 " " param, pJob->queryId, __VA_ARGS__) +#define SCH_JOB_DLOG(param, ...) qDebug("QID:%" PRIx64 " " param, pJob->queryId, __VA_ARGS__) + +#define SCH_TASK_ELOG(param, ...) \ + qError("QID:%" PRIx64 ",TID:%" PRId64 " " param, pJob->queryId, pTask->taskId, __VA_ARGS__) +#define SCH_TASK_DLOG(param, ...) \ + qDebug("QID:%" PRIx64 ",TID:%" PRId64 " " param, pJob->queryId, pTask->taskId, __VA_ARGS__) +#define SCH_TASK_WLOG(param, ...) \ + qWarn("QID:%" PRIx64 ",TID:%" PRId64 " " param, pJob->queryId, pTask->taskId, __VA_ARGS__) #define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) #define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index 1425ac0e6ca3f9013858f4c055275db06226ad4e..fb13149713486ac653ea6c2c54241322a960b01e 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -16,11 +16,7 @@ #include #include #include -#pragma GCC diagnostic ignored "-Wwrite-strings" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wsign-compare" #include "os.h" #include "taos.h" @@ -30,6 +26,16 @@ #include "scheduler.h" #include "tep.h" #include "trpc.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wliteral-suffix" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wreturn-type" +#pragma GCC diagnostic ignored "-Wformat" + #include "schedulerInt.h" #include "stub.h" #include "addr_any.h" @@ -680,6 +686,4 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } - - - +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/util/test/encodeTest.cpp b/source/util/test/encodeTest.cpp index b178ee0b10b6fedc7f28299e8973f530e8fa3231..1b13c102a5a14103f51ceaf337d346723fd6f6f0 100644 --- a/source/util/test/encodeTest.cpp +++ b/source/util/test/encodeTest.cpp @@ -4,6 +4,11 @@ #include "encode.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshift-count-overflow" +#pragma GCC diagnostic ignored "-Woverflow" +#pragma GCC diagnostic ignored "-Woverflow" + #define BUF_SIZE 64 td_endian_t endian_arr[2] = {TD_LITTLE_ENDIAN, TD_BIG_ENDIAN}; @@ -354,10 +359,10 @@ TEST(td_encode_test, compound_struct_encode_test) { SCoder encoder, decoder; uint8_t * buf1; int32_t buf1size; - uint8_t * buf2; + uint8_t *buf2; int32_t buf2size; - SStructA_v1 sa1 = {.A_a = 10, .A_b = 65478, .A_c = "Hello"}; - SStructA_v2 sa2 = {.A_a = 10, .A_b = 65478, .A_c = "Hello", .A_d = 67, .A_e = 13}; + SStructA_v1 sa1 = {.A_a = 10, .A_b = 65478, .A_c = (char *)"Hello"}; + SStructA_v2 sa2 = {.A_a = 10, .A_b = 65478, .A_c = (char *)"Hello", .A_d = 67, .A_e = 13}; SFinalReq_v1 req1 = {.pA = &sa1, .v_a = 15, .v_b = 35}; SFinalReq_v2 req2 = {.pA = &sa2, .v_a = 15, .v_b = 32, .v_c = 37}; SFinalReq_v1 dreq11, dreq21; @@ -430,4 +435,6 @@ TEST(td_encode_test, compound_struct_encode_test) { GTEST_ASSERT_EQ(dreq21.v_a, req2.v_a); GTEST_ASSERT_EQ(dreq21.v_b, req2.v_b); tCoderClear(&decoder); -} \ No newline at end of file +} + +#pragma GCC diagnostic pop \ No newline at end of file