refactor: do some internal refactor.
This commit is contained in:
parent
11ed1f54b3
commit
370c255128
|
@ -153,16 +153,16 @@ void startRsync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t uploadRsync(const char* id, const char* path) {
|
int32_t uploadRsync(const char* id, const char* path) {
|
||||||
|
int64_t st = taosGetTimestampMs();
|
||||||
|
char command[PATH_MAX] = {0};
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
char pathTransform[PATH_MAX] = {0};
|
char pathTransform[PATH_MAX] = {0};
|
||||||
changeDirFromWindowsToLinux(path, pathTransform);
|
changeDirFromWindowsToLinux(path, pathTransform);
|
||||||
#endif
|
|
||||||
|
|
||||||
char command[PATH_MAX] = {0};
|
if(pathTransform[strlen(pathTransform) - 1] != '/') {
|
||||||
#ifdef WINDOWS
|
|
||||||
if(pathTransform[strlen(pathTransform) - 1] != '/'){
|
|
||||||
#else
|
#else
|
||||||
if(path[strlen(path) - 1] != '/'){
|
if (path[strlen(path) - 1] != '/') {
|
||||||
#endif
|
#endif
|
||||||
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s/ rsync://%s/checkpoint/%s/",
|
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s/ rsync://%s/checkpoint/%s/",
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -178,16 +178,20 @@ int32_t uploadRsync(const char* id, const char* path) {
|
||||||
#else
|
#else
|
||||||
path
|
path
|
||||||
#endif
|
#endif
|
||||||
, tsSnodeAddress, id);
|
,
|
||||||
|
tsSnodeAddress, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = execCommand(command);
|
int32_t code = execCommand(command);
|
||||||
if(code != 0){
|
if (code != 0) {
|
||||||
uError("[rsync] send failed code:%d," ERRNO_ERR_FORMAT, code, ERRNO_ERR_DATA);
|
uError("[rsync] s-task:%s upload checkpoint data in:%s to %s failed, code:%d", id, path, tsSnodeAddress,
|
||||||
|
ERRNO_ERR_FORMAT, code, ERRNO_ERR_DATA);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uDebug("[rsync] upload data:%s successful", id);
|
int64_t el = (taosGetTimestampMs() - st);
|
||||||
|
uDebug("[rsync] s-task:%s upload checkpoint data in:%s to %s successfully, elapsed time:%" PRId64 "ms", id, path,
|
||||||
|
tsSnodeAddress, el);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,8 +368,7 @@ int32_t uploadCheckpointData(void* param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((code = taskDbGenChkpUploadData(pParam->pTask->pBackend, ((SStreamMeta*)pParam->pMeta)->bkdChkptMgt,
|
if ((code = taskDbGenChkpUploadData(pParam->pTask->pBackend, ((SStreamMeta*)pParam->pMeta)->bkdChkptMgt,
|
||||||
pParam->chkpId,
|
pParam->chkpId, (int8_t)(pParam->type), &path, toDelFiles)) != 0) {
|
||||||
(int8_t)(pParam->type), &path, toDelFiles)) != 0) {
|
|
||||||
stError("s-task:%s failed to gen upload checkpoint:%" PRId64, taskStr, pParam->chkpId);
|
stError("s-task:%s failed to gen upload checkpoint:%" PRId64, taskStr, pParam->chkpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue