fix(util): idle 500ms after kill rsync
This commit is contained in:
parent
923eaaa569
commit
5cbd733cab
|
@ -114,20 +114,24 @@ static int32_t execCommand(char* command){
|
||||||
void stopRsync() {
|
void stopRsync() {
|
||||||
int32_t code =
|
int32_t code =
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
system("taskkill /f /im rsync.exe");
|
system("taskkill /f /im rsync.exe");
|
||||||
#else
|
#else
|
||||||
system("pkill rsync");
|
system("pkill rsync");
|
||||||
#endif
|
#endif
|
||||||
if(code != 0){
|
|
||||||
uError("[rsync] stop rsync server failed,"ERRNO_ERR_FORMAT, ERRNO_ERR_DATA);
|
if (code != 0) {
|
||||||
return;
|
uError("[rsync] stop rsync server failed," ERRNO_ERR_FORMAT, ERRNO_ERR_DATA);
|
||||||
|
} else {
|
||||||
|
uDebug("[rsync] stop rsync server successful");
|
||||||
}
|
}
|
||||||
uDebug("[rsync] stop rsync server successful");
|
|
||||||
|
taosMsleep(500); // sleep 500 ms to wait for the completion of kill operation.
|
||||||
}
|
}
|
||||||
|
|
||||||
void startRsync() {
|
void startRsync() {
|
||||||
if(taosMulMkDir(tsCheckpointBackupDir) != 0){
|
if (taosMulMkDir(tsCheckpointBackupDir) != 0) {
|
||||||
uError("[rsync] build checkpoint backup dir failed, dir:%s,"ERRNO_ERR_FORMAT, tsCheckpointBackupDir, ERRNO_ERR_DATA);
|
uError("[rsync] build checkpoint backup dir failed, path:%s," ERRNO_ERR_FORMAT, tsCheckpointBackupDir,
|
||||||
|
ERRNO_ERR_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +141,7 @@ void startRsync() {
|
||||||
snprintf(confDir, PATH_MAX, "%srsync.conf", tsCheckpointBackupDir);
|
snprintf(confDir, PATH_MAX, "%srsync.conf", tsCheckpointBackupDir);
|
||||||
|
|
||||||
int32_t code = generateConfigFile(confDir);
|
int32_t code = generateConfigFile(confDir);
|
||||||
if(code != 0){
|
if (code != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,12 +149,12 @@ void startRsync() {
|
||||||
snprintf(cmd, PATH_MAX, "rsync --daemon --port=%d --config=%s", tsRsyncPort, confDir);
|
snprintf(cmd, PATH_MAX, "rsync --daemon --port=%d --config=%s", tsRsyncPort, confDir);
|
||||||
// start rsync service to backup checkpoint
|
// start rsync service to backup checkpoint
|
||||||
code = system(cmd);
|
code = system(cmd);
|
||||||
if(code != 0){
|
if (code != 0) {
|
||||||
uError("[rsync] start server failed, code:%d,"ERRNO_ERR_FORMAT, code, ERRNO_ERR_DATA);
|
uError("[rsync] start server failed, code:%d," ERRNO_ERR_FORMAT, code, ERRNO_ERR_DATA);
|
||||||
return;
|
} else {
|
||||||
|
uDebug("[rsync] start server successful");
|
||||||
}
|
}
|
||||||
|
|
||||||
uDebug("[rsync] start server successful");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t uploadByRsync(const char* id, const char* path) {
|
int32_t uploadByRsync(const char* id, const char* path) {
|
||||||
|
|
Loading…
Reference in New Issue