提交 0ed403dd 编写于 作者: S Shengliang Guan

Merge remote-tracking branch 'origin/master' into feature/os

...@@ -23,7 +23,7 @@ extern "C" { ...@@ -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,19 @@ int taosMkDir(const char *path, mode_t mode) { ...@@ -50,18 +50,19 @@ 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 newName in not empty, rename return fail.
// the newName must be empty or does not exist
//(void)snprintf(shellCmd, 1024, "cp -rf %s %s", srcDir, destDir); if (rename(oldName, newName)) {
(void)snprintf(shellCmd, 1024, "mv %s %s", srcDir, destDir); uError("%s is modify to %s fail, reason:%s", oldName, newName, strerror(errno));
taosSystem(shellCmd); } else {
uInfo("shell cmd:%s is executed", shellCmd); uInfo("%s is modify to %s success!", oldName, newName);
}
} }
#endif #endif
\ No newline at end of file
char version[12] = "2.0.1.1"; char version[12] = "2.0.2.0";
char compatible_version[12] = "2.0.0.0"; char compatible_version[12] = "2.0.0.0";
char gitinfo[48] = "ae1966332948147bacce3d32f9ad539ab8721db2"; char gitinfo[48] = "d711657139620f6c50f362597020705b8ad26bd2";
char gitinfoOfInternal[48] = "bf53767db56cedb1c484df83a1f10536f12647ad"; char gitinfoOfInternal[48] = "1d74ae24c541ffbb280e8630883c0236cd45f8c7";
char buildinfo[64] = "Built by root at 2020-08-20 15:46"; char buildinfo[64] = "Built by root at 2020-08-24 16:31";
void libtaos_2_0_1_1_Linux_x64() {}; void libtaos_2_0_2_0_Linux_x64_beta() {};
...@@ -358,9 +358,11 @@ void vnodeRelease(void *pVnodeRaw) { ...@@ -358,9 +358,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);
dnodeSendStatusMsgToMnode(); dnodeSendStatusMsgToMnode();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册