fix: remove asserts and memory issue
This commit is contained in:
parent
b0338a1a6b
commit
a944dd0d8b
|
@ -4752,7 +4752,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p
|
|||
QUERY_CHECK_NULL(pInfo->filterCtx.colHash, code, lino, _error, terrno);
|
||||
|
||||
pInfo->filterCtx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
|
||||
QUERY_CHECK_NULL(pInfo->pRes, code, lino, _error, terrno);
|
||||
QUERY_CHECK_NULL(pInfo->filterCtx.cInfoList, code, lino, _error, terrno);
|
||||
|
||||
if (pInfo->pTagCond != NULL) {
|
||||
nodesRewriteExprPostOrder(&pTagCond, tagScanRewriteTagColumn, (void*)&pInfo->filterCtx);
|
||||
|
|
|
@ -39,8 +39,6 @@ static void median(void *src, int64_t size, int64_t s, int64_t e, const void *pa
|
|||
doswap(elePtrAt(src, size, s), elePtrAt(src, size, e), size, buf);
|
||||
}
|
||||
|
||||
ASSERT(comparFn(elePtrAt(src, size, mid), elePtrAt(src, size, s), param) <= 0 &&
|
||||
comparFn(elePtrAt(src, size, s), elePtrAt(src, size, e), param) <= 0);
|
||||
}
|
||||
|
||||
static void tInsertSort(void *src, int64_t size, int32_t s, int32_t e, const void *param, __ext_compar_fn_t comparFn,
|
||||
|
@ -323,7 +321,7 @@ void *taosbsearch(const void *key, const void *base, int32_t nmemb, int32_t size
|
|||
} else if (flags == TD_LT) {
|
||||
return (c > 0) ? p : (midx > 0 ? p - size : NULL);
|
||||
} else {
|
||||
ASSERT(0);
|
||||
uError("Invalid bsearch flags:%d", flags);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ static void pushfrontNodeInEntryList(SCacheEntry *pEntry, SCacheNode *pNode) {
|
|||
pNode->pNext = pEntry->next;
|
||||
pEntry->next = pNode;
|
||||
pEntry->num += 1;
|
||||
ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0));
|
||||
//A S S E R T((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0));
|
||||
}
|
||||
|
||||
static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode *pNode) {
|
||||
|
@ -274,7 +274,7 @@ static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode
|
|||
|
||||
pNode->pNext = NULL;
|
||||
pe->num -= 1;
|
||||
ASSERT((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0));
|
||||
//A S S E R T((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0));
|
||||
}
|
||||
|
||||
static FORCE_INLINE SCacheEntry *doFindEntry(SCacheObj *pCacheObj, const void *key, size_t keyLen) {
|
||||
|
@ -499,7 +499,7 @@ void *taosCacheAcquireByData(SCacheObj *pCacheObj, void *data) {
|
|||
uDebug("cache:%s, data: %p acquired by data in cache, refcnt:%d", pCacheObj->name, ptNode->data, ref);
|
||||
|
||||
// the data if referenced by at least one object, so the reference count must be greater than the value of 2.
|
||||
ASSERT(ref >= 2);
|
||||
//A S S E R T(ref >= 2);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -574,19 +574,19 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
|
|||
if (ref == 1) {
|
||||
// If it is the last ref, remove it from trashcan linked-list first, and then destroy it.Otherwise, it may be
|
||||
// destroyed by refresh worker if decrease ref count before removing it from linked-list.
|
||||
ASSERT(pNode->pTNodeHeader->pData == pNode);
|
||||
//A S S E R T(pNode->pTNodeHeader->pData == pNode);
|
||||
|
||||
__trashcan_wr_lock(pCacheObj);
|
||||
(void)doRemoveElemInTrashcan(pCacheObj, pNode->pTNodeHeader);
|
||||
__trashcan_unlock(pCacheObj);
|
||||
|
||||
ref = T_REF_DEC(pNode);
|
||||
ASSERT(ref == 0);
|
||||
//A S S E R T(ref == 0);
|
||||
|
||||
doDestroyTrashcanElem(pCacheObj, pNode->pTNodeHeader);
|
||||
} else {
|
||||
ref = T_REF_DEC(pNode);
|
||||
ASSERT(ref >= 0);
|
||||
//A S S E R T(ref >= 0);
|
||||
}
|
||||
} else {
|
||||
// NOTE: remove it from hash in the first place, otherwise, the pNode may have been released by other thread
|
||||
|
@ -608,7 +608,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
|
|||
"others already, prev must in trashcan",
|
||||
pCacheObj->name, pNode->key, p->data, T_REF_VAL_GET(p), pNode->data, T_REF_VAL_GET(pNode));
|
||||
|
||||
ASSERT(p->pTNodeHeader == NULL && pNode->pTNodeHeader != NULL);
|
||||
//A S S E R T(p->pTNodeHeader == NULL && pNode->pTNodeHeader != NULL);
|
||||
} else {
|
||||
removeNodeInEntryList(pe, prev, p);
|
||||
uDebug("cache:%s, key:%p, %p successfully removed from hash table, refcnt:%d", pCacheObj->name, pNode->key,
|
||||
|
@ -668,7 +668,7 @@ void doTraverseElems(SCacheObj *pCacheObj, bool (*fp)(void *param, SCacheNode *p
|
|||
} else {
|
||||
*pPre = next;
|
||||
pEntry->num -= 1;
|
||||
ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0));
|
||||
//A S S E R T((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0));
|
||||
|
||||
(void)atomic_sub_fetch_ptr(&pCacheObj->numOfElems, 1);
|
||||
pNode = next;
|
||||
|
@ -734,7 +734,7 @@ SCacheNode *taosCreateCacheNode(const char *key, size_t keyLen, const char *pDat
|
|||
|
||||
void taosAddToTrashcan(SCacheObj *pCacheObj, SCacheNode *pNode) {
|
||||
if (pNode->inTrashcan) { /* node is already in trash */
|
||||
ASSERT(pNode->pTNodeHeader != NULL && pNode->pTNodeHeader->pData == pNode);
|
||||
//A S S E R T(pNode->pTNodeHeader != NULL && pNode->pTNodeHeader->pData == pNode);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,7 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) {
|
|||
STrashElem *pElem = pCacheObj->pTrash;
|
||||
while (pElem) {
|
||||
T_REF_VAL_CHECK(pElem->pData);
|
||||
ASSERT(pElem->next != pElem && pElem->prev != pElem);
|
||||
//A S S E R T(pElem->next != pElem && pElem->prev != pElem);
|
||||
|
||||
if (force || (T_REF_VAL_GET(pElem->pData) == 0)) {
|
||||
uDebug("cache:%s, key:%p, %p removed from trashcan. numOfElem in trashcan:%d", pCacheObj->name, pElem->pData->key,
|
||||
|
|
|
@ -118,7 +118,6 @@ int32_t tScalableBfPut(SScalableBf* pSBf, const void* keyBuf, uint32_t len, int3
|
|||
}
|
||||
|
||||
SBloomFilter* pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1);
|
||||
ASSERT(pNormalBf);
|
||||
if (tBloomFilterIsFull(pNormalBf)) {
|
||||
code = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth,
|
||||
pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO, &pNormalBf);
|
||||
|
|
Loading…
Reference in New Issue