增加HTTP Post上传配置接口,支持主从双机备份与同步(冷备)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#define MESA_RUNTIME_LOGV4(handle, lv, fmt, args...) \
|
||||
MESA_handle_runtime_log((handle), (lv), "DorisServer", "%s:%d, " fmt, __FILENAME__, __LINE__, ##args)
|
||||
|
||||
static int scandir_md5_final_string(MD5_CTX *c, char *result, unsigned int size)
|
||||
int scandir_md5_final_string(MD5_CTX *c, char *result, unsigned int size)
|
||||
{
|
||||
unsigned char md5[17]={0};
|
||||
int i;
|
||||
@@ -202,12 +202,12 @@ int cm_read_cfg_index_file(const char* path, struct cfg_table_info* idx/*OUT*/,
|
||||
memset(line, 0, sizeof(line));
|
||||
fgets(line, sizeof(line), fp);
|
||||
ret=sscanf(line,"%[^ \t]%*[ \t]%d%*[ \t]%s%*[ \t]%s", idx[i].table_name, &(idx[i].cfg_num), idx[i].cfg_path, idx[i].user_region);
|
||||
if((ret!=3 && ret!=4) || idx[i].cfg_num==0)//jump over empty line
|
||||
if((ret!=3 && ret!=4))//jump over empty line
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ret=stat(idx[i].cfg_path, &file_info);
|
||||
if(ret!=0)
|
||||
if(ret!=0 || file_info.st_size==0) //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>·<EFBFBD>
|
||||
{
|
||||
MESA_RUNTIME_LOGV4(logger,RLOG_LV_FATAL, "%s of %s not exisit", idx[i].cfg_path, path);
|
||||
fclose(fp);
|
||||
@@ -315,12 +315,14 @@ enum DORIS_UPDATE_TYPE doris_index_file_traverse(struct doris_idxfile_scanner *s
|
||||
{
|
||||
MESA_RUNTIME_LOGV4(logger, RLOG_LV_INFO, "load %s", idx_path_array[i].path);
|
||||
table_num=cm_read_cfg_index_file(idx_path_array[i].path, table_array, CM_MAX_TABLE_NUM, logger);
|
||||
if(table_num<0)
|
||||
if(table_num<=0)
|
||||
{
|
||||
MESA_RUNTIME_LOGV4(logger,RLOG_LV_FATAL, "load %s faild, abandon udpate.", idx_path_array[i].path);
|
||||
MESA_RUNTIME_LOGV4(logger,RLOG_LV_FATAL, "\033[1;31;40mAlert! Load %s failed, skip this wrong version!!!!\033[0m\n", idx_path_array[i].path);
|
||||
update_type = CFG_UPDATE_TYPE_ERR;
|
||||
scanner->cur_version = idx_path_array[i].version; //<2F><><EFBFBD><EFBFBD><EFBFBD>İ汾<C4B0><E6B1BE><EFBFBD><EFBFBD>
|
||||
break;
|
||||
}
|
||||
scanner->cur_version = idx_path_array[i].version;
|
||||
|
||||
cJSON *meta = doris_index_version_start(idx_path_array[i].version, table_array, table_num, update_type, doris_cbs);
|
||||
for(j=0; j<table_num && update_rslt; j++)
|
||||
@@ -329,7 +331,6 @@ enum DORIS_UPDATE_TYPE doris_index_file_traverse(struct doris_idxfile_scanner *s
|
||||
}
|
||||
if(update_rslt)
|
||||
{
|
||||
scanner->cur_version = idx_path_array[i].version;
|
||||
doris_cbs->version_finish(NULL, doris_cbs->userdata);
|
||||
}
|
||||
else
|
||||
@@ -337,6 +338,7 @@ enum DORIS_UPDATE_TYPE doris_index_file_traverse(struct doris_idxfile_scanner *s
|
||||
update_type = CFG_UPDATE_TYPE_ERR;
|
||||
doris_cbs->version_error(NULL, doris_cbs->userdata);
|
||||
cJSON_Delete(meta);
|
||||
MESA_RUNTIME_LOGV4(logger,RLOG_LV_FATAL, "\033[1;31;40mAlert! Load %s failed, skip this wrong version!!!!\033[0m\n", idx_path_array[i].path);
|
||||
break;
|
||||
}
|
||||
cJSON_Delete(meta);
|
||||
|
||||
Reference in New Issue
Block a user