IRIS配置文件模式下,在读取表文件第一行时发现不在tableinfo里时,不进行后继行的加载,仅报错一次,加快启动速度。

This commit is contained in:
zhengchao
2017-08-09 18:27:08 +08:00
parent ba595da027
commit 37972b3552
5 changed files with 16 additions and 11 deletions

View File

@@ -838,7 +838,7 @@ void check_maat_expiration(redisContext *ctx, void *logger)
} }
void redis_monitor_traverse(unsigned int version,redisContext *c, void redis_monitor_traverse(unsigned int version,redisContext *c,
void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para
void (*update)(const char* ,const char*,void* ),//table name ,line ,u_para int (*update)(const char* ,const char*,void* ),//table name ,line ,u_para
void (*finish)(void*),//u_para void (*finish)(void*),//u_para
void* u_para, void* u_para,
const unsigned char* dec_key, const unsigned char* dec_key,

View File

@@ -28,7 +28,7 @@
#include "stream_fuzzy_hash.h" #include "stream_fuzzy_hash.h"
#include "gram_index_engine.h" #include "gram_index_engine.h"
int MAAT_FRAME_VERSION_2_0_20170807=1; int MAAT_FRAME_VERSION_2_0_20170809=1;
const char *maat_module="MAAT Frame"; const char *maat_module="MAAT Frame";
const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin",
@@ -3077,7 +3077,7 @@ void maat_finish_cb(void* u_para)
} }
return; return;
} }
void maat_update_cb(const char* table_name,const char* line,void *u_para) int maat_update_cb(const char* table_name,const char* line,void *u_para)
{ {
struct _Maat_feather_t *feather=(struct _Maat_feather_t *)u_para; struct _Maat_feather_t *feather=(struct _Maat_feather_t *)u_para;
int ret=-1,i=0; int ret=-1,i=0;
@@ -3096,7 +3096,7 @@ void maat_update_cb(const char* table_name,const char* line,void *u_para)
if(ret<0) if(ret<0)
{ {
MESA_handle_runtime_log(feather->logger,RLOG_LV_INFO,maat_module ,"update warning,unknown table name %s",table_name); MESA_handle_runtime_log(feather->logger,RLOG_LV_INFO,maat_module ,"update warning,unknown table name %s",table_name);
return; return -1;
} }
p_table=feather->p_table_info[table_id]; p_table=feather->p_table_info[table_id];
for(i=0;i<p_table->conj_cnt;i++) for(i=0;i<p_table->conj_cnt;i++)
@@ -3136,7 +3136,7 @@ void maat_update_cb(const char* table_name,const char* line,void *u_para)
break; break;
} }
return; return 0;
} }
void *thread_rule_monitor(void *arg) void *thread_rule_monitor(void *arg)
{ {

View File

@@ -431,7 +431,7 @@ void garbage_bury(MESA_lqueue_head garbage_q,void *logger);
void make_group_set(const struct _Maat_compile_inner_t* compile_rule,universal_bool_expr_t* a_set); void make_group_set(const struct _Maat_compile_inner_t* compile_rule,universal_bool_expr_t* a_set);
int read_table_info(struct _Maat_table_info_t** p_table_info,int num,const char* table_info_path,int max_thread_num,void* logger); int read_table_info(struct _Maat_table_info_t** p_table_info,int num,const char* table_info_path,int max_thread_num,void* logger);
void maat_start_cb(unsigned int new_version,int update_type,void*u_para); void maat_start_cb(unsigned int new_version,int update_type,void*u_para);
void maat_update_cb(const char* table_name,const char* line,void *u_para); int maat_update_cb(const char* table_name,const char* line,void *u_para);
void maat_finish_cb(void* u_para); void maat_finish_cb(void* u_para);
void *thread_rule_monitor(void *arg); void *thread_rule_monitor(void *arg);
unsigned int make_sub_type(unsigned short table_id,enum MAAT_CHARSET charset,int do_charset_merge); unsigned int make_sub_type(unsigned short table_id,enum MAAT_CHARSET charset,int do_charset_merge);
@@ -454,7 +454,7 @@ char* _maat_strdup(const char* s);
char* str_unescape(char* s); char* str_unescape(char* s);
void redis_monitor_traverse(unsigned int version,redisContext *c, void redis_monitor_traverse(unsigned int version,redisContext *c,
void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para
void (*update)(const char* ,const char*,void* ),//table name ,line ,u_para int (*update)(const char* ,const char*,void* ),//table name ,line ,u_para
void (*finish)(void*),//u_para void (*finish)(void*),//u_para
void* u_para, void* u_para,
const unsigned char* dec_key, const unsigned char* dec_key,

View File

@@ -347,12 +347,13 @@ int cm_read_cfg_index_file(const char* path,struct cm_table_info_t* idx,int size
} }
int cm_read_table_file(struct cm_table_info_t* index, int cm_read_table_file(struct cm_table_info_t* index,
void (*update)(const char*,const char*,void*), int (*update)(const char*,const char*,void*),
void* u_para, void* u_para,
const unsigned char* key, const unsigned char* key,
void* logger) void* logger)
{ {
int cfg_num=0,i=0; int cfg_num=0,i=0;
int ret=0;
char line[MAX_CONFIG_LINE]={0},*ret_str=NULL; char line[MAX_CONFIG_LINE]={0},*ret_str=NULL;
unsigned char* decrypt_buff=NULL; unsigned char* decrypt_buff=NULL;
int decrypt_len=0,do_decrypt=0,decrypt_offset=0; int decrypt_len=0,do_decrypt=0,decrypt_offset=0;
@@ -414,7 +415,11 @@ int cm_read_table_file(struct cm_table_info_t* index,
sizeof(line),index->cfg_path,i); sizeof(line),index->cfg_path,i);
continue; continue;
} }
update(index->table_name,line,u_para); ret=update(index->table_name,line,u_para);
if(ret<0)
{
break;
}
} }
fclose(fp); fclose(fp);
if(decrypt_buff!=NULL) if(decrypt_buff!=NULL)
@@ -437,7 +442,7 @@ const char* path2filename(const char*path)
} }
void config_monitor_traverse(unsigned int version,const char*idx_dir, void config_monitor_traverse(unsigned int version,const char*idx_dir,
void (*start)(unsigned int ,int ,void*), void (*start)(unsigned int ,int ,void*),
void (*update)(const char* ,const char*,void* ), int (*update)(const char* ,const char*,void* ),
void (*finish)(void*), void (*finish)(void*),
void* u_para, void* u_para,
const unsigned char* dec_key, const unsigned char* dec_key,

View File

@@ -6,7 +6,7 @@
void config_monitor_traverse(unsigned int version,const char*idx_dir, void config_monitor_traverse(unsigned int version,const char*idx_dir,
void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para void (*start)(unsigned int ,int ,void*),//vesion,CM_UPDATE_TYPE_*,u_para
void (*update)(const char* ,const char*,void* ),//table name ,line ,u_para int (*update)(const char* ,const char*,void* ),//table name ,line ,u_para
void (*finish)(void*),//u_para void (*finish)(void*),//u_para
void* u_para, void* u_para,
const unsigned char* dec_key, const unsigned char* dec_key,