more
This commit is contained in:
parent
112ebc5819
commit
efb4ac0e32
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue