This commit is contained in:
Hongze Cheng 2021-11-08 14:21:10 +08:00
parent 641f5b567e
commit beef26b525
2 changed files with 9 additions and 11 deletions

View File

@ -89,14 +89,16 @@ static int vnodeOpenImpl(SVnode *pVnode) {
// Open meta // Open meta
sprintf(dir, "%s/meta", pVnode->path); sprintf(dir, "%s/meta", pVnode->path);
if (metaOpen(dir, &(pVnode->options.metaOptions)) < 0) { pVnode->pMeta = metaOpen(dir, &(pVnode->options.metaOptions));
if (pVnode->pMeta == NULL) {
// TODO: handle error // TODO: handle error
return -1; return -1;
} }
// Open tsdb // Open tsdb
sprintf(dir, "%s/tsdb", pVnode->path); sprintf(dir, "%s/tsdb", pVnode->path);
if (tsdbOpen(dir, &(pVnode->options.tsdbOptions)) < 0) { pVnode->pTsdb = tsdbOpen(dir, &(pVnode->options.tsdbOptions));
if (pVnode->pTsdb == NULL) {
// TODO: handle error // TODO: handle error
return -1; return -1;
} }

View File

@ -32,14 +32,10 @@ static int metaSaveMapDB(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid);
} while (0) } while (0)
int metaOpenDB(SMeta *pMeta) { int metaOpenDB(SMeta *pMeta) {
char dbDir[128];
char dir[128]; char dir[128];
char * err = NULL; char * err = NULL;
rocksdb_options_t *options = rocksdb_options_create(); rocksdb_options_t *options = rocksdb_options_create();
// TODO
sprintf(dbDir, "%s/db", pMeta->path);
if (pMeta->pCache) { if (pMeta->pCache) {
rocksdb_options_set_row_cache(options, pMeta->pCache); rocksdb_options_set_row_cache(options, pMeta->pCache);
} }
@ -53,23 +49,23 @@ int metaOpenDB(SMeta *pMeta) {
} }
// tbDb // tbDb
sprintf(dir, "%s/tb_db", dbDir); sprintf(dir, "%s/tb_db", pMeta->path);
META_OPEN_DB_IMPL(pMeta->pDB->tbDb, options, dir, err); META_OPEN_DB_IMPL(pMeta->pDB->tbDb, options, dir, err);
// nameDb // nameDb
sprintf(dir, "%s/name_db", dbDir); sprintf(dir, "%s/name_db", pMeta->path);
META_OPEN_DB_IMPL(pMeta->pDB->nameDb, options, dir, err); META_OPEN_DB_IMPL(pMeta->pDB->nameDb, options, dir, err);
// tagDb // tagDb
sprintf(dir, "%s/tag_db", dbDir); sprintf(dir, "%s/tag_db", pMeta->path);
META_OPEN_DB_IMPL(pMeta->pDB->tagDb, options, dir, err); META_OPEN_DB_IMPL(pMeta->pDB->tagDb, options, dir, err);
// schemaDb // schemaDb
sprintf(dir, "%s/schema_db", dbDir); sprintf(dir, "%s/schema_db", pMeta->path);
META_OPEN_DB_IMPL(pMeta->pDB->schemaDb, options, dir, err); META_OPEN_DB_IMPL(pMeta->pDB->schemaDb, options, dir, err);
// mapDb // mapDb
sprintf(dir, "%s/map_db", dbDir); sprintf(dir, "%s/map_db", pMeta->path);
META_OPEN_DB_IMPL(pMeta->pDB->mapDb, options, dir, err); META_OPEN_DB_IMPL(pMeta->pDB->mapDb, options, dir, err);
rocksdb_options_destroy(options); rocksdb_options_destroy(options);