完善Redis错误处理。

This commit is contained in:
zhengchao
2018-02-27 19:31:19 +08:00
parent 93cb64e46f
commit 91a46e45bc
2 changed files with 9 additions and 2 deletions

View File

@@ -582,7 +582,14 @@ int _get_maat_redis_value(redisContext *c,struct serial_rule_t* rule_list,int ru
,rule_list[idx].table_name
,rule_list[idx].rule_id);
reply=_wrap_redisCommand(c, redis_cmd);
assert(reply->type==REDIS_REPLY_STRING);
if(reply->type!=REDIS_REPLY_STRING)//Handle: "Loading Redis is loading the database in memory" or "nil"
{
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_redis_monitor
,"Redis cmd=%s Error, Reply type=%d, str=%s",redis_cmd, reply->type, reply->str);
freeReplyObject(reply);
free(retry_ids);
return -1;
}
rule_list[idx].table_line=_maat_strdup(reply->str);
freeReplyObject(reply);
}

View File

@@ -30,7 +30,7 @@
#include "stream_fuzzy_hash.h"
#include "gram_index_engine.h"
int MAAT_FRAME_VERSION_2_1_20180226=1;
int MAAT_FRAME_VERSION_2_1_20180227=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",""};