修复redis_flush_DB函数中redis append操作,命令计数漏加的bug。

This commit is contained in:
zhengchao
2018-03-16 15:23:58 +08:00
parent 6b2f08fd04
commit 2bd813ffbc
3 changed files with 8 additions and 3 deletions

View File

@@ -1602,6 +1602,7 @@ int redis_flush_DB(redisContext* ctx, int db_index, void* logger)
dbsize=read_redis_integer(data_reply); dbsize=read_redis_integer(data_reply);
freeReplyObject(data_reply); freeReplyObject(data_reply);
data_reply=_wrap_redisCommand(ctx,"MULTI");
redisAppendCommand(ctx,"FLUSHDB"); redisAppendCommand(ctx,"FLUSHDB");
append_cmd_cnt++; append_cmd_cnt++;
@@ -1611,7 +1612,7 @@ int redis_flush_DB(redisContext* ctx, int db_index, void* logger)
append_cmd_cnt++; append_cmd_cnt++;
redisAppendCommand(ctx,"SET SEQUENCE_GROUP 1",maat_redis_version); redisAppendCommand(ctx,"SET SEQUENCE_GROUP 1",maat_redis_version);
append_cmd_cnt++; append_cmd_cnt++;
redisAppendCommand(ctx,"EXEC"); redisAppendCommand(ctx,"EXEC");
append_cmd_cnt++; append_cmd_cnt++;
for(i=0;i<append_cmd_cnt;i++) for(i=0;i<append_cmd_cnt;i++)
{ {

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_1_20180315=1; int MAAT_FRAME_VERSION_2_1_20180316=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",""};

View File

@@ -1059,7 +1059,11 @@ int main(int argc,char* argv[])
test_command(feather); test_command(feather);
test_set_cmd_line(feather); test_set_cmd_line(feather);
test_add_ip_command(feather,"IP_CONFIG"); test_add_ip_command(feather,"IP_CONFIG");
Maat_cmd_flushDB(feather); if(0==Maat_cmd_flushDB(feather))
{
printf("Test empty Redis Success.\n");
}
test_set_cmd_line(feather);
} }
test_sfh_digest(test_digest_file); test_sfh_digest(test_digest_file);
sleep(wait_second); sleep(wait_second);