diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 1c1626ba5cf19947ab16b6eb1fd9625a7268656b..1eea398fdfd6beda751c9bac7e2d811a3751e8e3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -208,13 +208,21 @@ static int32_t tsdbCacheQueryReseek(void* pQHandle) { int32_t code = 0; SCacheRowsReader* pReader = pQHandle; - taosThreadMutexLock(&pReader->readerMutex); + code = taosThreadMutexTryLock(&pReader->readerMutex); + if (code == 0) { + // pause current reader's state if not paused, save ts & version for resuming + // just wait for the big all tables' snapshot untaking for now - // pause current reader's state if not paused, save ts & version for resuming - // just wait for the big all tables' snapshot untaking for now + code = TSDB_CODE_VND_QUERY_BUSY; - taosThreadMutexUnlock(&pReader->readerMutex); - return code; + taosThreadMutexUnlock(&pReader->readerMutex); + + return code; + } else if (code == EBUSY) { + return TSDB_CODE_VND_QUERY_BUSY; + } else { + return -1; + } } int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32_t* slotIds, SArray* pTableUidList) {