more code
This commit is contained in:
parent
fea538b4c9
commit
4dbdd2e35b
|
@ -19,7 +19,7 @@
|
||||||
struct SDataFileReader {
|
struct SDataFileReader {
|
||||||
SDataFileReaderConfig config[1];
|
SDataFileReaderConfig config[1];
|
||||||
|
|
||||||
SBuffer local[5];
|
SBuffer local[10];
|
||||||
SBuffer *buffers;
|
SBuffer *buffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -189,14 +189,16 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
|
SBuffer *buffer = reader->buffers + 0;
|
||||||
|
SBuffer *assist = reader->buffers + 1;
|
||||||
|
|
||||||
// load data
|
// load data
|
||||||
tBufferClear(&reader->buffers[0]);
|
tBufferClear(buffer);
|
||||||
code =
|
code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, brinBlk->dp->size, buffer, 0);
|
||||||
tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_HEAD], brinBlk->dp->offset, brinBlk->dp->size, &reader->buffers[0], 0);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
// decode brin block
|
// decode brin block
|
||||||
SBufferReader br = BUFFER_READER_INITIALIZER(0, &reader->buffers[0]);
|
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
|
||||||
tBrinBlockClear(brinBlock);
|
tBrinBlockClear(brinBlock);
|
||||||
brinBlock->numOfPKs = brinBlk->numOfPKs;
|
brinBlock->numOfPKs = brinBlk->numOfPKs;
|
||||||
brinBlock->numOfRecords = brinBlk->numRec;
|
brinBlock->numOfRecords = brinBlk->numRec;
|
||||||
|
@ -207,8 +209,7 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
||||||
.compressedSize = brinBlk->size[i],
|
.compressedSize = brinBlk->size[i],
|
||||||
.originalSize = brinBlk->numRec * sizeof(int64_t),
|
.originalSize = brinBlk->numRec * sizeof(int64_t),
|
||||||
};
|
};
|
||||||
code = tDecompressDataToBuffer(tBufferGetDataAt(br.buffer, br.offset), &cinfo, brinBlock->buffers + i,
|
code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, brinBlock->buffers + i, assist);
|
||||||
reader->buffers + 1);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
br.offset += brinBlk->size[i];
|
br.offset += brinBlk->size[i];
|
||||||
}
|
}
|
||||||
|
@ -220,8 +221,7 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
||||||
.compressedSize = brinBlk->size[i],
|
.compressedSize = brinBlk->size[i],
|
||||||
.originalSize = brinBlk->numRec * sizeof(int32_t),
|
.originalSize = brinBlk->numRec * sizeof(int32_t),
|
||||||
};
|
};
|
||||||
code = tDecompressDataToBuffer(tBufferGetDataAt(br.buffer, br.offset), &cinfo, brinBlock->buffers + i,
|
code = tDecompressDataToBuffer(BR_PTR(&br), &cinfo, brinBlock->buffers + i, assist);
|
||||||
reader->buffers + 1);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
br.offset += brinBlk->size[i];
|
br.offset += brinBlk->size[i];
|
||||||
}
|
}
|
||||||
|
@ -242,22 +242,18 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
||||||
|
|
||||||
for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
|
for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
|
||||||
SValueColumnCompressInfo *info = firstInfos + i;
|
SValueColumnCompressInfo *info = firstInfos + i;
|
||||||
int32_t totalCompressedSize = info->offsetCompressedSize + info->dataCompressedSize;
|
|
||||||
|
|
||||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), info, brinBlock->firstKeyPKs + i,
|
code = tValueColumnDecompress(BR_PTR(&br), info, brinBlock->firstKeyPKs + i, assist);
|
||||||
reader->buffers + 1);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
br.offset += totalCompressedSize;
|
br.offset += (info->offsetCompressedSize + info->dataCompressedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
|
for (int32_t i = 0; i < brinBlk->numOfPKs; i++) {
|
||||||
SValueColumnCompressInfo *info = lastInfos + i;
|
SValueColumnCompressInfo *info = lastInfos + i;
|
||||||
int32_t totalCompressedSize = info->offsetCompressedSize + info->dataCompressedSize;
|
|
||||||
|
|
||||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), info, brinBlock->lastKeyPKs + i,
|
code = tValueColumnDecompress(BR_PTR(&br), info, brinBlock->lastKeyPKs + i, assist);
|
||||||
reader->buffers + 1);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
br.offset += totalCompressedSize;
|
br.offset += (info->offsetCompressedSize + info->dataCompressedSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,16 +272,19 @@ int32_t tsdbDataFileReadBlockData(SDataFileReader *reader, const SBrinRecord *re
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
|
|
||||||
|
SBuffer *buffer = reader->buffers + 0;
|
||||||
|
SBuffer *assist = reader->buffers + 1;
|
||||||
|
|
||||||
// load data
|
// load data
|
||||||
tBufferClear(&reader->buffers[0]);
|
tBufferClear(buffer);
|
||||||
code =
|
code = tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockSize, buffer, 0);
|
||||||
tsdbReadFileToBuffer(reader->fd[TSDB_FTYPE_DATA], record->blockOffset, record->blockSize, &reader->buffers[0], 0);
|
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
// decompress
|
// decompress
|
||||||
SBufferReader br = BUFFER_READER_INITIALIZER(0, &reader->buffers[0]);
|
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
|
||||||
code = tBlockDataDecompress(&br, bData, reader->buffers + 1);
|
code = tBlockDataDecompress(&br, bData, assist);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
ASSERT(br.offset == buffer->size);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
if (code) {
|
if (code) {
|
||||||
|
@ -294,24 +293,6 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tBlockColAndColumnCmpr(const void *p1, const void *p2) {
|
|
||||||
const SBlockCol *pBlockCol = (const SBlockCol *)p1;
|
|
||||||
const STColumn *pColumn = (const STColumn *)p2;
|
|
||||||
|
|
||||||
if (pBlockCol->cid < pColumn->colId) {
|
|
||||||
return -1;
|
|
||||||
} else if (pBlockCol->cid > pColumn->colId) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int32_t tBlockDataDecompressKeyPart(const SDiskDataHdr *hdr, SBufferReader *br, SBlockData *blockData,
|
|
||||||
SBuffer *assist);
|
|
||||||
extern int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *blockCol, SBufferReader *br,
|
|
||||||
SBlockData *blockData, SBuffer *assist);
|
|
||||||
|
|
||||||
int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRecord *record, SBlockData *bData,
|
int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRecord *record, SBlockData *bData,
|
||||||
STSchema *pTSchema, int16_t cids[], int32_t ncid) {
|
STSchema *pTSchema, int16_t cids[], int32_t ncid) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
|
@ -194,7 +194,6 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int32_t tBlockColAndColumnCmpr(const void *p1, const void *p2);
|
|
||||||
extern int32_t tBlockDataDecompressKeyPart(const SDiskDataHdr *hdr, SBufferReader *br, SBlockData *blockData,
|
extern int32_t tBlockDataDecompressKeyPart(const SDiskDataHdr *hdr, SBufferReader *br, SBlockData *blockData,
|
||||||
SBuffer *assist);
|
SBuffer *assist);
|
||||||
extern int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *blockCol, SBufferReader *br,
|
extern int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *blockCol, SBufferReader *br,
|
||||||
|
|
Loading…
Reference in New Issue