From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DD2474696C3 for ; Sat, 11 Apr 2020 19:05:03 +0300 (MSK) References: <9DB87F34-3674-4316-BA19-8DA801F4BBE9@tarantool.org> From: Vladislav Shpilevoy Message-ID: <20e2a591-7569-a023-959b-12314e473d5e@tarantool.org> Date: Sat, 11 Apr 2020 18:05:02 +0200 MIME-Version: 1.0 In-Reply-To: <9DB87F34-3674-4316-BA19-8DA801F4BBE9@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v6 1/3] replication: omit 0-th vclock component in replication responses List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the fixes! Consider more below and on the branch in a separate commit. ==================== diff --git a/src/box/xrow.c b/src/box/xrow.c index b22390a14..70aeb6a3c 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -74,7 +74,7 @@ mp_encode_vclock_ignore0(char *data, const struct vclock *vclock) } static int -mp_decode_vclock_ignore_0(const char **data, struct vclock *vclock) +mp_decode_vclock_ignore0(const char **data, struct vclock *vclock) { vclock_create(vclock); if (mp_typeof(**data) != MP_MAP) @@ -86,16 +86,12 @@ mp_decode_vclock_ignore_0(const char **data, struct vclock *vclock) uint32_t id = mp_decode_uint(data); if (mp_typeof(**data) != MP_UINT) return -1; + int64_t lsn = mp_decode_uint(data); /* * Skip vclock[0] coming from the remote * instances. */ - if (id == 0) { - mp_next(data); - continue; - } - int64_t lsn = mp_decode_uint(data); - if (lsn > 0) + if (lsn > 0 && id != 0) vclock_follow(vclock, id, lsn); } return 0; @@ -1254,13 +1250,13 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) ballot->is_loading = mp_decode_bool(&data); break; case IPROTO_BALLOT_VCLOCK: - if (mp_decode_vclock_ignore_0(&data, - &ballot->vclock) != 0) + if (mp_decode_vclock_ignore0(&data, + &ballot->vclock) != 0) goto err; break; case IPROTO_BALLOT_GC_VCLOCK: - if (mp_decode_vclock_ignore_0(&data, - &ballot->gc_vclock) != 0) + if (mp_decode_vclock_ignore0(&data, + &ballot->gc_vclock) != 0) goto err; break; default: @@ -1405,7 +1401,7 @@ xrow_decode_subscribe(struct xrow_header *row, struct tt_uuid *replicaset_uuid, case IPROTO_VCLOCK: if (vclock == NULL) goto skip; - if (mp_decode_vclock_ignore_0(&d, vclock) != 0) { + if (mp_decode_vclock_ignore0(&d, vclock) != 0) { xrow_on_decode_err(data, end, ER_INVALID_MSGPACK, "invalid VCLOCK"); return -1;