diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 3a375ec59c0cfc01e2270f7b4ba7af2868b87ced..5a4c785f023e7dd986b39a86a7f56df6a7a09570 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -907,13 +907,12 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) { atomic_store_8(&pRepo->hasCachedLastColumn, 0); } tsdbInfo("free cache last data since cacheLast option changed"); - for (int i = 1; i < maxTableIdx; i++) { + for (int i = 1; i <= maxTableIdx; i++) { STable *pTable = pMeta->tables[i]; if (pTable == NULL) continue; if (need_free_last_row) { taosTZfree(pTable->lastRow); pTable->lastRow = NULL; - pTable->lastKey = TSKEY_INITIAL_VAL; } if (need_free_last_col) { tsdbFreeLastColumns(pTable); diff --git a/src/tsdb/src/tsdbMemTable.c b/src/tsdb/src/tsdbMemTable.c index 1f88474f8e70beb4e31afcbc3c460b7ab80c45dd..ec773dbb385900c6f94037350338cb3d43596d08 100644 --- a/src/tsdb/src/tsdbMemTable.c +++ b/src/tsdb/src/tsdbMemTable.c @@ -1030,7 +1030,6 @@ static int tsdbUpdateTableLatestInfo(STsdbRepo *pRepo, STable *pTable, SDataRow taosTZfree(pTable->lastRow); TSDB_WLOCK_TABLE(pTable); pTable->lastRow = NULL; - pTable->lastKey = TSKEY_INITIAL_VAL; TSDB_WUNLOCK_TABLE(pTable); }