diff options
| author | 郑超 <[email protected]> | 2018-11-23 16:13:07 +0800 |
|---|---|---|
| committer | 郑超 <[email protected]> | 2018-11-23 16:13:07 +0800 |
| commit | eddc68eaf099465a97a077ec954ab75fe058bead (patch) | |
| tree | 6d8bc3595bd979e9f52c83d613a2dad59d5bc983 | |
| parent | d02add1a2f29e7893922bf9eebc96baf200399c2 (diff) | |
| parent | d2f78657dd611f11abd45ca6b2c7e6ed043e5ca3 (diff) | |
Merge branch 'trival-allow-renew-no-timeout-rule' into 'master'v2.4.2
Trival allow renew no timeout rule
See merge request MESA_framework/maat!14
| -rw-r--r-- | src/entry/Maat_command.cpp | 6 | ||||
| -rw-r--r-- | src/entry/Maat_rule.cpp | 4 | ||||
| -rw-r--r-- | src/inc_internal/Maat_rule_internal.h | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/entry/Maat_command.cpp b/src/entry/Maat_command.cpp index a88ad66..0827b9d 100644 --- a/src/entry/Maat_command.cpp +++ b/src/entry/Maat_command.cpp @@ -1181,8 +1181,7 @@ void _exec_serial_rule(redisContext* ctx, long long version, struct serial_rule_ continue;
}
//s_rule[i].timeout>0 was checked by caller.
- //XX: Only update elements that already exist. Never add elements.
- redisAppendCommand(ctx,"ZADD %s XX %lld %s,%d",rm_expire_sset
+ redisAppendCommand(ctx,"ZADD %s %lld %s,%d",rm_expire_sset
,s_rule[i].timeout
,s_rule[i].table_name
,s_rule[i].rule_id);
@@ -2074,12 +2073,11 @@ int Maat_cmd_set_lines(Maat_feather_t feather,const struct Maat_line_t** line_ru set_serial_rule(s_rule+i, op,line_rule[i]->rule_id,line_rule[i]->label_id,line_rule[i]->table_name,line_rule[i]->table_line, absolute_expire_time);
}
success_cnt=exec_serial_rule(_feather->redis_write_ctx,s_rule, line_num,server_time,_feather->logger);
- if(success_cnt<0)//error
+ if(success_cnt<0||success_cnt!=line_num)//error
{
ret=-1;
goto error_out;
}
- assert(success_cnt==line_num);
ret=success_cnt;
_feather->line_cmd_acc_num+=success_cnt;
diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index e847a8a..146fe14 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -32,7 +32,7 @@ #include "stream_fuzzy_hash.h" #include "gram_index_engine.h" -int MAAT_FRAME_VERSION_2_4_20181115=1; +int MAAT_FRAME_VERSION_2_4_20181120=1; 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",""}; @@ -1002,7 +1002,7 @@ void _destroy_compile_rule(struct _Maat_compile_inner_t * compile_rule) free(db_compile_rule); compile_rule->db_c_rule=NULL; } - for(i=0; i<table->ex_data_num; i++) + for(i=0; table!=NULL && i<table->ex_data_num; i++) { rule_ex_data_free(&(db_compile_rule->m_rule_head), db_compile_rule->service_defined, compile_rule->ads+i, table->ex_desc+i); compile_rule->ads[i]=NULL; diff --git a/src/inc_internal/Maat_rule_internal.h b/src/inc_internal/Maat_rule_internal.h index b2afb63..b94273d 100644 --- a/src/inc_internal/Maat_rule_internal.h +++ b/src/inc_internal/Maat_rule_internal.h @@ -46,7 +46,7 @@ typedef int atomic_t; #define MAX_PLUGIN_PER_TABLE 32 #define MAX_FOREIGN_CLMN_NUM 8 #define MAX_SCANNER_HIT_NUM 64 -#define MAX_COMPILE_EX_DATA_NUM 8 +#define MAX_COMPILE_EX_DATA_NUM 2 #define MAX_GROUP_CACHE 128 #define MAX_FAILED_NUM 128 |
