提交 efb4ac0e 编写于 作者: H hzcheng

more

上级 112ebc58
...@@ -4,18 +4,12 @@ ...@@ -4,18 +4,12 @@
#include "tsdb.h" #include "tsdb.h"
TEST(TsdbTest, createTsdbRepo) { 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); ASSERT_NE(pRepo, nullptr);
......
...@@ -76,8 +76,9 @@ typedef struct STable { ...@@ -76,8 +76,9 @@ typedef struct STable {
typedef struct { typedef struct {
int32_t maxTables; int32_t maxTables;
int32_t nTables;
STable **tables; // array of normal tables 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 * void * tableMap; // hash map of uid ==> STable *
} STsdbMeta; } STsdbMeta;
......
...@@ -6,14 +6,8 @@ ...@@ -6,14 +6,8 @@
#include "tsdb.h" #include "tsdb.h"
#include "tsdbMeta.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 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 int tsdbFreeTable(STable *pTable);
static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
static STable *tsdbGetTableByUid(int64_t uid); static STable *tsdbGetTableByUid(int64_t uid);
...@@ -22,8 +16,6 @@ static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable); ...@@ -22,8 +16,6 @@ static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable);
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable); static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
STsdbMeta *tsdbCreateMeta(int32_t maxTables) { STsdbMeta *tsdbCreateMeta(int32_t maxTables) {
if (!IS_VALID_MAX_TABLES(maxTables)) return NULL;
STsdbMeta *pMeta = (STsdbMeta *)malloc(sizeof(STsdbMeta)); STsdbMeta *pMeta = (STsdbMeta *)malloc(sizeof(STsdbMeta));
if (pMeta == NULL) { if (pMeta == NULL) {
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册