From 400e1770129afd72e87d1813b840ab93e11aefef Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 16 Sep 2021 07:43:41 +0800 Subject: [PATCH] compact function verify --- src/tsdb/src/tsdbReadImpl.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/tsdb/src/tsdbReadImpl.c b/src/tsdb/src/tsdbReadImpl.c index 17e34010b7..7ba415eea4 100644 --- a/src/tsdb/src/tsdbReadImpl.c +++ b/src/tsdb/src/tsdbReadImpl.c @@ -662,6 +662,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat // Recover the data int ccol = 0; // loop iter for SBlockCol object int dcol = 0; // loop iter for SDataCols object + SBlockCol blockCol = {0}; while (dcol < pDataCols->numOfCols) { SDataCol *pDataCol = &(pDataCols->cols[dcol]); if (dcol != 0 && ccol >= pBlockData->numOfCols) { @@ -676,10 +677,19 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat int32_t tlen = pBlock->keyLen; if (dcol != 0) { - SBlockCol *pBlockCol = &(pBlockData->cols[ccol]); - tcolId = pBlockCol->colId; - toffset = tsdbGetBlockColOffset(pBlockCol); - tlen = pBlockCol->len; + if (pBlock->blkVer == SBlockVerLatest) { + SBlockCol *pBlockCol = &(pBlockData->cols[ccol]); + tcolId = pBlockCol->colId; + toffset = tsdbGetBlockColOffset(pBlockCol); + tlen = pBlockCol->len; + } else { + SBlockColV0 *pBlockCol = (SBlockColV0 *)(pBlockData->cols) + ccol; + tcolId = pBlockCol->colId; + blockCol.offset = pBlockCol->offset; + blockCol.offsetH = pBlockCol->offsetH; + toffset = tsdbGetBlockColOffset(&blockCol); + tlen = pBlockCol->len; + } } else { ASSERT(pDataCol->colId == tcolId); } -- GitLab