From efb4ac0e321ec3de736645618d1e60526f69b46e Mon Sep 17 00:00:00 2001 From: hzcheng Date: Wed, 4 Mar 2020 09:53:46 +0000 Subject: [PATCH] more --- src/vnode/tests/tsdb/tsdbTests.cpp | 14 ++++---------- src/vnode/tsdb/inc/tsdbMeta.h | 3 ++- src/vnode/tsdb/src/tsdbMeta.c | 8 -------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/vnode/tests/tsdb/tsdbTests.cpp b/src/vnode/tests/tsdb/tsdbTests.cpp index 3e7a7cca5f..3cf4b7727d 100644 --- a/src/vnode/tests/tsdb/tsdbTests.cpp +++ b/src/vnode/tests/tsdb/tsdbTests.cpp @@ -4,18 +4,12 @@ #include "tsdb.h" TEST(TsdbTest, createTsdbRepo) { - STsdbCfg config; + STsdbCfg *pCfg = tsdbCreateDefaultCfg(); - config.precision = TSDB_PRECISION_MILLI; - config.tsdbId = 0; - config.maxTables = 100; - config.daysPerFile = 10; - config.keep = 3650; - config.minRowsPerFileBlock = 100; - config.maxRowsPerFileBlock = 4096; - config.maxCacheSize = 4 * 1024 * 1024; - tsdb_repo_t *pRepo = tsdbCreateRepo("/root/mnt/test/vnode0", &config, NULL); + tsdb_repo_t *pRepo = tsdbCreateRepo("/root/mnt/test/vnode0", pCfg, NULL); + + tsdbFreeCfg(pCfg); ASSERT_NE(pRepo, nullptr); diff --git a/src/vnode/tsdb/inc/tsdbMeta.h b/src/vnode/tsdb/inc/tsdbMeta.h index 99930e9454..bbd4ae7f73 100644 --- a/src/vnode/tsdb/inc/tsdbMeta.h +++ b/src/vnode/tsdb/inc/tsdbMeta.h @@ -76,8 +76,9 @@ typedef struct STable { typedef struct { int32_t maxTables; + int32_t nTables; STable **tables; // array of normal tables - STable * stables; // linked list of super tables + STable * stables; // linked list of super tables // TODO use container to implement this void * tableMap; // hash map of uid ==> STable * } STsdbMeta; diff --git a/src/vnode/tsdb/src/tsdbMeta.c b/src/vnode/tsdb/src/tsdbMeta.c index e56254456c..a6cf5d2d1b 100644 --- a/src/vnode/tsdb/src/tsdbMeta.c +++ b/src/vnode/tsdb/src/tsdbMeta.c @@ -6,14 +6,8 @@ #include "tsdb.h" #include "tsdbMeta.h" -#define TSDB_MIN_TABLES 10 -#define TSDB_MAX_TABLES 100000 -#define TSDB_DEFAULT_NSTABLES 10 - #define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here -#define IS_VALID_MAX_TABLES(maxTables) (((maxTables) >= TSDB_MIN_TABLES) && ((maxTables) <= TSDB_MAX_TABLES)) - static int tsdbFreeTable(STable *pTable); static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static STable *tsdbGetTableByUid(int64_t uid); @@ -22,8 +16,6 @@ static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable); static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable); STsdbMeta *tsdbCreateMeta(int32_t maxTables) { - if (!IS_VALID_MAX_TABLES(maxTables)) return NULL; - STsdbMeta *pMeta = (STsdbMeta *)malloc(sizeof(STsdbMeta)); if (pMeta == NULL) { return NULL; -- GitLab