fix TD-1835
This commit is contained in:
parent
4ee2662c01
commit
f403fc0c6e
|
@ -79,7 +79,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
|
|||
DIR * dir = NULL;
|
||||
int fid = 0;
|
||||
int vid = 0;
|
||||
regex_t regex1, regex2;
|
||||
regex_t regex1 = {0}, regex2 = {0};
|
||||
int code = 0;
|
||||
char fname[TSDB_FILENAME_LEN] = "\0";
|
||||
|
||||
|
@ -95,9 +95,24 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
|
|||
|
||||
dir = opendir(tDataDir);
|
||||
if (dir == NULL) {
|
||||
tsdbError("vgId:%d failed to open directory %s since %s", REPO_ID(pRepo), tDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
if (errno == ENOENT) {
|
||||
if (taosMkDir(tDataDir, 0755) < 0) {
|
||||
tsdbError("vgId:%d failed to create directory %s since %s", REPO_ID(pRepo), tDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
}
|
||||
|
||||
dir = opendir(tDataDir);
|
||||
if (dir == NULL) {
|
||||
tsdbError("vgId:%d failed to open directory %s since %s", REPO_ID(pRepo), tDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
}
|
||||
} else {
|
||||
tsdbError("vgId:%d failed to open directory %s since %s", REPO_ID(pRepo), tDataDir, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
||||
code = regcomp(®ex1, "^v[0-9]+f[0-9]+\\.(head|data|last|stat)$", REG_EXTENDED);
|
||||
|
|
Loading…
Reference in New Issue