fix:add windows support

This commit is contained in:
wangmm0220 2023-11-03 16:33:48 +08:00
parent 5bd0745a76
commit 7a39b32961
2 changed files with 12 additions and 7 deletions

View File

@ -135,7 +135,11 @@ char tsSmlAutoChildTableNameDelimiter[TSDB_TABLE_NAME_LEN] = "";
// checkpoint backup
char tsSnodeIp[TSDB_FQDN_LEN] = {0};
#ifdef WINDOWS
char tsCheckpointBackupDir[PATH_MAX] = "/c/TDengine/data/backup/checkpoint/";
#else
char tsCheckpointBackupDir[PATH_MAX] = "/var/lib/taos/backup/checkpoint/";
#endif
// tmq
int32_t tmqMaxTopicNum = 20;

View File

@ -47,8 +47,10 @@ static int generateConfigFile(char* confDir){
char confContent[PATH_MAX*4] = {0};
snprintf(confContent, PATH_MAX*4,
#ifndef WINDOWS
"uid = root\n"
"gid = root\n"
#endif
"use chroot = false\n"
"max connections = 200\n"
"timeout = 100\n"
@ -84,7 +86,12 @@ static int execCommand(char* command){
}
void stopRsync(){
int code = system("pkill rsync");
int code =
#ifdef WINDOWS
system("taskkill /f /mi rsync.exe");
#else
system("pkill rsync");
#endif
if(code != 0){
uError("[rsync] stop rsync server failed,"ERRNO_ERR_FORMAT, ERRNO_ERR_DATA);
return;
@ -120,12 +127,6 @@ void startRsync(){
int uploadRsync(char* id, char* path){
char command[PATH_MAX] = {0};
// char* name = strrchr(fullName, '/');
// if(name == NULL){
// uError("[rsync] file name invalid, name:%s", name);
// return -1;
// }
// name = name + 1;
if(path[strlen(path) - 1] != '/'){
snprintf(command, PATH_MAX, "rsync -av --delete --timeout=10 --bwlimit=100000 %s/ rsync://%s/checkpoint/%s/",
path, tsSnodeIp, id);