diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 2da98a41df4b7f2a6a11f6cc08a30a7ea5dc49d7..185aa071d717b3bbe0a7a047569a479041c668db 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -114,7 +114,6 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->tsdbCfg.keep2 = 3650; // pCreate->daysToKeep0; pCfg->tsdbCfg.keep0 = 3650; // pCreate->daysToKeep2; pCfg->tsdbCfg.keep1 = 3650; // pCreate->daysToKeep0; - pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; pCfg->tsdbCfg.retentions = pCreate->pRetensions; pCfg->walCfg.vgId = pCreate->vgId; pCfg->hashBegin = pCreate->hashBegin; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 3314d2f264753309dbcd6e6d13084449a6a574f5..87bf6463cd660f6b3e183552a362fe444442f695 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -133,23 +133,18 @@ int32_t tqRetrieveDataBlock(SArray **ppCols, STqReadHandle *pHandle, uint64_t *p // need to reposition // structs -struct SMetaCfg { - uint64_t lruSize; -}; - struct STsdbCfg { - int8_t precision; - int8_t update; - int8_t compression; - int8_t slLevel; - int32_t days; - int32_t minRows; - int32_t maxRows; - int32_t keep2; - int32_t keep0; - int32_t keep1; - uint64_t lruCacheSize; - SArray *retentions; + int8_t precision; + int8_t update; + int8_t compression; + int8_t slLevel; + int32_t days; + int32_t minRows; + int32_t maxRows; + int32_t keep0; + int32_t keep1; + int32_t keep2; + SArray *retentions; }; struct SVnodeCfg { @@ -160,8 +155,6 @@ struct SVnodeCfg { int32_t szCache; uint64_t szBuf; bool isHeap; - uint32_t ttl; - uint32_t keep; int8_t streamMode; bool isWeak; STsdbCfg tsdbCfg; diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 3349accb8833aaa28c85bdca45d3f9137d075724..30297309771f10e302f59b0e6b6e32c1a52f1458 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -46,7 +46,7 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKe // tsdbCommit ================ -#if 1 +#if 1 // ====================================== typedef struct SSmaStat SSmaStat; typedef struct SSmaEnv SSmaEnv; @@ -168,7 +168,6 @@ typedef struct { struct STsdb { char *path; SVnode *pVnode; - int32_t vgId; bool repoLocked; TdThreadMutex mutex; STsdbCfg config; @@ -179,7 +178,7 @@ struct STsdb { SSmaEnvs smaEnvs; }; -#define REPO_ID(r) ((r)->vgId) +#define REPO_ID(r) TD_VID((r)->pVnode) #define REPO_CFG(r) (&(r)->config) #define REPO_FS(r) ((r)->fs) #define REPO_META(r) ((r)->pVnode->pMeta) @@ -891,66 +890,6 @@ static FORCE_INLINE int tsdbUnLockFS(STsdbFS *pFs) { return 0; } -// tsdbSma -// #define TSDB_SMA_TEST // remove after test finished - -// struct SSmaEnv { -// TdThreadRwlock lock; -// SDiskID did; -// TDBEnv dbEnv; // TODO: If it's better to put it in smaIndex level? -// char *path; // relative path -// SSmaStat *pStat; -// }; - -// #define SMA_ENV_LOCK(env) ((env)->lock) -// #define SMA_ENV_DID(env) ((env)->did) -// #define SMA_ENV_ENV(env) ((env)->dbEnv) -// #define SMA_ENV_PATH(env) ((env)->path) -// #define SMA_ENV_STAT(env) ((env)->pStat) -// #define SMA_ENV_STAT_ITEMS(env) ((env)->pStat->smaStatItems) - -// void tsdbDestroySmaEnv(SSmaEnv *pSmaEnv); -// void *tsdbFreeSmaEnv(SSmaEnv *pSmaEnv); -// #if 0 -// int32_t tsdbGetTSmaStatus(STsdb *pTsdb, STSma *param, void *result); -// int32_t tsdbRemoveTSmaData(STsdb *pTsdb, STSma *param, STimeWindow *pWin); -// #endif - -// // internal func -// static FORCE_INLINE int32_t tsdbEncodeTSmaKey(int64_t groupId, TSKEY tsKey, void **pData) { -// int32_t len = 0; -// len += taosEncodeFixedI64(pData, tsKey); -// len += taosEncodeFixedI64(pData, groupId); -// return len; -// } - -// static FORCE_INLINE int32_t tsdbRLockSma(SSmaEnv *pEnv) { -// int code = taosThreadRwlockRdlock(&(pEnv->lock)); -// if (code != 0) { -// terrno = TAOS_SYSTEM_ERROR(code); -// return -1; -// } -// return 0; -// } - -// static FORCE_INLINE int32_t tsdbWLockSma(SSmaEnv *pEnv) { -// int code = taosThreadRwlockWrlock(&(pEnv->lock)); -// if (code != 0) { -// terrno = TAOS_SYSTEM_ERROR(code); -// return -1; -// } -// return 0; -// } - -// static FORCE_INLINE int32_t tsdbUnLockSma(SSmaEnv *pEnv) { -// int code = taosThreadRwlockUnlock(&(pEnv->lock)); -// if (code != 0) { -// terrno = TAOS_SYSTEM_ERROR(code); -// return -1; -// } -// return 0; -// } - typedef struct SSmaKey SSmaKey; struct SSmaKey { diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 91a7e1cd54dbd9596a1899478295ed4b441e8105..de7e8dee456f27d7459c02815b10ff76dd7b8dc3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -644,7 +644,7 @@ static int tsdbComparFidFSet(const void *arg1, const void *arg2) { } static void tsdbGetTxnFname(STsdb *pRepo, TSDB_TXN_FILE_T ftype, char fname[]) { - snprintf(fname, TSDB_FILENAME_LEN, "%s/vnode/vnode%d/tsdb/%s", tfsGetPrimaryPath(REPO_TFS(pRepo)), pRepo->vgId, + snprintf(fname, TSDB_FILENAME_LEN, "%s/vnode/vnode%d/tsdb/%s", tfsGetPrimaryPath(REPO_TFS(pRepo)), REPO_ID(pRepo), tsdbTxnFname[ftype]); } diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c index 74e3c66a9d4a1fed262516c5a178542f62fa85be..f36ef37635221ccae4de8b0e0a1fff1a65a703d0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile.c @@ -310,7 +310,7 @@ void tsdbInitDFile(STsdb *pRepo, SDFile *pDFile, SDiskID did, int fid, uint32_t pDFile->info.magic = TSDB_FILE_INIT_MAGIC; pDFile->info.fver = tsdbGetDFSVersion(ftype); - tsdbGetFilename(pRepo->vgId, fid, ver, ftype, fname); + tsdbGetFilename(REPO_ID(pRepo), fid, ver, ftype, fname); tfsInitFile(REPO_TFS(pRepo), &(pDFile->f), did, fname); } diff --git a/source/dnode/vnode/src/tsdb/tsdbMain.c b/source/dnode/vnode/src/tsdb/tsdbMain.c index de5ff9ac916a87df6df5900eadd44bf657329f48..e235797ea18331806f7f239e7b2e7e9b809232e6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMain.c +++ b/source/dnode/vnode/src/tsdb/tsdbMain.c @@ -33,7 +33,6 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb) { sprintf(pTsdb->path, "%s%s%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path, TD_DIRSEP, VNODE_TSDB_DIR); pTsdb->pVnode = pVnode; - pTsdb->vgId = TD_VID(pVnode); pTsdb->repoLocked = false; tdbMutexInit(&pTsdb->mutex, NULL); pTsdb->config = pVnode->config.tsdbCfg; diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index df8cf8d50323d035dc24a4b9f325d43300f523a4..0e55113dc3f1600ac3ed6a041b43f9d934d5d440 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -23,8 +23,6 @@ const SVnodeCfg vnodeCfgDefault = { .szCache = 256, .szBuf = 96 * 1024 * 1024, .isHeap = false, - .ttl = 0, - .keep = 0, .streamMode = 0, .isWeak = 0, .tsdbCfg = {.precision = TSDB_TIME_PRECISION_MILLI, @@ -58,8 +56,6 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "szCache", pCfg->szCache) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "szBuf", pCfg->szBuf) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "isHeap", pCfg->isHeap) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "ttl", pCfg->ttl) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep", pCfg->keep) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "streamMode", pCfg->streamMode) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "isWeak", pCfg->isWeak) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; @@ -72,7 +68,6 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.vgId", pCfg->walCfg.vgId) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.fsyncPeriod", pCfg->walCfg.fsyncPeriod) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "wal.retentionPeriod", pCfg->walCfg.retentionPeriod) < 0) return -1; @@ -109,8 +104,6 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "szCache", pCfg->szCache) < 0) return -1; if (tjsonGetNumberValue(pJson, "szBuf", pCfg->szBuf) < 0) return -1; if (tjsonGetNumberValue(pJson, "isHeap", pCfg->isHeap) < 0) return -1; - if (tjsonGetNumberValue(pJson, "ttl", pCfg->ttl) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep", pCfg->keep) < 0) return -1; if (tjsonGetNumberValue(pJson, "streamMode", pCfg->streamMode) < 0) return -1; if (tjsonGetNumberValue(pJson, "isWeak", pCfg->isWeak) < 0) return -1; if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; @@ -123,7 +116,6 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; if (tjsonGetNumberValue(pJson, "wal.vgId", pCfg->walCfg.vgId) < 0) return -1; if (tjsonGetNumberValue(pJson, "wal.fsyncPeriod", pCfg->walCfg.fsyncPeriod) < 0) return -1; if (tjsonGetNumberValue(pJson, "wal.retentionPeriod", pCfg->walCfg.retentionPeriod) < 0) return -1;