fix:add windows support
This commit is contained in:
parent
16f8c1f628
commit
5a6c3f2b04
|
@ -467,7 +467,7 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
int uploadCheckpoint(char* id, char* path){
|
int uploadCheckpoint(char* id, char* path){
|
||||||
if(id == NULL || path == NULL || strlen(id) == 0 || strlen(path) == 0){
|
if(id == NULL || path == NULL || strlen(id) == 0 || strlen(path) == 0 || strlen(path) >= PATH_MAX){
|
||||||
stError("uploadCheckpoint parameters invalid");
|
stError("uploadCheckpoint parameters invalid");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ int uploadCheckpoint(char* id, char* path){
|
||||||
}
|
}
|
||||||
|
|
||||||
int downloadCheckpoint(char* id, char* path){
|
int downloadCheckpoint(char* id, char* path){
|
||||||
if(id == NULL || path == NULL || strlen(id) == 0 || strlen(path) == 0){
|
if(id == NULL || path == NULL || strlen(id) == 0 || strlen(path) == 0 || strlen(path) >= PATH_MAX){
|
||||||
stError("downloadCheckpoint parameters invalid");
|
stError("downloadCheckpoint parameters invalid");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,13 +152,27 @@ void startRsync(){
|
||||||
}
|
}
|
||||||
|
|
||||||
int uploadRsync(char* id, char* path){
|
int uploadRsync(char* id, char* path){
|
||||||
|
#ifdef WINDOWS
|
||||||
|
char pathTransform[PATH_MAX] = {0};
|
||||||
|
changeDirFromWindowsToLinux(path, pathTransform);
|
||||||
|
#endif
|
||||||
char command[PATH_MAX] = {0};
|
char command[PATH_MAX] = {0};
|
||||||
if(path[strlen(path) - 1] != '/'){
|
if(path[strlen(path) - 1] != '/'){
|
||||||
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/",
|
||||||
path, tsSnodeIp, id);
|
#ifdef WINDOWS
|
||||||
|
pathTransform
|
||||||
|
#else
|
||||||
|
path
|
||||||
|
#endif
|
||||||
|
, tsSnodeIp, id);
|
||||||
}else{
|
}else{
|
||||||
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/",
|
||||||
path, tsSnodeIp, id);
|
#ifdef WINDOWS
|
||||||
|
pathTransform
|
||||||
|
#else
|
||||||
|
path
|
||||||
|
#endif
|
||||||
|
, tsSnodeIp, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int code = execCommand(command);
|
int code = execCommand(command);
|
||||||
|
@ -171,9 +185,19 @@ int uploadRsync(char* id, char* path){
|
||||||
}
|
}
|
||||||
|
|
||||||
int downloadRsync(char* id, char* path){
|
int downloadRsync(char* id, char* path){
|
||||||
|
#ifdef WINDOWS
|
||||||
|
char pathTransform[PATH_MAX] = {0};
|
||||||
|
changeDirFromWindowsToLinux(path, pathTransform);
|
||||||
|
#endif
|
||||||
char command[PATH_MAX] = {0};
|
char command[PATH_MAX] = {0};
|
||||||
snprintf(command, PATH_MAX, "rsync -av --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/ %s",
|
snprintf(command, PATH_MAX, "rsync -av --timeout=10 --bwlimit=100000 rsync://%s/checkpoint/%s/ %s",
|
||||||
tsSnodeIp, id, path);
|
tsSnodeIp, id,
|
||||||
|
#ifdef WINDOWS
|
||||||
|
pathTransform
|
||||||
|
#else
|
||||||
|
path
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
int code = execCommand(command);
|
int code = execCommand(command);
|
||||||
if(code != 0){
|
if(code != 0){
|
||||||
|
|
Loading…
Reference in New Issue