This commit is contained in:
Hongze Cheng 2020-06-13 02:47:44 +00:00
parent 6413285bb9
commit 21a5beabb9
2 changed files with 12 additions and 1 deletions

View File

@ -114,7 +114,7 @@ void tsdbCloseBufPool(STsdbRepo *pRepo) {
SListNode *tsdbAllocBufBlockFromPool(STsdbRepo *pRepo) {
ASSERT(pRepo != NULL && pRepo->pool != NULL);
// ASSERT pRepo is locked
ASSERT(IS_REPO_LOCKED(pRepo));
STsdbCfg * pCfg = &pRepo->config;
STsdbBufPool *pBufPool = pRepo->pool;

View File

@ -170,6 +170,17 @@ static void *tsdbAllocBytes(STsdbRepo *pRepo, int bytes) {
tsdbUnRefMemTable(pRepo, pIMem);
}
} else {
if (tsdbLockRepo(pRepo) < 0) {
tsdbFreeMemTable(pMemTable);
return NULL;
}
SListNode *pNode = tsdbAllocBufBlockFromPool(pRepo);
tdListAppendNode(pMemTable->bufBlockList, pNode);
pRepo->mem = pMemTable;
if (tsdbUnlockRepo(pRepo) < 0) return NULL;
}
}