diff --git a/src/vnode/tests/tsdb/tsdbTests.cpp b/src/vnode/tests/tsdb/tsdbTests.cpp index 3e7a7cca5f4cc6ce5f443416c6b963bff764a5b9..3cf4b7727dca7358f2a91ad14b2acf4ebc4e9ff3 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 99930e94540aee37bd49e6b6b3cddc43df66863b..bbd4ae7f737b2c4fc974d0cfd2cdbc3e71905027 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 e56254456cb1debd87c2af04aad3d9bf4ead8f9d..a6cf5d2d1be3c904d0af3efcda2dc95880510d9e 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;