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,13 +153,13 @@ 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};
#ifdef WINDOWS
if(pathTransform[strlen(pathTransform) - 1] != '/') { if(pathTransform[strlen(pathTransform) - 1] != '/') {
#else #else
if (path[strlen(path) - 1] != '/') { if (path[strlen(path) - 1] != '/') {
@ -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;
} }

View File

@ -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);
} }