fix: fix clear cache caused deadlock issue
This commit is contained in:
parent
c414e274fa
commit
4ade68aa31
|
@ -416,6 +416,7 @@ typedef struct SCtgCacheOperation {
|
|||
bool syncOp;
|
||||
tsem_t rspSem;
|
||||
bool stopQueue;
|
||||
bool unLocked;
|
||||
} SCtgCacheOperation;
|
||||
|
||||
typedef struct SCtgQNode {
|
||||
|
|
|
@ -674,7 +674,13 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
|
|||
tsem_post(&gCtgMgmt.queue.reqSem);
|
||||
|
||||
if (syncOp) {
|
||||
if (!operation->unLocked) {
|
||||
CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock);
|
||||
}
|
||||
tsem_wait(&operation->rspSem);
|
||||
if (!operation->unLocked) {
|
||||
CTG_LOCK(CTG_READ, &gCtgMgmt.lock);
|
||||
}
|
||||
taosMemoryFree(operation);
|
||||
}
|
||||
|
||||
|
@ -1011,6 +1017,7 @@ int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool
|
|||
op->opId = CTG_OP_CLEAR_CACHE;
|
||||
op->syncOp = syncOp;
|
||||
op->stopQueue = stopQueue;
|
||||
op->unLocked = true;
|
||||
|
||||
SCtgClearCacheMsg *msg = taosMemoryMalloc(sizeof(SCtgClearCacheMsg));
|
||||
if (NULL == msg) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "catalogInt.h"
|
||||
|
||||
extern SCatalogMgmt gCtgMgmt;
|
||||
SCtgDebug gCTGDebug = {0};
|
||||
SCtgDebug gCTGDebug = {.lockEnable = true};
|
||||
|
||||
void ctgdUserCallback(SMetaData* pResult, void* param, int32_t code) {
|
||||
ASSERT(*(int32_t*)param == 1);
|
||||
|
|
|
@ -331,7 +331,7 @@ int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
|
|||
SHashObj* pBatchs = taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pBatchs) {
|
||||
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
|
||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
pTask->pBatchs = pBatchs;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue