提交 20fb3563 编写于 作者: H Hongze Cheng

more vnode snap writer

上级 26509fa2
......@@ -583,12 +583,49 @@ static int32_t tsdbSnapWriteDataImpl(STsdbSnapWriter* pWriter, TABLEID id) {
pWriter->pBlockIdxW = &pWriter->blockIdx;
pWriter->pBlockIdxW->suid = id.suid;
pWriter->pBlockIdxW->uid = id.uid;
pWriter->pBlockW = &pWriter->blockW;
tBlockReset(pWriter->pBlockW);
tBlockDataReset(&pWriter->bDataW);
tMapDataReset(&pWriter->mBlockW);
}
// set block schema (todo)
// add rows
for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) {
TSDBROW* pRow = &tsdbRowFromBlockData(pBlockData, iRow);
code = tBlockDataAppendRow(&pWriter->bDataW, pRow, NULL);
if (code) goto _err;
if (pWriter->bDataW.nRow >= pWriter->maxRow * 4 / 5) {
// write the block to file
pWriter->pBlockW->last = 0;
code = tsdbWriteBlockData(pWriter->pDataFWriter, &pWriter->bDataW, NULL, NULL, pWriter->pBlockIdxW,
pWriter->pBlockW, pWriter->cmprAlg);
if (code) goto _err;
code = tMapDataPutItem(&pWriter->mBlockW, pWriter->pBlockW, tPutBlock);
if (code) goto _err;
// reset
tBlockReset(pWriter->pBlockW);
tBlockDataReset(&pWriter->bDataW);
}
}
} else {
}
return code;
_err:
tsdbError("vgId:%d vnode snapshot tsdb write data impl failed since %s", TD_VID(pWriter->pTsdb->pVnode),
tstrerror(code));
return code;
}
static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册