[TD-880]
This commit is contained in:
parent
310ac98edf
commit
ee5038ea85
|
@ -23,7 +23,7 @@ extern "C" {
|
||||||
// TAOS_OS_FUNC_DIR
|
// TAOS_OS_FUNC_DIR
|
||||||
void taosRemoveDir(char *rootDir);
|
void taosRemoveDir(char *rootDir);
|
||||||
int taosMkDir(const char *pathname, mode_t mode);
|
int taosMkDir(const char *pathname, mode_t mode);
|
||||||
void taosMvDir(char* destDir, char *srcDir);
|
void taosRename(char* oldName, char *newName);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,18 +50,17 @@ int taosMkDir(const char *path, mode_t mode) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosMvDir(char* destDir, char *srcDir) {
|
void taosRename(char* oldName, char *newName) {
|
||||||
if (0 == tsEnableVnodeBak) {
|
if (0 == tsEnableVnodeBak) {
|
||||||
uInfo("vnode backup not enabled");
|
uInfo("vnode backup not enabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char shellCmd[1024+1] = {0};
|
if (rename(oldName, newName)) {
|
||||||
|
uError("%s is modify to %s fail, reason:%s", oldName, newName, strerror(errno));
|
||||||
//(void)snprintf(shellCmd, 1024, "cp -rf %s %s", srcDir, destDir);
|
} else {
|
||||||
(void)snprintf(shellCmd, 1024, "mv %s %s", srcDir, destDir);
|
uInfo("%s is modify to %s success!", oldName, newName);
|
||||||
taosSystem(shellCmd);
|
}
|
||||||
uInfo("shell cmd:%s is executed", shellCmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -357,9 +357,11 @@ void vnodeRelease(void *pVnodeRaw) {
|
||||||
taosTFree(pVnode->rootDir);
|
taosTFree(pVnode->rootDir);
|
||||||
|
|
||||||
if (pVnode->dropped) {
|
if (pVnode->dropped) {
|
||||||
char rootDir[TSDB_FILENAME_LEN] = {0};
|
char rootDir[TSDB_FILENAME_LEN] = {0};
|
||||||
|
char newDir[TSDB_FILENAME_LEN] = {0};
|
||||||
sprintf(rootDir, "%s/vnode%d", tsVnodeDir, vgId);
|
sprintf(rootDir, "%s/vnode%d", tsVnodeDir, vgId);
|
||||||
taosMvDir(tsVnodeBakDir, rootDir);
|
sprintf(newDir, "%s/vnode%d", tsVnodeBakDir, vgId);
|
||||||
|
taosRename(rootDir, newDir);
|
||||||
taosRemoveDir(rootDir);
|
taosRemoveDir(rootDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue