From 7a56281311f098a188097a59e3a81dd112cfa5a0 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Sat, 21 Mar 2020 22:38:32 +0800 Subject: [PATCH] TD-34 --- src/vnode/tsdb/src/tsdbMain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vnode/tsdb/src/tsdbMain.c b/src/vnode/tsdb/src/tsdbMain.c index 208272fa8b..a02343f817 100644 --- a/src/vnode/tsdb/src/tsdbMain.c +++ b/src/vnode/tsdb/src/tsdbMain.c @@ -672,6 +672,8 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable pTable->mem = (SMemTable *)calloc(1, sizeof(SMemTable)); if (pTable->mem == NULL) return -1; pTable->mem->pData = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], 0, 0, getTupleKey); + pTable->mem->keyFirst = INT64_MAX; + pTable->mem->keyLast = 0; } tSkipListRandNodeInfo(pTable->mem->pData, &level, &headSize); @@ -687,6 +689,10 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable // Insert the skiplist node into the data tSkipListPut(pTable->mem->pData, pNode); + TSKEY key = dataRowKey(row); + if (key > pTable->mem->keyLast) pTable->mem->keyLast = key; + if (key < pTable->mem->keyFirst) pTable->mem->keyFirst = key; + pTable->mem->numOfPoints++; return 0; } -- GitLab