more work

This commit is contained in:
Hongze Cheng 2022-06-28 05:55:20 +00:00
parent 79e23420b4
commit fbb9ebfddc
1 changed files with 49 additions and 51 deletions

View File

@ -50,6 +50,8 @@ typedef struct {
SDelFWriter *pDelFWriter;
SMapData nDelIdxMap; // SMapData<SDelIdx>, new
SMapData nDelDataMap; // SMapData<SDelData>, new
SArray *aDelIdx;
SArray *aDelData;
} SCommitter;
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter);
@ -926,6 +928,43 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
int32_t c = tTABLEIDCmprFn(pTbData, pBlockIdx);
if (c == 0) {
goto _commit_table_mem_and_disk;
} else if (c < 0) {
goto _commit_table_mem_data;
} else {
goto _commit_table_disk_data;
}
} else if (pBlockIdx) {
goto _commit_table_disk_data;
} else {
goto _commit_table_mem_data;
}
_commit_table_mem_data:
code = tsdbCommitTableData(pCommitter, pTbData, NULL);
if (code) goto _err;
iTbData++;
if (iTbData < nTbData) {
pTbData = (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData);
} else {
pTbData = NULL;
}
continue;
_commit_table_disk_data:
code = tsdbCommitTableData(pCommitter, NULL, pBlockIdx);
if (code) goto _err;
iBlockIdx++;
if (iBlockIdx < nBlockIdx) {
tMapDataGetItemByIdx(&pCommitter->oBlockIdxMap, iBlockIdx, pBlockIdx, tGetBlockIdx);
} else {
pBlockIdx = NULL;
}
continue;
_commit_table_mem_and_disk:
code = tsdbCommitTableData(pCommitter, pTbData, pBlockIdx);
if (code) goto _err;
@ -941,48 +980,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) {
} else {
pTbData = NULL;
}
} else if (c < 0) {
code = tsdbCommitTableData(pCommitter, NULL, pBlockIdx);
if (code) goto _err;
iBlockIdx++;
if (iBlockIdx < nBlockIdx) {
tMapDataGetItemByIdx(&pCommitter->oBlockIdxMap, iBlockIdx, pBlockIdx, tGetBlockIdx);
} else {
pBlockIdx = NULL;
}
} else {
code = tsdbCommitTableData(pCommitter, pTbData, NULL);
if (code) goto _err;
iTbData++;
if (iTbData < nTbData) {
pTbData = (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData);
} else {
pTbData = NULL;
}
}
} else if (pBlockIdx) {
code = tsdbCommitTableData(pCommitter, NULL, pBlockIdx);
if (code) goto _err;
iBlockIdx++;
if (iBlockIdx < nBlockIdx) {
tMapDataGetItemByIdx(&pCommitter->oBlockIdxMap, iBlockIdx, pBlockIdx, tGetBlockIdx);
} else {
pBlockIdx = NULL;
}
} else {
code = tsdbCommitTableData(pCommitter, pTbData, NULL);
if (code) goto _err;
iTbData++;
if (iTbData < nTbData) {
pTbData = (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData);
} else {
pTbData = NULL;
}
}
continue;
}
return code;