refactor: do some internal refactor.

This commit is contained in:
Haojun Liao 2024-05-11 10:27:55 +08:00
parent 11ed1f54b3
commit 370c255128
2 changed files with 14 additions and 11 deletions

View File

@ -153,16 +153,16 @@ void startRsync() {
}
int32_t uploadRsync(const char* id, const char* path) {
int64_t st = taosGetTimestampMs();
char command[PATH_MAX] = {0};
#ifdef WINDOWS
char pathTransform[PATH_MAX] = {0};
changeDirFromWindowsToLinux(path, pathTransform);
#endif
char command[PATH_MAX] = {0};
#ifdef WINDOWS
if(pathTransform[strlen(pathTransform) - 1] != '/'){
if(pathTransform[strlen(pathTransform) - 1] != '/') {
#else
if(path[strlen(path) - 1] != '/'){
if (path[strlen(path) - 1] != '/') {
#endif
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s/ rsync://%s/checkpoint/%s/",
#ifdef WINDOWS
@ -178,16 +178,20 @@ int32_t uploadRsync(const char* id, const char* path) {
#else
path
#endif
, tsSnodeAddress, id);
,
tsSnodeAddress, id);
}
int32_t code = execCommand(command);
if(code != 0){
uError("[rsync] send failed code:%d," ERRNO_ERR_FORMAT, code, ERRNO_ERR_DATA);
if (code != 0) {
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;
}
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;
}

View File

@ -368,8 +368,7 @@ int32_t uploadCheckpointData(void* param) {
}
if ((code = taskDbGenChkpUploadData(pParam->pTask->pBackend, ((SStreamMeta*)pParam->pMeta)->bkdChkptMgt,
pParam->chkpId,
(int8_t)(pParam->type), &path, toDelFiles)) != 0) {
pParam->chkpId, (int8_t)(pParam->type), &path, toDelFiles)) != 0) {
stError("s-task:%s failed to gen upload checkpoint:%" PRId64, taskStr, pParam->chkpId);
}