提交 55f5454c 编写于 作者: L lichuang

[fix][TS-417]fix cachelast core

上级 95d736ae
...@@ -859,12 +859,12 @@ int tsdbRestoreInfo(STsdbRepo *pRepo) { ...@@ -859,12 +859,12 @@ int tsdbRestoreInfo(STsdbRepo *pRepo) {
TSKEY lastKey = tsdbGetTableLastKeyImpl(pTable); TSKEY lastKey = tsdbGetTableLastKeyImpl(pTable);
SBlockIdx *pIdx = readh.pBlkIdx; SBlockIdx *pIdx = readh.pBlkIdx;
if (pIdx && lastKey < pIdx->maxKey) { if (pIdx && lastKey < pIdx->maxKey) {
pTable->lastKey = pIdx->maxKey;
if (CACHE_LAST_ROW(pCfg) && tsdbRestoreLastRow(pRepo, pTable, &readh, pIdx) != 0) { if (CACHE_LAST_ROW(pCfg) && tsdbRestoreLastRow(pRepo, pTable, &readh, pIdx) != 0) {
tsdbDestroyReadH(&readh); tsdbDestroyReadH(&readh);
return -1; return -1;
} }
pTable->lastKey = pTable->lastRow ? memRowKey(pTable->lastRow) : pIdx->maxKey;
} }
// restore NULL columns // restore NULL columns
...@@ -976,12 +976,11 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) { ...@@ -976,12 +976,11 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) {
SBlockIdx *pIdx = readh.pBlkIdx; SBlockIdx *pIdx = readh.pBlkIdx;
if (pIdx && cacheLastRowTableNum > 0 && pTable->lastRow == NULL) { if (pIdx && cacheLastRowTableNum > 0 && pTable->lastRow == NULL) {
pTable->lastKey = pIdx->maxKey;
if (tsdbRestoreLastRow(pRepo, pTable, &readh, pIdx) != 0) { if (tsdbRestoreLastRow(pRepo, pTable, &readh, pIdx) != 0) {
tsdbDestroyReadH(&readh); tsdbDestroyReadH(&readh);
return -1; return -1;
} }
pTable->lastKey = pTable->lastRow ? memRowKey(pTable->lastRow) : pIdx->maxKey;
cacheLastRowTableNum -= 1; cacheLastRowTableNum -= 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册