refact code
This commit is contained in:
parent
de8944b62c
commit
0e50a96668
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue