This commit is contained in:
Hongze Cheng 2020-06-09 05:45:26 +00:00
parent 5fe9e5864f
commit 0f06fb97af
2 changed files with 6 additions and 6 deletions

View File

@ -161,7 +161,7 @@ typedef struct {
int64_t index; int64_t index;
int numOfCacheBlocks; int numOfCacheBlocks;
SList * memPool; SList * memPool;
} STsdbCachePool; } STsdbBufferPool;
typedef struct { typedef struct {
TSKEY keyFirst; TSKEY keyFirst;
@ -173,7 +173,7 @@ typedef struct {
typedef struct { typedef struct {
int cacheBlockSize; int cacheBlockSize;
int totalCacheBlocks; int totalCacheBlocks;
STsdbCachePool pool; STsdbBufferPool pool;
STsdbCacheBlock *curBlock; STsdbCacheBlock *curBlock;
SCacheMem * mem; SCacheMem * mem;
SCacheMem * imem; SCacheMem * imem;

View File

@ -35,7 +35,7 @@ STsdbCache *tsdbInitCache(int cacheBlockSize, int totalBlocks, TsdbRepoT *pRepo)
pCache->totalCacheBlocks = totalBlocks; pCache->totalCacheBlocks = totalBlocks;
pCache->pRepo = pRepo; pCache->pRepo = pRepo;
STsdbCachePool *pPool = &(pCache->pool); STsdbBufferPool *pPool = &(pCache->pool);
pPool->index = 0; pPool->index = 0;
pPool->memPool = tdListNew(sizeof(STsdbCacheBlock *)); pPool->memPool = tdListNew(sizeof(STsdbCacheBlock *));
if (pPool->memPool == NULL) goto _err; if (pPool->memPool == NULL) goto _err;
@ -106,7 +106,7 @@ static void tsdbFreeCacheMem(SCacheMem *mem) {
} }
static int tsdbAllocBlockFromPool(STsdbCache *pCache) { static int tsdbAllocBlockFromPool(STsdbCache *pCache) {
STsdbCachePool *pPool = &(pCache->pool); STsdbBufferPool *pPool = &(pCache->pool);
tsdbLockRepo(pCache->pRepo); tsdbLockRepo(pCache->pRepo);
if (listNEles(pPool->memPool) == 0) { if (listNEles(pPool->memPool) == 0) {
@ -170,7 +170,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
} }
static int tsdbAddCacheBlockToPool(STsdbCache *pCache) { static int tsdbAddCacheBlockToPool(STsdbCache *pCache) {
STsdbCachePool *pPool = &pCache->pool; STsdbBufferPool *pPool = &pCache->pool;
STsdbCacheBlock *pBlock = malloc(sizeof(STsdbCacheBlock) + pCache->cacheBlockSize); STsdbCacheBlock *pBlock = malloc(sizeof(STsdbCacheBlock) + pCache->cacheBlockSize);
if (pBlock == NULL) return -1; if (pBlock == NULL) return -1;
@ -184,7 +184,7 @@ static int tsdbAddCacheBlockToPool(STsdbCache *pCache) {
} }
static int tsdbRemoveCacheBlockFromPool(STsdbCache *pCache) { static int tsdbRemoveCacheBlockFromPool(STsdbCache *pCache) {
STsdbCachePool *pPool = &pCache->pool; STsdbBufferPool *pPool = &pCache->pool;
STsdbCacheBlock *pBlock = NULL; STsdbCacheBlock *pBlock = NULL;
ASSERT(pCache->totalCacheBlocks >= 0); ASSERT(pCache->totalCacheBlocks >= 0);