From dde625ed1ead748d163d7beceaeb424f6fb4984d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 26 Jun 2020 15:19:34 +0800 Subject: [PATCH 1/8] [td-225] add log --- src/tsdb/src/tsdbMeta.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 6b0224cad2..9ec8eb137d 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -553,10 +553,20 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) { return 0; } -void tsdbRefTable(STable *pTable) { T_REF_INC(pTable); } +void tsdbRefTable(STable *pTable) { + int16_t ref = T_REF_INC(pTable); + tsdbTrace("ref table %"PRIu64", tid:%d, refCount:%d", pTable->tableId.uid, pTable->tableId.tid, ref); +} void tsdbUnRefTable(STable *pTable) { - if (T_REF_DEC(pTable) == 0) { + int16_t ref = T_REF_DEC(pTable); + tsdbTrace("unref table uid:%"PRIu64", tid:%d, refCount:%d", pTable->tableId.uid, pTable->tableId.tid, ref); + + if (ref == 0) { + char name[TSDB_TABLE_NAME_LEN] = {0}; + tstrncpy(name, pTable->name->data, sizeof(name)); + tsdbTrace("destory table name:%s uid:%"PRIu64", tid:%d", name, pTable->tableId.uid, pTable->tableId.tid); + if (TABLE_TYPE(pTable) == TSDB_CHILD_TABLE) { tsdbUnRefTable(pTable->pSuper); } From d78ffa69ed3673a238a37dd1e64eb26d087c2c1c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 26 Jun 2020 07:53:51 +0000 Subject: [PATCH 2/8] add some debug information --- src/tsdb/src/tsdbMeta.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 9ec8eb137d..600833af10 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -555,17 +555,17 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) { void tsdbRefTable(STable *pTable) { int16_t ref = T_REF_INC(pTable); - tsdbTrace("ref table %"PRIu64", tid:%d, refCount:%d", pTable->tableId.uid, pTable->tableId.tid, ref); + tsdbTrace("ref table %"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref); } void tsdbUnRefTable(STable *pTable) { int16_t ref = T_REF_DEC(pTable); - tsdbTrace("unref table uid:%"PRIu64", tid:%d, refCount:%d", pTable->tableId.uid, pTable->tableId.tid, ref); + tsdbTrace("unref table uid:%"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref); if (ref == 0) { - char name[TSDB_TABLE_NAME_LEN] = {0}; - tstrncpy(name, pTable->name->data, sizeof(name)); - tsdbTrace("destory table name:%s uid:%"PRIu64", tid:%d", name, pTable->tableId.uid, pTable->tableId.tid); + // char name[TSDB_TABLE_NAME_LEN] = {0}; + // tstrncpy(name, pTable->name->data, sizeof(name)); + tsdbTrace("destory table name:%s uid:%"PRIu64", tid:%d", TABLE_CHAR_NAME(pTable), TABLE_UID(pTable), TABLE_TID(pTable)); if (TABLE_TYPE(pTable) == TSDB_CHILD_TABLE) { tsdbUnRefTable(pTable->pSuper); From 6e0bffe4ed5b8dc15e5190b60bc376cc1bf08b89 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 27 Jun 2020 07:31:23 +0000 Subject: [PATCH 3/8] TD-453 --- src/tsdb/src/tsdbMeta.c | 102 ++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 19 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 57513e5d4a..fb5ea87b72 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -48,6 +48,8 @@ static int tsdbEncodeTable(void **buf, STable *pTable); static void * tsdbDecodeTable(void *buf, STable **pRTable); static int tsdbGetTableEncodeSize(int8_t act, STable *pTable); static void * tsdbInsertTableAct(STsdbRepo *pRepo, int8_t act, void *buf, STable *pTable); +static int tsdbRemoveTableFromStore(STsdbRepo *pRepo, STable *pTable); +static int tsdbRmTableFromMeta(STsdbRepo *pRepo, STable *pTable); // ------------------ OUTER FUNCTIONS ------------------ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) { @@ -117,7 +119,7 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) { STable *pTable = tsdbGetTableByUid(pMeta, uid); if (pTable == NULL) { - tsdbError("vgId:%d failed to drop table since table not exists! tid:%d uid %" PRId64, REPO_ID(pRepo), tableId.tid, + tsdbError("vgId:%d failed to drop table since table not exists! tid:%d uid %" PRIu64, REPO_ID(pRepo), tableId.tid, uid); terrno = TSDB_CODE_TDB_INVALID_TABLE_ID; return -1; @@ -132,30 +134,26 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) { return -1; } - if (TABLE_TYPE(pTable) == TSDB_STREAM_TABLE) { - if (pTable->cqhandle) pRepo->appH.cqDropFunc(pTable->cqhandle); + // Write to KV store first + if (tsdbRemoveTableFromStore(pRepo, pTable) < 0) { + tsdbError("vgId:%d failed to drop table %s since %s", REPO_ID(pRepo), tbname, tstrerror(terrno)); + goto _err; } - if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) { - SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex); - while (tSkipListIterNext(pIter)) { - STable *tTable = *(STable **)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); - ASSERT(TABLE_TYPE(tTable) == TSDB_CHILD_TABLE); - int tlen = tsdbGetTableEncodeSize(TSDB_DROP_META, tTable); - void *buf = tsdbAllocBytes(pRepo, tlen); - ASSERT(buf != NULL); - tsdbInsertTableAct(pRepo, TSDB_DROP_META, buf, tTable); - tsdbRemoveTableFromMeta(pRepo, tTable, false, true); - } - tSkipListDestroyIter(pIter); + // Remove table from Meta + if (tsdbRmTableFromMeta(pRepo, pTable) < 0) { + tsdbError("vgId:%d failed to drop table %s since %s", REPO_ID(pRepo), tbname, tstrerror(terrno)); + goto _err; } - tsdbRemoveTableFromMeta(pRepo, pTable, true, true); - tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, tbname, tid, uid); free(tbname); return 0; + +_err: + tfree(tbname); + return -1; } void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_t bytes) { @@ -555,6 +553,7 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) { void tsdbRefTable(STable *pTable) { int16_t ref = T_REF_INC(pTable); + UNUSED(ref); // tsdbTrace("ref table %"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref); } @@ -1164,8 +1163,16 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) { } static int tsdbGetTableEncodeSize(int8_t act, STable *pTable) { - int tlen = sizeof(SListNode) + sizeof(SActObj); - if (act == TSDB_UPDATE_META) tlen += (sizeof(SActCont) + tsdbEncodeTable(NULL, pTable) + sizeof(TSCKSUM)); + int tlen = 0; + if (act == TSDB_UPDATE_META) { + tlen = sizeof(SListNode) + sizeof(SActObj) + sizeof(SActCont) + tsdbEncodeTable(NULL, pTable) + sizeof(TSCKSUM); + } else { + if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) { + tlen = (sizeof(SListNode) + sizeof(SActObj)) * (tSkipListGetSize(pTable->pIndex) + 1); + } else { + tlen = sizeof(SListNode) + sizeof(SActObj); + } + } return tlen; } @@ -1190,4 +1197,61 @@ static void *tsdbInsertTableAct(STsdbRepo *pRepo, int8_t act, void *buf, STable tdListAppendNode(pRepo->mem->actList, pNode); return pBuf; +} + +static int tsdbRemoveTableFromStore(STsdbRepo *pRepo, STable *pTable) { + int tlen = tsdbGetTableEncodeSize(TSDB_DROP_META, pTable); + void *buf = tsdbAllocBytes(pRepo, tlen); + ASSERT(buf != NULL); + + void *pBuf = buf; + if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) { + SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex); + if (pIter == NULL) { + terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + return -1; + } + + while (tSkipListIterNext(pIter)) { + STable *tTable = *(STable **)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); + ASSERT(TABLE_TYPE(tTable) == TSDB_CHILD_TABLE); + pBuf = tsdbInsertTableAct(pRepo, TSDB_DROP_META, pBuf, pTable); + } + + tSkipListDestroyIter(pIter); + } + pBuf = tsdbInsertTableAct(pRepo, TSDB_DROP_META, pBuf, pTable); + + ASSERT(POINTER_DISTANCE(pBuf, buf) == tlen); + + return 0; +} + +static int tsdbRmTableFromMeta(STsdbRepo *pRepo, STable *pTable) { + if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) { + SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex); + if (pIter == NULL) { + terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + return -1; + } + + tsdbWLockRepoMeta(pRepo); + + while (tSkipListIterNext(pIter)) { + STable *tTable = *(STable **)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); + tsdbRemoveTableFromMeta(pRepo, tTable, false, false); + } + + tsdbRemoveTableFromMeta(pRepo, pTable, false, false); + + tsdbUnlockRepoMeta(pRepo); + + tSkipListDestroyIter(pIter); + + } else { + if ((TABLE_TYPE(pTable) == TSDB_STREAM_TABLE) && pTable->cqhandle) pRepo->appH.cqDropFunc(pTable->cqhandle); + tsdbRemoveTableFromMeta(pRepo, pTable, true, true); + } + + return 0; } \ No newline at end of file From b8a8e14ea1d86ad570189f9eda9c0c0eea591bb4 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 27 Jun 2020 16:28:26 +0800 Subject: [PATCH 4/8] bump connector version to 2.0.0 for TDengine 2.0 [TD-769] --- src/connector/grafana/tdengine/package.json | 2 +- src/connector/jdbc/CMakeLists.txt | 2 +- src/connector/jdbc/pom.xml | 2 +- src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java | 2 +- src/connector/jdbc/src/test/java/TestTSDBSubscribe.java | 2 +- src/connector/nodejs/package.json | 2 +- src/connector/python/linux/python2/setup.py | 2 +- src/connector/python/linux/python2/taos.egg-info/PKG-INFO | 2 +- src/connector/python/linux/python3/setup.py | 2 +- src/connector/python/linux/python3/taos.egg-info/PKG-INFO | 2 +- src/connector/python/windows/python2/setup.py | 2 +- src/connector/python/windows/python2/taos.egg-info/PKG-INFO | 2 +- src/connector/python/windows/python3/setup.py | 2 +- src/connector/python/windows/python3/taos.egg-info/PKG-INFO | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/connector/grafana/tdengine/package.json b/src/connector/grafana/tdengine/package.json index 0eb7a76be6..678278ec47 100644 --- a/src/connector/grafana/tdengine/package.json +++ b/src/connector/grafana/tdengine/package.json @@ -1,7 +1,7 @@ { "name": "TDengine", "private": false, - "version": "1.0.0", + "version": "2.0.0", "description": "grafana datasource plugin for tdengine", "scripts": { "build": "./node_modules/grunt-cli/bin/grunt", diff --git a/src/connector/jdbc/CMakeLists.txt b/src/connector/jdbc/CMakeLists.txt index 05c8bebafe..7f823b97b2 100644 --- a/src/connector/jdbc/CMakeLists.txt +++ b/src/connector/jdbc/CMakeLists.txt @@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED) ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME} POST_BUILD COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-1.0.3-dist.jar ${LIBRARY_OUTPUT_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.0-dist.jar ${LIBRARY_OUTPUT_PATH} COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml COMMENT "build jdbc driver") ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME}) diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index 5aa4f6a2e3..2f0c3c78e7 100755 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.taosdata.jdbc taos-jdbcdriver - 1.0.3 + 2.0.0 jar JDBCDriver https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc diff --git a/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java b/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java index 55ab2fdc52..03a4761b91 100644 --- a/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java +++ b/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java @@ -8,7 +8,7 @@ import java.util.Properties; public class TestAsyncTSDBSubscribe { public static void main(String[] args) throws SQLException { - String usage = "java -cp taos-jdbcdriver-1.0.3_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName -topic topicName " + + String usage = "java -cp taos-jdbcdriver-2.0.0_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName -topic topicName " + "-tname tableName -h host"; if (args.length < 2) { System.err.println(usage); diff --git a/src/connector/jdbc/src/test/java/TestTSDBSubscribe.java b/src/connector/jdbc/src/test/java/TestTSDBSubscribe.java index f628f3cada..598ef4bbc0 100644 --- a/src/connector/jdbc/src/test/java/TestTSDBSubscribe.java +++ b/src/connector/jdbc/src/test/java/TestTSDBSubscribe.java @@ -10,7 +10,7 @@ import java.util.Properties; public class TestTSDBSubscribe { public static void main(String[] args) throws Exception { - String usage = "java -cp taos-jdbcdriver-1.0.3_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName " + + String usage = "java -cp taos-jdbcdriver-2.0.0_dev-dist.jar com.taosdata.jdbc.TSDBSubscribe -db dbName " + "-topic topicName -tname tableName -h host"; if (args.length < 2) { System.err.println(usage); diff --git a/src/connector/nodejs/package.json b/src/connector/nodejs/package.json index 8d7a971aa3..2bc4a2453d 100644 --- a/src/connector/nodejs/package.json +++ b/src/connector/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "td-connector", - "version": "1.6.1", + "version": "2.0.0", "description": "A Node.js connector for TDengine.", "main": "tdengine.js", "scripts": { diff --git a/src/connector/python/linux/python2/setup.py b/src/connector/python/linux/python2/setup.py index ae5ebad671..2e4f80b8f0 100644 --- a/src/connector/python/linux/python2/setup.py +++ b/src/connector/python/linux/python2/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="taos", - version="1.4.15", + version="2.0.0", author="Taosdata Inc.", author_email="support@taosdata.com", description="TDengine python client package", diff --git a/src/connector/python/linux/python2/taos.egg-info/PKG-INFO b/src/connector/python/linux/python2/taos.egg-info/PKG-INFO index ce6d8c58b2..96bf9059fd 100644 --- a/src/connector/python/linux/python2/taos.egg-info/PKG-INFO +++ b/src/connector/python/linux/python2/taos.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: taos -Version: 1.4.15 +Version: 2.0.0 Summary: TDengine python client package Home-page: https://github.com/pypa/sampleproject Author: Taosdata Inc. diff --git a/src/connector/python/linux/python3/setup.py b/src/connector/python/linux/python3/setup.py index 0669953ca3..03a49fc1c5 100644 --- a/src/connector/python/linux/python3/setup.py +++ b/src/connector/python/linux/python3/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="taos", - version="1.4.15", + version="2.0.0", author="Taosdata Inc.", author_email="support@taosdata.com", description="TDengine python client package", diff --git a/src/connector/python/linux/python3/taos.egg-info/PKG-INFO b/src/connector/python/linux/python3/taos.egg-info/PKG-INFO index b1a77c8ac7..1e6c829ef1 100644 --- a/src/connector/python/linux/python3/taos.egg-info/PKG-INFO +++ b/src/connector/python/linux/python3/taos.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: taos -Version: 1.4.15 +Version: 2.0.0 Summary: TDengine python client package Home-page: https://github.com/pypa/sampleproject Author: Taosdata Inc. diff --git a/src/connector/python/windows/python2/setup.py b/src/connector/python/windows/python2/setup.py index cace06f443..fd82a55650 100644 --- a/src/connector/python/windows/python2/setup.py +++ b/src/connector/python/windows/python2/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="taos", - version="1.4.15", + version="2.0.0", author="Taosdata Inc.", author_email="support@taosdata.com", description="TDengine python client package", diff --git a/src/connector/python/windows/python2/taos.egg-info/PKG-INFO b/src/connector/python/windows/python2/taos.egg-info/PKG-INFO index 9673ab6c5c..9babb669a7 100644 --- a/src/connector/python/windows/python2/taos.egg-info/PKG-INFO +++ b/src/connector/python/windows/python2/taos.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: taos -Version: 1.4.15 +Version: 2.0.0 Summary: TDengine python client package Home-page: https://github.com/pypa/sampleproject Author: Taosdata Inc. diff --git a/src/connector/python/windows/python3/setup.py b/src/connector/python/windows/python3/setup.py index 7cac04b723..9abdace5a9 100644 --- a/src/connector/python/windows/python3/setup.py +++ b/src/connector/python/windows/python3/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setuptools.setup( name="taos", - version="1.4.15", + version="2.0.0", author="Taosdata Inc.", author_email="support@taosdata.com", description="TDengine python client package", diff --git a/src/connector/python/windows/python3/taos.egg-info/PKG-INFO b/src/connector/python/windows/python3/taos.egg-info/PKG-INFO index 191327092b..6213b0d165 100644 --- a/src/connector/python/windows/python3/taos.egg-info/PKG-INFO +++ b/src/connector/python/windows/python3/taos.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: taos -Version: 1.4.15 +Version: 2.0.0 Summary: TDengine python client package Home-page: https://github.com/pypa/sampleproject Author: Hongze Cheng From 88e2c1e18af1ec4567f8c36499f4929aec2280de Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Sat, 27 Jun 2020 08:31:24 +0000 Subject: [PATCH 5/8] memory leak if vnode not exist --- src/dnode/src/dnodeVRead.c | 1 + src/dnode/src/dnodeVWrite.c | 1 + src/rpc/src/rpcMain.c | 2 ++ src/rpc/src/rpcTcp.c | 2 ++ src/rpc/src/rpcUdp.c | 2 ++ 5 files changed, 8 insertions(+) diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index cd18ae6dda..3027a94411 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -131,6 +131,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) { .msgType = 0 }; rpcSendResponse(&rpcRsp); + rpcFreeCont(pMsg->pCont); } } diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index e61364355d..e2cc2d1cd3 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -119,6 +119,7 @@ void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) { .msgType = 0 }; rpcSendResponse(&rpcRsp); + rpcFreeCont(pMsg->pCont); } } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index e9ddd89467..5f30d27aeb 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -331,6 +331,7 @@ void rpcFreeCont(void *cont) { if ( cont ) { char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); free(temp); + // tTrace("free mem: %p", temp); } } @@ -540,6 +541,7 @@ static void rpcFreeMsg(void *msg) { if ( msg ) { char *temp = (char *)msg - sizeof(SRpcReqContext); free(temp); + // tTrace("free mem: %p", temp); } } diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 82168f0b0e..c21a1e04df 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -418,6 +418,8 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) { if ( NULL == buffer) { tError("%s %p TCP malloc(size:%d) fail", pThreadObj->label, pFdObj->thandle, msgLen); return -1; + } else { + // tTrace("malloc mem: %p", buffer); } msg = buffer + tsRpcOverhead; diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index a4c7d6c145..e92168c46a 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -211,6 +211,8 @@ static void *taosRecvUdpData(void *param) { if (NULL == tmsg) { tError("%s failed to allocate memory, size:%ld", pConn->label, dataLen); continue; + } else { + // tTrace("malloc mem: %p", tmsg); } tmsg += tsRpcOverhead; // overhead for SRpcReqContext From 04ad350559252ca5af1f31971b93382045d613f1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 27 Jun 2020 17:05:08 +0800 Subject: [PATCH 6/8] [td-225] fix bugs in join --- 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 cdb56e1469..e72034eb62 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -5858,11 +5858,13 @@ static int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) { int32_t s = lseek(fd, 0, SEEK_END); UNUSED(s); qTrace("QInfo:%p ts comp data return, file:%s, size:%d", pQInfo, pQuery->sdata[0]->data, s); - s = lseek(fd, 0, SEEK_SET); - if (s >= 0) { + if (lseek(fd, 0, SEEK_SET) >= 0) { size_t sz = read(fd, data, s); UNUSED(sz); + } else { + // todo handle error } + close(fd); unlink(pQuery->sdata[0]->data); } else { From 1d3a13b4c97d7471c2bb23203c20fe123127e44e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 27 Jun 2020 17:08:20 +0800 Subject: [PATCH 7/8] [td-225] fix bugs in display data --- src/query/src/qtsbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/query/src/qtsbuf.c b/src/query/src/qtsbuf.c index 1b589a0085..2ea27fbb53 100644 --- a/src/query/src/qtsbuf.c +++ b/src/query/src/qtsbuf.c @@ -884,7 +884,7 @@ void tsBufDisplay(STSBuf* pTSBuf) { while (tsBufNextPos(pTSBuf)) { STSElem elem = tsBufGetElem(pTSBuf); - printf("%d-%" PRId64 "-%" PRId64 "\n", elem.vnode, *(int64_t*) elem.tag, elem.ts); + printf("%d-%" PRId64 "-%" PRId64 "\n", elem.vnode, elem.tag, elem.ts); } pTSBuf->cur.order = old; From 2f665893ab8b61699907d2ba526dbbdcb93293bb Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 27 Jun 2020 18:10:54 +0800 Subject: [PATCH 8/8] fix kv store init coredump --- src/util/src/tkvstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index 80f8bdbcee..54167b15d6 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -500,7 +500,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { char *pBuf = tdDecodeKVRecord(tbuf, &rInfo); ASSERT(POINTER_DISTANCE(pBuf, tbuf) == sizeof(SKVRecord)); - ASSERT(pStore->info.size == rInfo.offset); + ASSERT((rInfo.offset > 0) ? (pStore->info.size == rInfo.offset) : true); if (rInfo.offset < 0) { taosHashRemove(pStore->map, (void *)(&rInfo.uid), sizeof(rInfo.uid));