diff options
Diffstat (limited to 'src/consumer.c')
| -rw-r--r-- | src/consumer.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/consumer.c b/src/consumer.c index 60a6064..ddf3840 100644 --- a/src/consumer.c +++ b/src/consumer.c @@ -125,7 +125,8 @@ void notify_table_update_end(void* u_para) int consumer_t::consumer_load_profile() { int ret = 0;char buf_dir[MAX_PATH_LENGTH]; - char full_path[MAX_PATH_LENGTH],inc_path[MAX_PATH_LENGTH]; + char full_path[MAX_PATH_LENGTH]={'0'}; + char inc_path[MAX_PATH_LENGTH]={'0'}; unsigned int write_null_index_file; ret = snprintf(buf_dir, MAX_PATH_LENGTH, "%s/%s",common->config_path, COMMON_CONFIG_NAME); @@ -148,18 +149,11 @@ int consumer_t::consumer_load_profile() else { snprintf (tmp_path, MAX_PATH_LENGTH, "%s/tmp/", dest_path); - if(common->pz_type ==0) - { - snprintf (full_path, MAX_PATH_LENGTH, "%s/full/index/", dest_path); - check_file_path(full_path); - snprintf (inc_path, MAX_PATH_LENGTH, "%s/inc/index/", dest_path); - check_file_path(inc_path); - } - else - { - snprintf (full_path, MAX_PATH_LENGTH, "%s/full/", dest_path); - check_file_path(full_path); - } + check_file_path(tmp_path); + snprintf (full_path, MAX_PATH_LENGTH, "%s/full/index/", dest_path); + check_file_path(full_path); + snprintf (inc_path, MAX_PATH_LENGTH, "%s/inc/index/", dest_path); + check_file_path(inc_path); } //MESA_load_profile_int_def(buf_dir, "CONSUMER", "gc_time", &consumer->gc_time, 60*60); @@ -289,7 +283,8 @@ int status_for_register_t::persist_msg2local_file_consumer_service_start() file_status_for_persistence->tmp_file_name, NORMAL_FILE, common->error_logger); - ret = write_file_add_num(file_status_for_persistence->file_fp,0); + if(common->pz_type == PZ_TYPE_DETERMINANT) + ret = write_file_add_num(file_status_for_persistence->file_fp,0); } assert(ret >=0); MESA_HANDLE_RUNTIME_LOG(common->runtime_logger,RLOG_LV_DEBUG,"[PERSISTENT_SERVICE_START]","Start success"); @@ -331,14 +326,14 @@ int status_for_register_t::business_related_manager_service_ing(char * control_l // ret = get_then_remove_user_info(dest_msg_line,file_status_for_manager->user_info); ///dest_msg_line[strlen(dest_msg_line)]='\n'; ret = parse_user_info(file_status_for_manager->user_info,&(common->local_state_for_manager->start_time)); - //INDETERMINANT:get dest_file_name here + //INDETERMINANT:get dest_sample_file_name here if(indeterminant_line_info.is_valid == 1) { - strcpy(file_status_for_persistence->dest_file_name,indeterminant_line_info.file_path); + strcpy(file_status_for_persistence->dest_sample_file_name,indeterminant_line_info.file_path); } else { - memset(file_status_for_persistence->dest_file_name,0,MAX_PATH_LENGTH); + memset(file_status_for_persistence->dest_sample_file_name,0,MAX_PATH_LENGTH); } common->local_state_for_manager->end_time=common::Func::curr_time(); @@ -399,17 +394,17 @@ int status_for_register_t::persist_msg2local_file_consumer_service_ing(char * co MESA_HANDLE_RUNTIME_LOG(common->perf_logger,RLOG_LV_INFO, "[PERSISTENT_SERVICE_ING]", "the file:%s, download from fdfs" ,file_status_for_persistence->dest_file_name); //if dest file name not none download file from fdfs - if(strlen(file_status_for_persistence->dest_file_name) != 0) + if(strlen(file_status_for_persistence->dest_sample_file_name) != 0) { - check_file_path(file_status_for_persistence->dest_file_name);//check the file path - ret = download_file_from_fdfs(local_fdfs_id,file_status_for_persistence->dest_file_name); + check_file_path(file_status_for_persistence->dest_sample_file_name);//check the file path + ret = download_file_from_fdfs(local_fdfs_id,file_status_for_persistence->dest_sample_file_name); //If download failed then Retry once if(ret < 0) { do { sleep(3); - ret = download_file_from_fdfs(local_fdfs_id,file_status_for_persistence->dest_file_name); + ret = download_file_from_fdfs(local_fdfs_id,file_status_for_persistence->dest_sample_file_name); i++; }while((ret<0)&&(i<retry_times)); } @@ -417,14 +412,14 @@ int status_for_register_t::persist_msg2local_file_consumer_service_ing(char * co if(ret < 0) { MESA_HANDLE_RUNTIME_LOG(common->error_logger,RLOG_LV_FATAL, "[PERSISTENT_SERVICE_ING]", "the file:%s, download from fdfs failed" - ,file_status_for_persistence->dest_file_name); + ,file_status_for_persistence->dest_sample_file_name); file_status_for_manager->total_line_num--; break; } else { MESA_HANDLE_RUNTIME_LOG(common->runtime_logger,RLOG_LV_INFO, "[PERSISTENT_SERVICE_ING]", "the file:%s, download from fdfs finish" - ,file_status_for_persistence->dest_file_name); + ,file_status_for_persistence->dest_sample_file_name); } //append index_fp(dest_msg_line) |
