feat: add lru to index

This commit is contained in:
yihaoDeng 2022-07-14 20:38:37 +08:00
parent ca7ca2f1e3
commit de495eb7ec
1 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
if (h) {
SDataBlock* blk = taosLRUCacheValue(ctx->lru, h);
nread = MIN(blkLeft, len);
nread = TMIN(blkLeft, len);
memcpy(buf + total, blk->buf + blkOffset, nread);
taosLRUCacheRelease(ctx->lru, h, false);
} else {
@ -85,7 +85,7 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
blk->blockId = blkId;
blk->nread = taosPReadFile(ctx->file.pFile, blk->buf, kBlockSize, blkId * kBlockSize);
assert(blk->nread <= kBlockSize);
nread = MIN(blkLeft, len);
nread = TMIN(blkLeft, len);
if (blk->nread < kBlockSize && blk->nread < len) {
break;