修复zombie_stream计数不准确的bug。

This commit is contained in:
zhengchao
2017-09-21 10:23:04 +08:00
parent b3d1e45c34
commit 575c657434
3 changed files with 10 additions and 14 deletions

View File

@@ -1472,29 +1472,20 @@ void Maat_stream_scan_string_end(stream_para_t* stream_para)
struct _Maat_scanner_t* scanner=sp->feather->scanner; struct _Maat_scanner_t* scanner=sp->feather->scanner;
struct _Maat_table_info_t * p_table=sp->feather->p_table_info[sp->table_id]; struct _Maat_table_info_t * p_table=sp->feather->p_table_info[sp->table_id];
aligment_int64_array_add(p_table->stream_num,sp->thread_num,-1); aligment_int64_array_add(p_table->stream_num,sp->thread_num,-1);
if(scanner!=NULL)
{
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) if(sp->rs_stream_para!=NULL)
{
if(scanner!=NULL&&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); rulescan_endstream_simple(sp->rs_stream_para);
sp->feather->zombie_rs_stream--; sp->feather->zombie_rs_stream--;
sp->rs_stream_para=NULL;
} }
sp->rs_stream_para=NULL;
} }
if(sp->last_cache!=NULL) if(sp->last_cache!=NULL)
{ {

View File

@@ -1410,9 +1410,13 @@ int Maat_cmd_commit(Maat_feather_t feather)
if(transection_success<serial_rule_num) if(transection_success<serial_rule_num)
{ {
retry++; retry++;
assert(retry<5);
} }
} }
if(retry>5)
{
MESA_handle_runtime_log(_feather->logger,RLOG_LV_INFO,maat_command
,"MAAT retry for %d times.", retry);
}
_feather->cmd_acc_num+=_feather->cmd_q_cnt; _feather->cmd_acc_num+=_feather->cmd_q_cnt;
error_out: error_out:
p=_feather->cmd_qhead; p=_feather->cmd_qhead;

View File

@@ -30,7 +30,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_20170918=1; int MAAT_FRAME_VERSION_2_0_20170920=1;
const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin",
"unicode_ascii_esc","unicode_ascii_aligned","unicode_ncr_dec","unicode_ncr_hex","url_encode_gb2312","url_encode_utf8",""}; "unicode_ascii_esc","unicode_ascii_aligned","unicode_ncr_dec","unicode_ncr_hex","url_encode_gb2312","url_encode_utf8",""};
@@ -1316,6 +1316,7 @@ void rulescan_batch_update(rule_scanner_t rs_handle,MESA_lqueue_head expr_queue,
} }
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_module , MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_module ,
"rulescan_update error,when batch update %ld rules,regex error %u.",q_cnt,failed_ids[0]); "rulescan_update error,when batch update %ld rules,regex error %u.",q_cnt,failed_ids[0]);
assert(0);
} }
update_interval=(end.tv_sec-start.tv_sec)*1000000000+end.tv_nsec-start.tv_nsec; update_interval=(end.tv_sec-start.tv_sec)*1000000000+end.tv_nsec-start.tv_nsec;
MESA_handle_runtime_log(logger,RLOG_LV_INFO,maat_module , MESA_handle_runtime_log(logger,RLOG_LV_INFO,maat_module ,