提交 0e50a966 编写于 作者: H Hongze Cheng

refact code

上级 de8944b6
......@@ -1782,40 +1782,15 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
if (pRowInfo == NULL) goto _exit;
SBlockData *pBData;
if (pCommitter->toLastOnly) {
SBlockData *pBDatal = &pCommitter->dWriter.bDatal;
pBData = &pCommitter->dWriter.bDatal;
code = tsdbInitLastBlockIfNeed(pCommitter, id);
if (code) goto _err;
while (pRowInfo) {
STSchema *pTSchema = NULL;
if (pRowInfo->row.type == 0) {
code = tsdbCommitterUpdateRowSchema(pCommitter, id.suid, id.uid, TSDBROW_SVERSION(&pRowInfo->row));
if (code) goto _err;
pTSchema = pCommitter->skmRow.pTSchema;
}
code = tBlockDataAppendRow(pBDatal, &pRowInfo->row, pTSchema, id.uid);
if (code) goto _err;
code = tsdbNextCommitRow(pCommitter);
if (code) goto _err;
pRowInfo = tsdbGetCommitRow(pCommitter);
if (pRowInfo && (pRowInfo->suid != id.suid || pRowInfo->uid != id.uid)) {
pRowInfo = NULL;
}
if (pBDatal->nRow >= pCommitter->maxRow) {
code = tsdbCommitLastBlock(pCommitter);
if (code) goto _err;
}
}
} else {
SBlockData *pBData = &pCommitter->dWriter.bData;
pBData = &pCommitter->dWriter.bData;
ASSERT(pBData->nRow == 0);
}
while (pRowInfo) {
STSchema *pTSchema = NULL;
......@@ -1837,12 +1812,17 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
}
if (pBData->nRow >= pCommitter->maxRow) {
if (pCommitter->toLastOnly) {
code = tsdbCommitLastBlock(pCommitter);
if (code) goto _err;
} else {
code = tsdbCommitDataBlock(pCommitter);
if (code) goto _err;
}
}
}
if (pBData->nRow) {
if (!pCommitter->toLastOnly && pBData->nRow) {
if (pBData->nRow > pCommitter->minRow) {
code = tsdbCommitDataBlock(pCommitter);
if (code) goto _err;
......@@ -1851,7 +1831,6 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) {
if (code) goto _err;
}
}
}
_exit:
return code;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册