提交 6c7dce73 编写于 作者: C Cary Xu

fix: merge data in memory and file

上级 73e4dd95
......@@ -111,7 +111,7 @@ int32_t tsdbBegin(STsdb *pTsdb) {
int32_t tsdbCommit(STsdb *pTsdb) {
if (!pTsdb) return 0;
int32_t code = 0;
SCommitH commith = {0};
SDFileSet *pSet = NULL;
......@@ -495,7 +495,9 @@ static int32_t tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
break;
}
if (pIter && pIter->pTable && (!pIdx || (pIter->pTable->suid <= pIdx->suid || pIter->pTable->uid <= pIdx->uid))) {
if (pIter && pIter->pTable &&
(!pIdx || ((pIter->pTable->suid < pIdx->suid) ||
(pIter->pTable->suid == pIdx->suid && pIter->pTable->uid <= pIdx->uid)))) {
if (tsdbCommitToTable(pCommith, mIter) < 0) {
tsdbCloseCommitFile(pCommith, true);
// revert the file change
......@@ -503,7 +505,7 @@ static int32_t tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
return -1;
}
if (pIdx && (pIter->pTable->uid == pIdx->uid)) {
if (pIdx && ((pIter->pTable->uid == pIdx->uid) && (pIter->pTable->suid == pIdx->suid))) {
++fIter;
}
++mIter;
......@@ -517,7 +519,10 @@ static int32_t tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) {
tsdbApplyDFileSetChange(TSDB_COMMIT_WRITE_FSET(pCommith), pSet);
return -1;
}
++fIter;
} else {
ASSERT(0);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册