diff --git a/inc/Maat_command.h b/inc/Maat_command.h index e457646..202098f 100644 --- a/inc/Maat_command.h +++ b/inc/Maat_command.h @@ -151,5 +151,6 @@ int Maat_cmd_set_lines(Maat_feather_t feather,const struct Maat_line_t** line_ru //If the key does not exist, it is set to 0 before performing the operation. long long Maat_cmd_incrby(Maat_feather_t feather,const char* key, int increment); int Maat_cmd_select(Maat_feather_t feather, int label_id, int * output_ids, unsigned int size); +int Maat_cmd_flushDB(Maat_feather_t feather); #endif diff --git a/src/entry/Maat_command.cpp b/src/entry/Maat_command.cpp index 629a832..040d53f 100644 --- a/src/entry/Maat_command.cpp +++ b/src/entry/Maat_command.cpp @@ -437,7 +437,7 @@ int get_rm_key_list(long long version,redisContext *c,struct serial_rule_t** lis { MESA_handle_runtime_log(logger, RLOG_LV_FATAL, maat_redis_monitor,"Got nothing after ZRANGEBYSCORE %s (%lld %lld, cumulative=%d" ,rm_status_sset,version,target_version-1,!cumulative_off); - return -1; + goto FULL_UPDATE; } tmp_reply=_wrap_redisCommand(c, "ZSCORE %s %s",rm_status_sset,reply->element[0]->str); if(tmp_reply->type!=REDIS_REPLY_STRING) @@ -920,18 +920,19 @@ int _exec_serial_rule(redisContext* ctx,struct serial_rule_t* s_rule,int serial_ int exec_serial_rule(redisContext* ctx,struct serial_rule_t* s_rule,int serial_rule_num, long long server_time, void* logger) { int max_redis_batch=1*1024,batch_cnt=0; - int success_cnt=0,ret=0; - while(success_cntredis_write_ctx==NULL) + { + ret=connect_redis_for_write(_feather); + if(ret!=0) + { + return -1; + } + } + do + { + ret=redis_flush_DB(_feather->redis_write_ctx, _feather->redis_index, _feather->logger); + }while(ret==0); + return 0; +} diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 3b00b70..64a215a 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -30,7 +30,7 @@ #include "stream_fuzzy_hash.h" #include "gram_index_engine.h" -int MAAT_FRAME_VERSION_2_1_20180307=1; +int MAAT_FRAME_VERSION_2_1_20180315=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",""}; diff --git a/test/maat_test.cpp b/test/maat_test.cpp index 775ef42..a2de3ea 100644 --- a/test/maat_test.cpp +++ b/test/maat_test.cpp @@ -1059,6 +1059,7 @@ int main(int argc,char* argv[]) test_command(feather); test_set_cmd_line(feather); test_add_ip_command(feather,"IP_CONFIG"); + Maat_cmd_flushDB(feather); } test_sfh_digest(test_digest_file); sleep(wait_second);