diff --git a/src/entry/Maat_api.cpp b/src/entry/Maat_api.cpp index 86760c0..6045274 100644 --- a/src/entry/Maat_api.cpp +++ b/src/entry/Maat_api.cpp @@ -452,6 +452,8 @@ Maat_feather_t Maat_feather(int max_thread_num,const char* table_info_path,void* feather->outer_mid_cnt=aligment_int64_array_alloc(max_thread_num); feather->inner_mid_cnt=aligment_int64_array_alloc(max_thread_num); feather->hit_cnt=aligment_int64_array_alloc(max_thread_num); + feather->maat_version=0; + feather->last_full_version=0; return feather; } int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const void* value,int size) @@ -561,6 +563,7 @@ int Maat_initiate_feather(Maat_feather_t feather) if(_feather->scanner!=NULL) { _feather->maat_version=_feather->scanner->version; + _feather->last_full_version=_feather->scanner->version; } if(strlen(_feather->stat_file)==0) { @@ -1075,6 +1078,7 @@ stream_para_t Maat_stream_scan_string_start(Maat_feather_t feather,int table_id, sp->feather=_feather; sp->version=_feather->maat_version; sp->acc_scan_len=0; + sp->rs_stream_para=NULL; if(scanner==NULL) { return sp; @@ -1294,18 +1298,27 @@ void Maat_stream_scan_string_end(stream_para_t* stream_para) aligment_int64_array_add(p_table->stream_num,sp->thread_num,-1); if(scanner!=NULL) { - if(sp->version==sp->feather->maat_version) + if(sp->version>=sp->feather->last_full_version) { DEC_SCANNER_REF(scanner, sp->thread_num); rulescan_endstream(sp->rs_stream_para); - + } else { rulescan_endstream_simple(sp->rs_stream_para); sp->feather->zombie_rs_stream--; } - + sp->rs_stream_para=NULL; + } + else + { + if(sp->rs_stream_para!=NULL) + { + rulescan_endstream_simple(sp->rs_stream_para); + sp->feather->zombie_rs_stream--; + sp->rs_stream_para=NULL; + } } if(sp->last_cache!=NULL) { diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index da2c0f9..14d9072 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -26,7 +26,7 @@ #include "mesa_fuzzy.h" #include "great_index_engine.h" -int MAAT_FRAME_VERSION_1_8_20161021_zombie_stream=1; +int MAAT_FRAME_VERSION_1_8_20161025_zombie_stream=1; const char *maat_module="MAAT Frame"; const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", @@ -2799,6 +2799,7 @@ void *thread_rule_monitor(void *arg) } feather->update_tmp_scanner=NULL; feather->maat_version=feather->scanner->version; + feather->last_full_version=feather->scanner->version; } if(feather->scanner!=NULL) { diff --git a/src/entry/Maat_rule_internal.h b/src/entry/Maat_rule_internal.h index ad4031a..ac2246a 100644 --- a/src/entry/Maat_rule_internal.h +++ b/src/entry/Maat_rule_internal.h @@ -346,6 +346,7 @@ struct _Maat_feather_t MESA_htable_handle map_tablename2id; void* logger; int maat_version; + int last_full_version; int scan_thread_num; int rule_scan_type; char inc_dir[MAX_TABLE_NAME_LEN];