This commit is contained in:
Hongze Cheng 2022-01-07 02:09:47 +00:00
parent b1351da7cd
commit 84c2ed27b3
2 changed files with 8 additions and 8 deletions

View File

@ -104,8 +104,8 @@ STsdbCfg *tsdbGetCfg(const STsdb *repo);
// --------- TSDB REPOSITORY DEFINITION // --------- TSDB REPOSITORY DEFINITION
int32_t tsdbCreateRepo(int repoid); int32_t tsdbCreateRepo(int repoid);
int32_t tsdbDropRepo(int repoid); int32_t tsdbDropRepo(int repoid);
STsdb * tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH); STsdb * tsdbOpen(STsdbCfg *pCfg, STsdbAppH *pAppH);
int tsdbCloseRepo(STsdb *repo, int toCommit); int tsdbClose(STsdb *repo, int toCommit);
int32_t tsdbConfigRepo(STsdb *repo, STsdbCfg *pCfg); int32_t tsdbConfigRepo(STsdb *repo, STsdbCfg *pCfg);
int tsdbGetState(STsdb *repo); int tsdbGetState(STsdb *repo);
int8_t tsdbGetCompactState(STsdb *repo); int8_t tsdbGetCompactState(STsdb *repo);

View File

@ -63,7 +63,7 @@ int32_t tsdbDropRepo(int repoid) {
return tfsRmdir(tsdbDir); return tfsRmdir(tsdbDir);
} }
STsdb *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) { STsdb *tsdbOpen(STsdbCfg *pCfg, STsdbAppH *pAppH) {
STsdb *pRepo; STsdb *pRepo;
STsdbCfg config = *pCfg; STsdbCfg config = *pCfg;
@ -85,27 +85,27 @@ STsdb *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
// Open meta // Open meta
if (tsdbOpenMeta(pRepo) < 0) { if (tsdbOpenMeta(pRepo) < 0) {
tsdbError("vgId:%d failed to open TSDB repository while opening Meta since %s", config.tsdbId, tstrerror(terrno)); tsdbError("vgId:%d failed to open TSDB repository while opening Meta since %s", config.tsdbId, tstrerror(terrno));
tsdbCloseRepo(pRepo, false); tsdbClose(pRepo, false);
return NULL; return NULL;
} }
if (tsdbOpenBufPool(pRepo) < 0) { if (tsdbOpenBufPool(pRepo) < 0) {
tsdbError("vgId:%d failed to open TSDB repository while opening buffer pool since %s", config.tsdbId, tsdbError("vgId:%d failed to open TSDB repository while opening buffer pool since %s", config.tsdbId,
tstrerror(terrno)); tstrerror(terrno));
tsdbCloseRepo(pRepo, false); tsdbClose(pRepo, false);
return NULL; return NULL;
} }
if (tsdbOpenFS(pRepo) < 0) { if (tsdbOpenFS(pRepo) < 0) {
tsdbError("vgId:%d failed to open TSDB repository while opening FS since %s", config.tsdbId, tstrerror(terrno)); tsdbError("vgId:%d failed to open TSDB repository while opening FS since %s", config.tsdbId, tstrerror(terrno));
tsdbCloseRepo(pRepo, false); tsdbClose(pRepo, false);
return NULL; return NULL;
} }
// TODO: Restore information from data // TODO: Restore information from data
if ((!(pRepo->state & TSDB_STATE_BAD_DATA)) && tsdbRestoreInfo(pRepo) < 0) { if ((!(pRepo->state & TSDB_STATE_BAD_DATA)) && tsdbRestoreInfo(pRepo) < 0) {
tsdbError("vgId:%d failed to open TSDB repository while restore info since %s", config.tsdbId, tstrerror(terrno)); tsdbError("vgId:%d failed to open TSDB repository while restore info since %s", config.tsdbId, tstrerror(terrno));
tsdbCloseRepo(pRepo, false); tsdbClose(pRepo, false);
return NULL; return NULL;
} }
@ -119,7 +119,7 @@ STsdb *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
} }
// Note: all working thread and query thread must stopped when calling this function // Note: all working thread and query thread must stopped when calling this function
int tsdbCloseRepo(STsdb *repo, int toCommit) { int tsdbClose(STsdb *repo, int toCommit) {
if (repo == NULL) return 0; if (repo == NULL) return 0;
STsdb *pRepo = repo; STsdb *pRepo = repo;