diff --git a/include/dnode/mnode/sdb/sdb.h b/include/dnode/mnode/sdb/sdb.h index 0f648b5150e6d4e89bd91d4d09948b2d690b0010..474e526186b3fba4314aa514dc47c87ae00fef78 100644 --- a/include/dnode/mnode/sdb/sdb.h +++ b/include/dnode/mnode/sdb/sdb.h @@ -25,7 +25,7 @@ extern "C" { #define SDB_GET_INT64(pData, pRow, dataPos, val) \ { \ if (sdbGetRawInt64(pRaw, dataPos, val) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += sizeof(int64_t); \ @@ -34,7 +34,7 @@ extern "C" { #define SDB_GET_INT32(pData, pRow, dataPos, val) \ { \ if (sdbGetRawInt32(pRaw, dataPos, val) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += sizeof(int32_t); \ @@ -43,7 +43,7 @@ extern "C" { #define SDB_GET_INT16(pData, pRow, dataPos, val) \ { \ if (sdbGetRawInt16(pRaw, dataPos, val) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += sizeof(int16_t); \ @@ -52,7 +52,7 @@ extern "C" { #define SDB_GET_INT8(pData, pRow, dataPos, val) \ { \ if (sdbGetRawInt8(pRaw, dataPos, val) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += sizeof(int8_t); \ @@ -61,7 +61,7 @@ extern "C" { #define SDB_GET_BINARY(pRaw, pRow, dataPos, val, valLen) \ { \ if (sdbGetRawBinary(pRaw, dataPos, val, valLen) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += valLen; \ @@ -71,7 +71,7 @@ extern "C" { { \ char val[valLen] = {0}; \ if (sdbGetRawBinary(pRaw, dataPos, val, valLen) != 0) { \ - sdbFreeRow(pRow); \ + tfree(pRow); \ return NULL; \ } \ dataPos += valLen; \ @@ -325,7 +325,7 @@ int32_t sdbGetRawSoftVer(SSdbRaw *pRaw, int8_t *sver); int32_t sdbGetRawTotalSize(SSdbRaw *pRaw); SSdbRow *sdbAllocRow(int32_t objSize); -void sdbFreeRow(SSdbRow *pRow); +void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow); void *sdbGetRowObj(SSdbRow *pRow); #ifdef __cplusplus diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 9a4098857c5c39a040c13cb68d68028a703bb194..77efeb8481c29d6db6c15189646fb4e77506c2c4 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -118,17 +118,17 @@ static SConnObj *mndCreateConn(SMnode *pMnode, SRpcConnInfo *pInfo, int32_t pid, SConnObj *pConn = taosCachePut(pMgmt->cache, &connId, sizeof(int32_t), &connObj, sizeof(connObj), keepTime * 1000); if (pConn == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("conn:%d, data:%p failed to put into cache since %s, user:%s", connId, pConn, pInfo->user, terrstr()); + mError("conn:%d, failed to put into cache since %s, user:%s", connId, pInfo->user, terrstr()); return NULL; } else { - mTrace("conn:%d, data:%p created, user:%s", pConn->id, pConn, pInfo->user); + mTrace("conn:%d, is created, data:%p user:%s", pConn->id, pConn, pInfo->user); return pConn; } } static void mndFreeConn(SConnObj *pConn) { tfree(pConn->pQueries); - mTrace("conn:%d, data:%p destroyed", pConn->id, pConn); + mTrace("conn:%d, is destroyed, data:%p", pConn->id, pConn); } static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) { @@ -143,13 +143,13 @@ static SConnObj *mndAcquireConn(SMnode *pMnode, int32_t connId) { int32_t keepTime = pMnode->cfg.shellActivityTimer * 3; pConn->lastAccessTimeMs = keepTime * 1000 + (uint64_t)taosGetTimestampMs(); - mTrace("conn:%d, data:%p acquired from cache", pConn->id, pConn); + mTrace("conn:%d, acquired from cache, data:%p", pConn->id, pConn); return pConn; } static void mndReleaseConn(SMnode *pMnode, SConnObj *pConn) { if (pConn == NULL) return; - mTrace("conn:%d, data:%p released from cache", pConn->id, pConn); + mTrace("conn:%d, released from cache, data:%p", pConn->id, pConn); SProfileMgmt *pMgmt = &pMnode->profileMgmt; taosCacheRelease(pMgmt->cache, (void **)&pConn, false); diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index e50c6af4bb89fc9ff22d4670a5d1d87541ae2b35..b89de94452e3e72328029939ddb4aa922476953a 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -55,32 +55,25 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SShowMsg *pMsg) { int32_t showId = atomic_add_fetch_32(&pMgmt->showId, 1); if (showId == 0) atomic_add_fetch_32(&pMgmt->showId, 1); - int32_t size = sizeof(SShowObj) + pMsg->payloadLen; - SShowObj *pShow = calloc(1, size); - if (pShow != NULL) { - pShow->id = showId; - pShow->pMnode = pMnode; - pShow->type = pMsg->type; - pShow->payloadLen = pMsg->payloadLen; - memcpy(pShow->db, pMsg->db, TSDB_DB_FNAME_LEN); - memcpy(pShow->payload, pMsg->payload, pMsg->payloadLen); - } else { - terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("failed to process show-meta msg:%s since %s", mndShowStr(pMsg->type), terrstr()); - return NULL; - } + int32_t size = sizeof(SShowObj) + pMsg->payloadLen; + SShowObj showObj = {0}; + showObj.id = showId; + showObj.pMnode = pMnode; + showObj.type = pMsg->type; + showObj.payloadLen = pMsg->payloadLen; + memcpy(showObj.db, pMsg->db, TSDB_DB_FNAME_LEN); + memcpy(showObj.payload, pMsg->payload, pMsg->payloadLen); int32_t keepTime = pMnode->cfg.shellActivityTimer * 6 * 1000; - SShowObj *pShowRet = taosCachePut(pMgmt->cache, &showId, sizeof(int32_t), pShow, size, keepTime); - free(pShow); - if (pShowRet == NULL) { + SShowObj *pShow = taosCachePut(pMgmt->cache, &showId, sizeof(int32_t), &showObj, size, keepTime); + if (pShow == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; mError("show:%d, failed to put into cache since %s", showId, terrstr()); return NULL; - } else { - mTrace("show:%d, data:%p created", showId, pShowRet); - return pShowRet; } + + mTrace("show:%d, is created, data:%p", showId, pShow); + return pShow; } static void mndFreeShowObj(SShowObj *pShow) { @@ -94,7 +87,7 @@ static void mndFreeShowObj(SShowObj *pShow) { } } - mTrace("show:%d, data:%p destroyed", pShow->id, pShow); + mTrace("show:%d, is destroyed, data:%p", pShow->id, pShow); } static SShowObj *mndAcquireShowObj(SMnode *pMnode, int32_t showId) { @@ -106,14 +99,14 @@ static SShowObj *mndAcquireShowObj(SMnode *pMnode, int32_t showId) { return NULL; } - mTrace("show:%d, data:%p acquired from cache", pShow->id, pShow); + mTrace("show:%d, acquired from cache, data:%p", pShow->id, pShow); return pShow; } static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) { if (pShow == NULL) return; - mTrace("show:%d, data:%p released from cache, force:%d", pShow->id, pShow, forceRemove); - + mTrace("show:%d, released from cache, data:%p force:%d", pShow->id, pShow, forceRemove); + // A bug in tcache.c forceRemove = 0; @@ -158,8 +151,8 @@ static int32_t mndProcessShowMsg(SMnodeMsg *pMnodeMsg) { } int32_t code = (*metaFp)(pMnodeMsg, pShow, &pRsp->tableMeta); - mDebug("show:%d, data:%p get meta finished, numOfRows:%d cols:%d type:%s result:%s", pShow->id, pShow, - pShow->numOfRows, pShow->numOfColumns, mndShowStr(type), tstrerror(code)); + mDebug("show:%d, get meta finished, numOfRows:%d cols:%d type:%s result:%s", pShow->id, pShow->numOfRows, + pShow->numOfColumns, mndShowStr(type), tstrerror(code)); if (code == TSDB_CODE_SUCCESS) { pMnodeMsg->contLen = sizeof(SShowRsp) + sizeof(SSchema) * pShow->numOfColumns; @@ -195,16 +188,15 @@ static int32_t mndProcessRetrieveMsg(SMnodeMsg *pMnodeMsg) { if (retrieveFp == NULL) { mndReleaseShowObj(pShow, false); terrno = TSDB_CODE_MSG_NOT_PROCESSED; - mError("show:%d, data:%p failed to retrieve data since %s", pShow->id, pShow, terrstr()); + mError("show:%d, failed to retrieve data since %s", pShow->id, terrstr()); return -1; } - mDebug("show:%d, data:%p start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow, - pShow->numOfReads, pShow->numOfRows, mndShowStr(pShow->type)); + mDebug("show:%d, start retrieve data, numOfReads:%d numOfRows:%d type:%s", pShow->id, pShow->numOfReads, + pShow->numOfRows, mndShowStr(pShow->type)); if (mndCheckRetrieveFinished(pShow)) { - mDebug("show:%d, data:%p read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow, pShow->numOfReads, - pShow->numOfRows); + mDebug("show:%d, read finished, numOfReads:%d numOfRows:%d", pShow->id, pShow->numOfReads, pShow->numOfRows); pShow->numOfReads = pShow->numOfRows; } @@ -227,7 +219,7 @@ static int32_t mndProcessRetrieveMsg(SMnodeMsg *pMnodeMsg) { if (pRsp == NULL) { mndReleaseShowObj(pShow, false); terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("show:%d, data:%p failed to retrieve data since %s", pShow->id, pShow, terrstr()); + mError("show:%d, failed to retrieve data since %s", pShow->id, terrstr()); return -1; } @@ -236,7 +228,7 @@ static int32_t mndProcessRetrieveMsg(SMnodeMsg *pMnodeMsg) { rowsRead = (*retrieveFp)(pMnodeMsg, pShow, pRsp->data, rowsToRead); } - mDebug("show:%d, data:%p stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, pShow, rowsRead, rowsToRead); + mDebug("show:%d, stop retrieve data, rowsRead:%d rowsToRead:%d", pShow->id, rowsRead, rowsToRead); pRsp->numOfRows = htonl(rowsRead); pRsp->precision = TSDB_TIME_PRECISION_MILLI; // millisecond time precision @@ -246,10 +238,10 @@ static int32_t mndProcessRetrieveMsg(SMnodeMsg *pMnodeMsg) { if (rowsRead == 0 || rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) { pRsp->completed = 1; - mDebug("show:%d, data:%p retrieve completed", pShow->id, pShow); + mDebug("show:%d, retrieve completed", pShow->id); mndReleaseShowObj(pShow, true); } else { - mDebug("show:%d, data:%p retrieve not completed yet", pShow->id, pShow); + mDebug("show:%d, retrieve not completed yet", pShow->id); mndReleaseShowObj(pShow, false); } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 9459c5e5254a03ddc83fa4d5066bed18e55aef66..dd69a34dccd0bf2321ad94d44479d85a37668c91 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -294,18 +294,18 @@ TRANS_DECODE_OVER: return NULL; } - mTrace("trans:%d, decode from raw:%p", pTrans->id, pRaw); + mTrace("trans:%d, decode from raw:%p, data:%p", pTrans->id, pRaw, pTrans); return pRow; } static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { pTrans->stage = TRN_STAGE_PREPARE; - mTrace("trans:%d, perform insert action", pTrans->id); + mTrace("trans:%d, perform insert action, data:%p", pTrans->id, pTrans); return 0; } static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) { - mTrace("trans:%d, perform delete action", pTrans->id); + mTrace("trans:%d, perform delete action, data:%p", pTrans->id, pTrans); mndTransDropLogs(pTrans->redoLogs); mndTransDropLogs(pTrans->undoLogs); @@ -317,7 +317,7 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) { } static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOldTrans, STrans *pNewTrans) { - mTrace("trans:%d, perform update action", pOldTrans->id); + mTrace("trans:%d, perform update action, data:%p", pOldTrans->id, pOldTrans); pOldTrans->stage = pNewTrans->stage; return 0; } @@ -362,14 +362,14 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, SRpcMsg *pMsg) { return NULL; } - mDebug("trans:%d, is created", pTrans->id); + mDebug("trans:%d, is created, data:%p", pTrans->id, pTrans); return pTrans; } static void mndTransDropLogs(SArray *pArray) { for (int32_t i = 0; i < pArray->size; ++i) { SSdbRaw *pRaw = taosArrayGetP(pArray, i); - tfree(pRaw); + sdbFreeRaw(pRaw); } taosArrayDestroy(pArray); @@ -391,7 +391,7 @@ void mndTransDrop(STrans *pTrans) { mndTransDropActions(pTrans->redoActions); mndTransDropActions(pTrans->undoActions); - // mDebug("trans:%d, is dropped, data:%p", pTrans->id, pTrans); + mDebug("trans:%d, is dropped, data:%p", pTrans->id, pTrans); tfree(pTrans); } diff --git a/source/dnode/mnode/sdb/inc/sdbInt.h b/source/dnode/mnode/sdb/inc/sdbInt.h index 00f6d231d627654be9a1110aed91d2ec16e546b9..da90451202ef07edfdff8e9ca3bf350ab1c2c61f 100644 --- a/source/dnode/mnode/sdb/inc/sdbInt.h +++ b/source/dnode/mnode/sdb/inc/sdbInt.h @@ -72,6 +72,7 @@ typedef struct SSdb { } SSdb; int32_t sdbWriteFile(SSdb *pSdb); +void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper); #ifdef __cplusplus } diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index bb0e606463dcacd209692f5bdcf41f53600e6ee8..97bc0ecbdbb9aee8bb1bc031b0b5bf3f18af486b 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -80,16 +80,12 @@ void sdbCleanup(SSdb *pSdb) { SHashObj *hash = pSdb->hashObjs[i]; if (hash == NULL) continue; - SdbDeleteFp deleteFp = pSdb->deleteFps[i]; - SSdbRow **ppRow = taosHashIterate(hash, NULL); + SSdbRow **ppRow = taosHashIterate(hash, NULL); while (ppRow != NULL) { SSdbRow *pRow = *ppRow; if (pRow == NULL) continue; - if (deleteFp != NULL) { - (*deleteFp)(pSdb, pRow->pObj); - } - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); ppRow = taosHashIterate(hash, ppRow); } } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 27ff8e697dab077d89a0ee89d3014740c9e98cf0..78a90b9a7db825a9f66aa18ab00abffdd34d2111 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -16,6 +16,50 @@ #define _DEFAULT_SOURCE #include "sdbInt.h" +static const char *sdbTableName(ESdbType type) { + switch (type) { + case SDB_TRANS: + return "trans"; + case SDB_CLUSTER: + return "cluster"; + case SDB_MNODE: + return "mnode"; + case SDB_DNODE: + return "dnode"; + case SDB_USER: + return "user"; + case SDB_AUTH: + return "auth"; + case SDB_ACCT: + return "acct"; + case SDB_TOPIC: + return "topic"; + case SDB_VGROUP: + return "vgId"; + case SDB_STB: + return "stb"; + case SDB_DB: + return "db"; + case SDB_FUNC: + return "func"; + default: + return "undefine"; + } +} + +void sdbPrintOper(SSdb *pSdb, SSdbRow *pRow, const char *oper) { + EKeyType keyType = pSdb->keyTypes[pRow->type]; + + if (keyType == SDB_KEY_BINARY) { + mTrace("%s:%s, refCount:%d oper:%s", sdbTableName(pRow->type), (char *)pRow->pObj, pRow->refCount, oper); + } else if (keyType == SDB_KEY_INT32) { + mTrace("%s:%d, refCount:%d oper:%s", sdbTableName(pRow->type), *(int32_t *)pRow->pObj, pRow->refCount, oper); + } else if (keyType == SDB_KEY_INT64) { + mTrace("%s:%" PRId64 ", refCount:%d oper:%s", sdbTableName(pRow->type), *(int64_t *)pRow->pObj, pRow->refCount, oper); + } else { + } +} + static SHashObj *sdbGetHash(SSdb *pSdb, int32_t type) { if (type >= SDB_MAX || type <= SDB_START) { terrno = TSDB_CODE_SDB_INVALID_TABLE_TYPE; @@ -55,17 +99,18 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * SSdbRow *pOldRow = taosHashGet(hash, pRow->pObj, keySize); if (pOldRow != NULL) { taosWUnLockLatch(pLock); - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); terrno = TSDB_CODE_SDB_OBJ_ALREADY_THERE; return terrno; } - pRow->refCount = 1; + pRow->refCount = 0; pRow->status = pRaw->status; + sdbPrintOper(pSdb, pRow, "insertRow"); if (taosHashPut(hash, pRow->pObj, keySize, &pRow, sizeof(void *)) != 0) { taosWUnLockLatch(pLock); - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); terrno = TSDB_CODE_SDB_OBJ_ALREADY_THERE; return terrno; } @@ -83,7 +128,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * taosWLockLatch(pLock); taosHashRemove(hash, pRow->pObj, keySize); taosWUnLockLatch(pLock); - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); terrno = code; return terrno; } @@ -113,7 +158,7 @@ static int32_t sdbUpdateRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * code = (*updateFp)(pSdb, pOldRow->pObj, pNewRow->pObj); } - sdbFreeRow(pNewRow); + sdbFreeRow(pSdb, pNewRow); return code; } @@ -123,14 +168,10 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * SRWLatch *pLock = &pSdb->locks[pRow->type]; taosWLockLatch(pLock); - // remove attached object such as trans - SdbDeleteFp deleteFp = pSdb->deleteFps[pRow->type]; - if (deleteFp != NULL) (*deleteFp)(pSdb, pRow->pObj); - SSdbRow **ppOldRow = taosHashGet(hash, pRow->pObj, keySize); if (ppOldRow == NULL || *ppOldRow == NULL) { taosWUnLockLatch(pLock); - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); terrno = TSDB_CODE_SDB_OBJ_NOT_THERE; return terrno; } @@ -140,8 +181,8 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * taosHashRemove(hash, pOldRow->pObj, keySize); taosWUnLockLatch(pLock); - sdbRelease(pSdb, pOldRow->pObj); - sdbFreeRow(pRow); + // sdbRelease(pSdb, pOldRow->pObj); + sdbFreeRow(pSdb, pRow); return code; } @@ -206,6 +247,7 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, void *pKey) { case SDB_STATUS_UPDATING: atomic_add_fetch_32(&pRow->refCount, 1); pRet = pRow->pObj; + sdbPrintOper(pSdb, pRow, "acquireRow"); break; case SDB_STATUS_CREATING: terrno = TSDB_CODE_SDB_OBJ_CREATING; @@ -232,13 +274,9 @@ void sdbRelease(SSdb *pSdb, void *pObj) { taosRLockLatch(pLock); int32_t ref = atomic_sub_fetch_32(&pRow->refCount, 1); + sdbPrintOper(pSdb, pRow, "releaseRow"); if (ref <= 0 && pRow->status == SDB_STATUS_DROPPED) { - SdbDeleteFp deleteFp = pSdb->deleteFps[pRow->type]; - if (deleteFp != NULL) { - (*deleteFp)(pSdb, pRow->pObj); - } - - sdbFreeRow(pRow); + sdbFreeRow(pSdb, pRow); } taosRUnLockLatch(pLock); @@ -255,9 +293,9 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) { if (pIter != NULL) { SSdbRow *pLastRow = *(SSdbRow **)pIter; - int32_t ref = atomic_sub_fetch_32(&pLastRow->refCount, 1); + int32_t ref = atomic_load_32(&pLastRow->refCount); if (ref <= 0 && pLastRow->status == SDB_STATUS_DROPPED) { - sdbFreeRow(pLastRow); + sdbFreeRow(pSdb, pLastRow); } } @@ -270,6 +308,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) { } atomic_add_fetch_32(&pRow->refCount, 1); + sdbPrintOper(pSdb, pRow, "fetchRow"); *ppObj = pRow->pObj; break; } diff --git a/source/dnode/mnode/sdb/src/sdbRaw.c b/source/dnode/mnode/sdb/src/sdbRaw.c index 5a0020199f0652376de73ec5c243301b4ac2371f..e37559808e2b5242354be6187c07fc49a732a940 100644 --- a/source/dnode/mnode/sdb/src/sdbRaw.c +++ b/source/dnode/mnode/sdb/src/sdbRaw.c @@ -27,12 +27,12 @@ SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen) { pRaw->sver = sver; pRaw->dataLen = dataLen; - // mTrace("raw:%p, is created, len:%d", pRaw, dataLen); + mTrace("raw:%p, is created, len:%d", pRaw, dataLen); return pRaw; } void sdbFreeRaw(SSdbRaw *pRaw) { - // mTrace("raw:%p, is freed", pRaw); + mTrace("raw:%p, is freed", pRaw); free(pRaw); } diff --git a/source/dnode/mnode/sdb/src/sdbRow.c b/source/dnode/mnode/sdb/src/sdbRow.c index ec1dcf39e68c7948f54d10434615338fa8f566f3..4c889a6d04a303ec94ec4dfa61571259694166e3 100644 --- a/source/dnode/mnode/sdb/src/sdbRow.c +++ b/source/dnode/mnode/sdb/src/sdbRow.c @@ -35,4 +35,13 @@ void *sdbGetRowObj(SSdbRow *pRow) { return pRow->pObj; } -void sdbFreeRow(SSdbRow *pRow) { tfree(pRow); } +void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow) { + // remove attached object such as trans + SdbDeleteFp deleteFp = pSdb->deleteFps[pRow->type]; + if (deleteFp != NULL) { + (*deleteFp)(pSdb, pRow->pObj); + } + + sdbPrintOper(pSdb, pRow, "freeRow"); + tfree(pRow); +} diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index d1572bb513c533d9a0d0465a03aeeebe6b85f6e6..2e95a740d082dd06e5fe89ca02fe04698a22969e 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -17,7 +17,7 @@ OS_TYPE=`$UNAME_BIN` NODE_NAME= EXEC_OPTON= CLEAR_OPTION="false" -while getopts "n:s:u:x:ct" arg +while getopts "n:s:u:x:cv" arg do case $arg in n) @@ -29,7 +29,7 @@ do c) CLEAR_OPTION="clear" ;; - t) + v) SHELL_OPTION="true" ;; u)