From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 8A1676EC40; Tue, 29 Jun 2021 01:18:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A1676EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624918682; bh=rNszpF3FX/JNi1HNy0iMtdn4q7Hii5/Yf9BV4soMGmo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=l5ehTPop3w46wV5MPP5LN9VRlRCeSMxiNq86BXty0Lw7RMsIOZgWc+ohlIYl4lgSU NOrHAPVp/VH+k+EV2sF2v2SxZ/kkg06E9z/ilRfO+TkxPbbrpNU6zWSoqP4OyfyleJ vLLBkpP67T8eNc/o00ya16MgtA6aiStnpmCnUmXw= Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (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 7ACE66EC63 for ; Tue, 29 Jun 2021 01:13:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7ACE66EC63 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1lxzVJ-0007oC-H6; Tue, 29 Jun 2021 01:13:21 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Tue, 29 Jun 2021 01:12:55 +0300 Message-Id: <6849e373ba1e60b79a3c5c4e4721e0fbea9b7612.1624918078.git.sergepetrenko@tarantool.org> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB0C620705B15DE32DFE392EA95FA71EAB182A05F5380850400FF13836EFD9075D5E8D5121CEE5485925DCA5513560AEA30C8F9B7571B1E00F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE71343958AEA576E5EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637651D61939D0B3DD78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8550363AE68AC2A02FFA7A7EB6F7BD2CC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B60A62CEF541B197C8089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831D7A3F10BEE0A642D5E2DD01FEC9EDF0A X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CD87436A60A035F40BE117AE552EC093537580597CD8221EA9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF92B0BE0DA6BB795D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A1AF43396E40A36FDB9FF42F8AADF377A1E2E2D9A568B4967970B88FF077FAD257C5DAB06EC2D4831D7E09C32AA3244CB0559325A731C07F52008AE393EB17B8CE0B41342B755BCD927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojNjLyMoNI2JbqOA+jxBN0zg== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446C3FEE19542AA4C0ED12753D4DAD943D9131F76E882100269424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v3 09/12] replication: encode version in JOIN request X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The replica's version will be needed once sending limbo and election state snapshot is implemented. Follow-up #6034 @TarantoolBot document New field in JOIN request JOIN request now comes with a new field: replica's version. The field uses IPROTO_SERVER_VERSION key. --- src/box/box.cc | 7 +++++-- src/box/xrow.c | 4 +++- src/box/xrow.h | 25 +++++++++++++++---------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index 86c5967b9..b2c52bc54 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -2522,7 +2522,9 @@ box_process_register(struct ev_io *io, struct xrow_header *header) struct tt_uuid instance_uuid = uuid_nil; struct vclock replica_vclock; - xrow_decode_register_xc(header, &instance_uuid, &replica_vclock); + uint32_t replica_version_id; + xrow_decode_register_xc(header, &instance_uuid, &replica_vclock, + &replica_version_id); if (!is_box_configured) tnt_raise(ClientError, ER_LOADING); @@ -2647,7 +2649,8 @@ box_process_join(struct ev_io *io, struct xrow_header *header) /* Decode JOIN request */ struct tt_uuid instance_uuid = uuid_nil; - xrow_decode_join_xc(header, &instance_uuid); + uint32_t replica_version_id; + xrow_decode_join_xc(header, &instance_uuid, &replica_version_id); /* Check that bootstrap has been finished */ if (!is_box_configured) diff --git a/src/box/xrow.c b/src/box/xrow.c index 16cb2484c..400e0456f 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -1639,10 +1639,12 @@ xrow_encode_join(struct xrow_header *row, const struct tt_uuid *instance_uuid) return -1; } char *data = buf; - data = mp_encode_map(data, 1); + data = mp_encode_map(data, 2); data = mp_encode_uint(data, IPROTO_INSTANCE_UUID); /* Greet the remote replica with our replica UUID */ data = xrow_encode_uuid(data, instance_uuid); + data = mp_encode_uint(data, IPROTO_SERVER_VERSION); + data = mp_encode_uint(data, tarantool_version_id()); assert(data <= buf + size); row->body[0].iov_base = buf; diff --git a/src/box/xrow.h b/src/box/xrow.h index 055fd31e1..0a134d94d 100644 --- a/src/box/xrow.h +++ b/src/box/xrow.h @@ -471,15 +471,17 @@ xrow_encode_join(struct xrow_header *row, const struct tt_uuid *instance_uuid); * Decode JOIN command. * @param row Row to decode. * @param[out] instance_uuid. + * @param[out] version_id. * * @retval 0 Success. * @retval -1 Memory or format error. */ static inline int -xrow_decode_join(struct xrow_header *row, struct tt_uuid *instance_uuid) +xrow_decode_join(struct xrow_header *row, struct tt_uuid *instance_uuid, + uint32_t *version_id) { - return xrow_decode_subscribe(row, NULL, instance_uuid, NULL, NULL, NULL, - NULL); + return xrow_decode_subscribe(row, NULL, instance_uuid, NULL, version_id, + NULL, NULL); } /** @@ -487,15 +489,17 @@ xrow_decode_join(struct xrow_header *row, struct tt_uuid *instance_uuid) * @param row Row to decode. * @param[out] instance_uuid Instance uuid. * @param[out] vclock Instance vclock. + * @param[out] version_id Replica version id. + * * @retval 0 Success. * @retval -1 Memory or format error. */ static inline int xrow_decode_register(struct xrow_header *row, struct tt_uuid *instance_uuid, - struct vclock *vclock) + struct vclock *vclock, uint32_t *version_id) { - return xrow_decode_subscribe(row, NULL, instance_uuid, vclock, NULL, - NULL, NULL); + return xrow_decode_subscribe(row, NULL, instance_uuid, vclock, + version_id, NULL, NULL); } /** @@ -960,18 +964,19 @@ xrow_encode_join_xc(struct xrow_header *row, /** @copydoc xrow_decode_join. */ static inline void -xrow_decode_join_xc(struct xrow_header *row, struct tt_uuid *instance_uuid) +xrow_decode_join_xc(struct xrow_header *row, struct tt_uuid *instance_uuid, + uint32_t *version_id) { - if (xrow_decode_join(row, instance_uuid) != 0) + if (xrow_decode_join(row, instance_uuid, version_id) != 0) diag_raise(); } /** @copydoc xrow_decode_register. */ static inline void xrow_decode_register_xc(struct xrow_header *row, struct tt_uuid *instance_uuid, - struct vclock *vclock) + struct vclock *vclock, uint32_t *version_id) { - if (xrow_decode_register(row, instance_uuid, vclock) != 0) + if (xrow_decode_register(row, instance_uuid, vclock, version_id) != 0) diag_raise(); } -- 2.30.1 (Apple Git-130)