From 1607e48d774a76b87a9d9d24497fbcb7b8d2ef26 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Fri, 7 Dec 2018 13:52:42 +0600 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=9A=E5=9C=A8command?= =?UTF-8?q?=20renew=E6=97=B6=EF=BC=8C=5Fexec=5Fserial=5Frule=5Fend?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=B0=86redlock=5Funlock=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=9C=A8append=5Fcmd=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/Maat_rule.h | 2 +- src/entry/Maat_command.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/Maat_rule.h b/inc/Maat_rule.h index 0163650..30a25c9 100644 --- a/inc/Maat_rule.h +++ b/inc/Maat_rule.h @@ -6,7 +6,7 @@ * to reside in the heart) of the departed would reach the paradise of afterlife * successfully. * Author: zhengchao@iie.ac.cn, MESA -* Version 2018-11-06 Maat Rule Extra Data. +* Version 2018-12-07 Plugin Extra Data. * NOTE: MUST compile with G++ * All right reserved by Institute of Infomation Engineering,Chinese Academic of Science 2014~2018 ********************************************************* diff --git a/src/entry/Maat_command.cpp b/src/entry/Maat_command.cpp index 6e18752..bb43b09 100644 --- a/src/entry/Maat_command.cpp +++ b/src/entry/Maat_command.cpp @@ -1064,19 +1064,26 @@ long long _exec_serial_rule_begin(redisContext* ctx,int rule_num, int renew_rule } return ret; } -redisReply* _exec_serial_rule_end(redisContext* ctx,long long maat_redis_version, long long server_time, int renew_allowed) +redisReply* _exec_serial_rule_end(redisContext* ctx,long long maat_redis_version, long long server_time, int renew_allowed, struct expected_reply_t* expect_reply, unsigned int *cnt) { redisReply* data_reply=NULL; if(renew_allowed==1) { redlock_unlock(ctx, rm_expire_lock); + expect_reply[*cnt].srule_seq=-1; + (*cnt)++; } if(maat_redis_version>0) { data_reply=_wrap_redisCommand(ctx,"ZADD %s NX %d %d",rm_version_sset,server_time,maat_redis_version); freeReplyObject(data_reply); + expect_reply[*cnt].srule_seq=-1; + (*cnt)++; data_reply=_wrap_redisCommand(ctx,"INCRBY MAAT_VERSION 1"); freeReplyObject(data_reply); + expect_reply[*cnt].srule_seq=-1; + expect_reply[*cnt].reply.type=REDIS_REPLY_INTEGER; + (*cnt)++; } data_reply=_wrap_redisCommand(ctx,"EXEC"); return data_reply; @@ -1247,10 +1254,10 @@ int exec_serial_rule(redisContext* ctx,struct serial_rule_t* s_rule, unsigned in assert(multi_cmd_cntelements-2<=multi_cmd_cnt); + assert(transaction_reply->elements==multi_cmd_cnt); for(i=0;ielement[i];