提交 33d58a5d 编写于 作者: H Haojun Liao

Merge remote-tracking branch 'origin/feat/tsdb_refact' into feat/tsdb_refact

...@@ -165,21 +165,23 @@ static int32_t getMemLastRow(SMemTable *mem, tb_uid_t suid, tb_uid_t uid, STSRow ...@@ -165,21 +165,23 @@ static int32_t getMemLastRow(SMemTable *mem, tb_uid_t suid, tb_uid_t uid, STSRow
static int32_t getTableDelDataFromDelIdx(SDelFReader *pDelReader, SDelIdx *pDelIdx, SArray *aDelData) { static int32_t getTableDelDataFromDelIdx(SDelFReader *pDelReader, SDelIdx *pDelIdx, SArray *aDelData) {
int32_t code = 0; int32_t code = 0;
SMapData delDataMap; // SMapData delDataMap;
SDelData delData; // SDelData delData;
if (pDelIdx) { if (pDelIdx) {
tMapDataReset(&delDataMap); // tMapDataReset(&delDataMap);
// code = tsdbReadDelData(pDelReader, pDelIdx, &delDataMap, NULL); // code = tsdbReadDelData(pDelReader, pDelIdx, &delDataMap, NULL);
code = tsdbReadDelData(pDelReader, pDelIdx, aDelData, NULL);
if (code) goto _err; if (code) goto _err;
/*
for (int32_t iDelData = 0; iDelData < delDataMap.nItem; ++iDelData) { for (int32_t iDelData = 0; iDelData < delDataMap.nItem; ++iDelData) {
code = tMapDataGetItemByIdx(&delDataMap, iDelData, &delData, tGetDelData); code = tMapDataGetItemByIdx(&delDataMap, iDelData, &delData, tGetDelData);
if (code) goto _err; if (code) goto _err;
taosArrayPush(aDelData, &delData); taosArrayPush(aDelData, &delData);
} }
*/
} }
_err: _err:
...@@ -241,14 +243,17 @@ _err: ...@@ -241,14 +243,17 @@ _err:
static int32_t getTableDelIdx(SDelFReader *pDelFReader, tb_uid_t suid, tb_uid_t uid, SDelIdx *pDelIdx) { static int32_t getTableDelIdx(SDelFReader *pDelFReader, tb_uid_t suid, tb_uid_t uid, SDelIdx *pDelIdx) {
int32_t code = 0; int32_t code = 0;
SMapData delIdxMap; // SMapData delIdxMap;
SArray *pDelIdxArray = taosArrayInit(32, sizeof(SDelIdx));
SDelIdx idx = {.suid = suid, .uid = uid}; SDelIdx idx = {.suid = suid, .uid = uid};
tMapDataReset(&delIdxMap); // tMapDataReset(&delIdxMap);
// code = tsdbReadDelIdx(pDelFReader, &delIdxMap, NULL); // code = tsdbReadDelIdx(pDelFReader, &delIdxMap, NULL);
code = tsdbReadDelIdx(pDelFReader, pDelIdxArray, NULL);
if (code) goto _err; if (code) goto _err;
code = tMapDataSearch(&delIdxMap, &idx, tGetDelIdx, tCmprDelIdx, pDelIdx); // code = tMapDataSearch(&delIdxMap, &idx, tGetDelIdx, tCmprDelIdx, pDelIdx);
pDelIdx = taosArraySearch(pDelIdxArray, &idx, tCmprDelIdx, TD_EQ);
if (code) goto _err; if (code) goto _err;
_err: _err:
...@@ -590,8 +595,12 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) { ...@@ -590,8 +595,12 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
*ppRow = NULL; *ppRow = NULL;
SDelFReader *pDelFReader; SArray *pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState); SDelFile *pDelFile = tsdbFSStateGetDelFile(pTsdb->fs->cState);
if (pDelFile) {
SDelFReader *pDelFReader;
code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb, NULL); code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb, NULL);
if (code) goto _err; if (code) goto _err;
...@@ -599,13 +608,13 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) { ...@@ -599,13 +608,13 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
code = getTableDelIdx(pDelFReader, suid, uid, &delIdx); code = getTableDelIdx(pDelFReader, suid, uid, &delIdx);
if (code) goto _err; if (code) goto _err;
SArray *pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline); code = getTableDelSkyline(pMem, pIMem, pDelFReader, &delIdx, pSkyline);
if (code) goto _err; if (code) goto _err;
int iSkyline = taosArrayGetSize(pSkyline) - 1;
tsdbDelFReaderClose(pDelFReader); tsdbDelFReaderClose(pDelFReader);
}
int iSkyline = taosArrayGetSize(pSkyline) - 1;
SBlockIdx idx = {.suid = suid, .uid = uid}; SBlockIdx idx = {.suid = suid, .uid = uid};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册