diff --git a/readme.txt b/readme.txt index ac9419f..6076da0 100644 --- a/readme.txt +++ b/readme.txt @@ -41,5 +41,8 @@ indexfile; 2015-07-06 1)handle wrong expr format like "aa&&bb" and "aa&bb&"; 2)iconv_convert performance optimized; 2015-10-19 check table_type in callback register; +2015-11-09 1)add digest feature; + 2) split some code from Maat_rule.cpp to Maat_api.cpp; 2015-12-24 change plugin table update mechanism to save memory; 2016-01-20 maat_finish_cb adapt empty inc callback on a NULL scanner; +2016-01-31 trigger plugin table's callback ONLY on its table's changed; diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 3fbbf62..f1c3fc6 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -24,7 +24,7 @@ #include "mesa_fuzzy.h" #include "great_index_engine.h" -int MAAT_FRAME_VERSION_1_3_20160120=1; +int MAAT_FRAME_VERSION_1_3_20160131=1; const char *maat_module="MAAT Frame"; const char* CHARSET_STRING[]={"CHARSET_NONE","GBK","BIG5","UNICODE","UTF-8"}; @@ -2124,6 +2124,15 @@ void plugin_table_callback(struct _Maat_table_info_t* table,const char* table_li struct _plugin_table_info* p_table_cb=table->cb_info; char *p=NULL; pthread_mutex_lock(&(p_table_cb->plugin_mutex)); + + if(p_table_cb->is_called_started==0) + { + for(i=0;icb_plug_cnt;i++) + { + p_table_cb->cb_plug[i].start(p_table_cb->update_type,p_table_cb->cb_plug[i].u_para); + } + p_table_cb->is_called_started=1; + } if(p_table_cb->cb_plug_cnt>0) { for(i=0;icb_plug_cnt;i++) @@ -2204,7 +2213,7 @@ void maat_start_cb(unsigned int new_version,int update_type,void*u_para) feather->maat_version,new_version); feather->maat_version=new_version; } - for(i=0;itable_cnt;i++) + for(i=0;ip_table_info[i]; if(p_table==NULL||p_table->table_type!=TABLE_TYPE_PLUGIN) @@ -2212,10 +2221,8 @@ void maat_start_cb(unsigned int new_version,int update_type,void*u_para) continue; } p_table_cb=p_table->cb_info; - for(j=0;jcb_plug_cnt;j++) - { - p_table_cb->cb_plug[j].start(update_type,p_table_cb->cb_plug[j].u_para); - } + p_table_cb->update_type=update_type; + assert(p_table_cb->is_called_started==0); } return; } @@ -2242,10 +2249,17 @@ void maat_finish_cb(void* u_para) continue; } p_table_cb=p_table->cb_info; + if(p_table_cb->is_called_started==0) + { + continue; + } + p_table_cb->is_called_started=0; + pthread_mutex_lock(&(p_table_cb->plugin_mutex)); for(j=0;jcb_plug_cnt;j++) { p_table_cb->cb_plug[j].finish(p_table_cb->cb_plug[j].u_para); } + pthread_mutex_unlock(&(p_table_cb->plugin_mutex)); } if(feather->update_tmp_scanner!=NULL) { diff --git a/src/entry/Maat_rule_internal.h b/src/entry/Maat_rule_internal.h index 0204cec..0c9586e 100644 --- a/src/entry/Maat_rule_internal.h +++ b/src/entry/Maat_rule_internal.h @@ -207,6 +207,8 @@ struct _plugin_table_info struct _callback_plugin cb_plug[MAX_PLUGING_NUM]; dynamic_array_t *cache_lines; int line_num; + int update_type; + int is_called_started; long cache_size; pthread_mutex_t plugin_mutex; };