not remove tsdb dir

This commit is contained in:
Hongze Cheng 2020-08-19 18:09:49 +08:00
parent 2b251063b4
commit 1cda60b032
1 changed files with 12 additions and 1 deletions

View File

@ -71,7 +71,18 @@ static void tsdbStopStream(STsdbRepo *pRepo);
// Function declaration
int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg) {
taosRemoveDir(rootDir);
DIR *dir = opendir(rootDir);
if (dir) {
tsdbDebug("repository %s already exists", rootDir);
closedir(dir);
return 0;
} else {
if (ENOENT != errno) {
tsdbError("failed to open directory %s since %s", rootDir, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
}
if (mkdir(rootDir, 0755) < 0) {
tsdbError("vgId:%d failed to create rootDir %s since %s", pCfg->tsdbId, rootDir, strerror(errno));