修复lua中,历史版本号有续集写入参数反了的bug。

This commit is contained in:
zhengchao
2019-02-22 11:20:34 +06:00
parent ffb11b845d
commit 31e2cacd7b
4 changed files with 19 additions and 15 deletions

View File

@@ -1342,6 +1342,11 @@ int Maat_full_scan_string_detail(Maat_feather_t feather,int table_id
{ {
return 0; return 0;
} }
my_scanner=_feather->scanner;
if(my_scanner==NULL)
{
return 0;
}
if(_feather->perf_on==1) if(_feather->perf_on==1)
{ {
clock_gettime(CLOCK_MONOTONIC,&start); clock_gettime(CLOCK_MONOTONIC,&start);
@@ -1372,11 +1377,7 @@ int Maat_full_scan_string_detail(Maat_feather_t feather,int table_id
scan_data.text_data.text=data; scan_data.text_data.text=data;
scan_data.text_data.tlen=data_len; scan_data.text_data.tlen=data_len;
scan_data.text_data.toffset=0; scan_data.text_data.toffset=0;
my_scanner=_feather->scanner;
if(my_scanner==NULL)
{
return 0;
}
struct Maat_table_runtime* table_rt=my_scanner->table_rt[table_id]; struct Maat_table_runtime* table_rt=my_scanner->table_rt[table_id];
if(table_rt->origin_rule_num==0) if(table_rt->origin_rule_num==0)
{ {

View File

@@ -1056,7 +1056,7 @@ int mr_operation_success(redisReply* actual_reply, struct expected_reply* expect
} }
long long _exec_serial_rule_begin(redisContext* ctx,int rule_num, int renew_rule_num,int *renew_allowed, long long *maat_redis_version) long long _exec_serial_rule_begin(redisContext* ctx,int rule_num, int renew_rule_num,int *renew_allowed, long long *transaction_version)
{ {
int ret=-1; int ret=-1;
redisReply* data_reply=NULL; redisReply* data_reply=NULL;
@@ -1071,9 +1071,9 @@ long long _exec_serial_rule_begin(redisContext* ctx,int rule_num, int renew_rule
if(rule_num>renew_rule_num) if(rule_num>renew_rule_num)
{ {
data_reply=_wrap_redisCommand(ctx, "INCRBY MAAT_PRE_VER 1"); data_reply=_wrap_redisCommand(ctx, "INCRBY MAAT_PRE_VER 1");
*maat_redis_version=read_redis_integer(data_reply); *transaction_version=read_redis_integer(data_reply);
freeReplyObject(data_reply); freeReplyObject(data_reply);
if(*maat_redis_version<0) if(*transaction_version<0)
{ {
return -1; return -1;
} }
@@ -1097,7 +1097,7 @@ if(maat_version~=transaction_version) then\
redis.call(\'zadd\', KEYS[2], maat_version, v);\ redis.call(\'zadd\', KEYS[2], maat_version, v);\
end;\ end;\
end;\ end;\
redis.call(\'zadd\', KEYS[3], maat_version, ARGV[2]);\ redis.call(\'zadd\', KEYS[3], ARGV[2], maat_version);\
return maat_version;\ return maat_version;\
"; ";
redisReply* _exec_serial_rule_end(redisContext* ctx,long long maat_redis_version, long long server_time, int renew_allowed, struct expected_reply* expect_reply, unsigned int *cnt) redisReply* _exec_serial_rule_end(redisContext* ctx,long long maat_redis_version, long long server_time, int renew_allowed, struct expected_reply* expect_reply, unsigned int *cnt)
@@ -1323,11 +1323,13 @@ int exec_serial_rule(redisContext* ctx,struct serial_rule_t* s_rule, unsigned in
if(transaction_version>0) if(transaction_version>0)
{ {
transaction_finished_version=read_redis_integer(transaction_reply->element[multi_cmd_cnt-1]); transaction_finished_version=read_redis_integer(transaction_reply->element[multi_cmd_cnt-1]);
MESA_handle_runtime_log(logger, RLOG_LV_INFO, maat_command, if(transaction_finished_version!=transaction_version)
"Redis transaction version: %lld, transaction finished version: %lld, status: %s", {
MESA_handle_runtime_log(logger, RLOG_LV_INFO, maat_command,
"Race condition of redis transaction (MAAT_PRE_VER != MAAT_VERSION) : %lld != %lld , need manually intervention when occurrent frequently.",
transaction_version, transaction_version,
transaction_finished_version, transaction_finished_version);
transaction_finished_version==transaction_version?"OK":"Weird"); }
} }
freeReplyObject(transaction_reply); freeReplyObject(transaction_reply);

View File

@@ -32,7 +32,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_6_20190221=1; int MAAT_FRAME_VERSION_2_6_20190222=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

@@ -1271,7 +1271,8 @@ protected:
Maat_cmd_flushDB(_shared_feather); Maat_cmd_flushDB(_shared_feather);
Maat_initiate_feather(_shared_feather); Maat_initiate_feather(_shared_feather);
//For simulating race condition.
Maat_cmd_incrby(_shared_feather, "MAAT_PRE_VER", 1);
} }
static void TearDownTestCase() static void TearDownTestCase()
{ {