diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 34ecc25c59507f836078164130440f89627e86e7..cf762b9af6a1802a5820a52197ac95f0013c35f9 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -494,6 +494,12 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) { if ((pQueryInfo->type & TSDB_QUERY_TYPE_STABLE_SUBQUERY) == TSDB_QUERY_TYPE_STABLE_SUBQUERY) { SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0); + + code = tscGetMeterMeta(pSql, pMeterMetaInfo); + pRes->code = code; + + if (code == TSDB_CODE_ACTION_IN_PROGRESS) return; + assert(pMeterMetaInfo->pMeterMeta->numOfTags != 0 && pMeterMetaInfo->vnodeIndex >= 0 && pSql->param != NULL); SRetrieveSupport *trs = (SRetrieveSupport *)pSql->param; @@ -504,11 +510,6 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) { tscTrace("%p get metricMeta during super table query successfully", pSql); - code = tscGetMeterMeta(pSql, pMeterMetaInfo); - pRes->code = code; - - if (code == TSDB_CODE_ACTION_IN_PROGRESS) return; - code = tscGetMetricMeta(pSql, 0); pRes->code = code; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 2d86e7c4e006fe0785826746e17d4865eaf26fe4..77d4a95c145a1556c0e8240e7a5645202f0a0186 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -2064,7 +2064,14 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void pMeterMetaInfo->tagColumnIndex); } - assert(pFinalInfo->pMeterMeta != NULL && pNewQueryInfo->numOfTables == 1); + if (pFinalInfo->pMeterMeta == NULL) { + tscError("%p new subquery failed for get pMeterMeta is NULL from cache", pSql); + tscFreeSqlObj(pNew); + return NULL; + } + + assert(pNewQueryInfo->numOfTables == 1); + if (UTIL_METER_IS_SUPERTABLE(pMeterMetaInfo)) { assert(pFinalInfo->pMetricMeta != NULL); } diff --git a/src/system/detail/src/vnodeRead.c b/src/system/detail/src/vnodeRead.c index 08b0b1eba6f2dcd18ae6d5c9d716404e7bff08a6..7a92fa235b59b3406bf66123acefd0f4206e207b 100644 --- a/src/system/detail/src/vnodeRead.c +++ b/src/system/detail/src/vnodeRead.c @@ -496,6 +496,9 @@ void vnodeDecRefCount(void *param) { assert(vnodeIsQInfoValid(pQInfo)); int32_t ref = atomic_sub_fetch_32(&pQInfo->refCount, 1); + if (ref < 0) { + return; // avoid two threads dec ref count + } assert(ref >= 0); dTrace("QInfo:%p decrease obj refcount, %d", pQInfo, ref); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index c042c0181f4cf0ed2525e4d57eacb9e68d328615..54c6ea039cfded934e2b9738ff450ff9772eb7ab 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -587,6 +587,8 @@ void *taosAddDataIntoCache(void *handle, char *key, char *pData, int dataSize, i "size:%" PRId64 " bytes, collision:%d", pNode->key, pNode, HASH_INDEX(pNode->hashVal, pObj->capacity), pNode->addTime, pNode->time, pObj->size, pObj->totalSize, pObj->statistics.numOfCollision); + } else { + pError("key:%s failed to added into cache, out of memory", key); } } else { // old data exists, update the node pNode = taosUpdateCacheImpl(pObj, pOldNode, key, keyLen, pData, dataSize, keepTime * 1000L);