reset smsStatWindow
This commit is contained in:
parent
3d248b72d0
commit
c3920c4697
|
@ -58,8 +58,9 @@ typedef enum {
|
||||||
TSDB_FILE_META, // meta
|
TSDB_FILE_META, // meta
|
||||||
TSDB_FILE_TSMA, // .tsma.${sma_index_name}, Time-range-wise SMA
|
TSDB_FILE_TSMA, // .tsma.${sma_index_name}, Time-range-wise SMA
|
||||||
TSDB_FILE_RSMA, // .rsma.${sma_index_name}, Time-range-wise Rollup SMA
|
TSDB_FILE_RSMA, // .rsma.${sma_index_name}, Time-range-wise Rollup SMA
|
||||||
} TSDB_FILE_T;
|
} E_TSDB_FILE_T;
|
||||||
|
|
||||||
|
typedef int32_t TSDB_FILE_T;
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TSDB_FS_VER_0 = 0,
|
TSDB_FS_VER_0 = 0,
|
||||||
TSDB_FS_VER_MAX,
|
TSDB_FS_VER_MAX,
|
||||||
|
|
|
@ -203,6 +203,23 @@ int32_t tsdbUpdateExpiredWindow(STsdb *pTsdb, char *msg) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t tsdbResetExpiredWindow(STsdb *pTsdb, const char *indexName, void *timeWindow) {
|
||||||
|
SSmaStatItem *pItem = NULL;
|
||||||
|
|
||||||
|
if (pTsdb->pSmaStat && pTsdb->pSmaStat->smaStatItems) {
|
||||||
|
pItem = (SSmaStatItem *)taosHashGet(pTsdb->pSmaStat->smaStatItems, indexName, strlen(indexName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pItem != NULL) {
|
||||||
|
// TODO: reset time windows for the sma data blocks
|
||||||
|
while (true) {
|
||||||
|
TSKEY thisWindow = 0;
|
||||||
|
taosHashRemove(pItem->expiredWindows, &thisWindow, sizeof(thisWindow));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Judge the tSma storage level
|
* @brief Judge the tSma storage level
|
||||||
*
|
*
|
||||||
|
@ -495,6 +512,9 @@ int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, STSma *param, STSmaData *pData) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset the SSmaStat
|
||||||
|
tsdbResetExpiredWindow(pTsdb, param->indexName, &pData->tsWindow);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,6 +562,10 @@ int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, SRSma *param, STSmaData *pData) {
|
||||||
TASSERT(0);
|
TASSERT(0);
|
||||||
return TSDB_CODE_INVALID_PARA;
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset the SSmaStat
|
||||||
|
tsdbResetExpiredWindow(pTsdb, param->tsma.indexName, &pData->tsWindow);
|
||||||
|
|
||||||
// Step 4: finish
|
// Step 4: finish
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <metaDef.h>
|
#include <metaDef.h>
|
||||||
#include <tmsg.h>
|
#include <tmsg.h>
|
||||||
|
#include <tsdbDef.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||||
|
@ -209,7 +210,7 @@ TEST(testCase, tSma_DB_Put_Get_Del_Test) {
|
||||||
metaClose(pMeta);
|
metaClose(pMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
TEST(testCase, tSmaInsertTest) {
|
TEST(testCase, tSmaInsertTest) {
|
||||||
STSma tSma = {0};
|
STSma tSma = {0};
|
||||||
STSmaData* pSmaData = NULL;
|
STSmaData* pSmaData = NULL;
|
||||||
|
|
Loading…
Reference in New Issue