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 95A916EC55; Thu, 10 Jun 2021 17:02:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 95A916EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623333726; bh=xI+OkJOQB7Qy2KH3yKYiHCQ0dQIrpjKnxu2lsxE8geo=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=afKsE4XOCHWLs9HZ3nLY7RTiFRg0JNsYfi6UiRCaRjCor1NwURSLiGAfAj1cJGYUW Kb+/538LXYYuhphU5O6clIG1Fw8jWjIq2kBztRMU6T2JWy1j+i1PhPIL4X/yJR4oaE NhnbxXBiepC+zJ0/Lvbp4qw1AXMhR5L6xfrigvDs= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 609C26EC55 for ; Thu, 10 Jun 2021 17:02:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 609C26EC55 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1lrLG0-0007Lk-CM; Thu, 10 Jun 2021 17:02:04 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com References: <571f31727582463f25f490c41c095199ea88da3a.1622849790.git.v.shpilevoy@tarantool.org> Message-ID: <3d9994a9-01a1-6fbb-ad7e-5e651189a357@tarantool.org> Date: Thu, 10 Jun 2021 17:02:04 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <571f31727582463f25f490c41c095199ea88da3a.1622849790.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54F4BC37E91F2690B85F43D7652182C513182A05F5380850400034BDED5AB433C2F5E2A3BBAC17C5125AF323842B14264A2CB25B80D20FE7C9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE741BD59B4915947BEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379E90269B204C5E5D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D848FE8F6FC871F686163D681F60F9B187117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7B96B19DC409332107FB45A5F6E725C8D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3AD0E433DBF1FBFA303F1AB874ED89028C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637A7EFCB0EB5ACB161EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C97831629B0851DF0FFD003E935B826940C3D9 X-C1DE0DAB: 0D63561A33F958A587901CF45656B232EF42FBC965585041D5F6075F7B4DF49AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34697E0FA301E28215F9B8E452EB29BF885B884235DE009AA99A109A0CA27C0130B4E8147AE3741BA61D7E09C32AA3244C45494620986D02C43161C0A298F8AF6C853296C06374E602FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCpYK6nkTlbGrSpVzL1/U0g== X-Mailru-Sender: 583F1D7ACE8F49BD9DF7A8DAE6E2B08A723AD2F6E19CA5E04252E81F574C7AE85E798E977E28F61B424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 4/6] replication: introduce ballot.is_booted 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 Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 05.06.2021 02:37, Vladislav Shpilevoy пишет: > The new field reports whether the instance has finished its > bootstrap/recovery, or IOW has finished box.cfg(). > > The new field will help in fixing #5613 so as not to try to join > to a replicaset via non-bootstrapped instances if there are > others. > > The problem is that otherwise, if all nodes are booted but > are read-only, new instances bootstrap their own independent > replicaset. It would be better to just fail and terminate the > process than do such a bizarre action. > > Part of #5613 Thanks! LGTM. > --- > src/box/box.cc | 1 + > src/box/iproto_constants.h | 1 + > src/box/xrow.c | 14 ++++++++++++-- > src/box/xrow.h | 2 ++ > 4 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/src/box/box.cc b/src/box/box.cc > index d56b44d33..6fca337bc 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -2863,6 +2863,7 @@ box_process_vote(struct ballot *ballot) > ballot->is_ro_cfg = cfg_geti("read_only") != 0; > ballot->is_anon = replication_anon; > ballot->is_ro = is_ro_summary; > + ballot->is_booted = is_box_configured; > vclock_copy(&ballot->vclock, &replicaset.vclock); > vclock_copy(&ballot->gc_vclock, &gc.vclock); > } > diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h > index 0f84843d0..137bee9da 100644 > --- a/src/box/iproto_constants.h > +++ b/src/box/iproto_constants.h > @@ -167,6 +167,7 @@ enum iproto_ballot_key { > IPROTO_BALLOT_GC_VCLOCK = 0x03, > IPROTO_BALLOT_IS_RO = 0x04, > IPROTO_BALLOT_IS_ANON = 0x05, > + IPROTO_BALLOT_IS_BOOTED = 0x06, > }; > > #define bit(c) (1ULL< diff --git a/src/box/xrow.c b/src/box/xrow.c > index 115a25473..0d0548fef 100644 > --- a/src/box/xrow.c > +++ b/src/box/xrow.c > @@ -449,11 +449,13 @@ iproto_reply_vote(struct obuf *out, const struct ballot *ballot, > uint64_t sync, uint32_t schema_version) > { > size_t max_size = IPROTO_HEADER_LEN + mp_sizeof_map(1) + > - mp_sizeof_uint(UINT32_MAX) + mp_sizeof_map(5) + > + mp_sizeof_uint(UINT32_MAX) + mp_sizeof_map(6) + > mp_sizeof_uint(UINT32_MAX) + mp_sizeof_bool(ballot->is_ro_cfg) + > mp_sizeof_uint(UINT32_MAX) + mp_sizeof_bool(ballot->is_ro) + > mp_sizeof_uint(IPROTO_BALLOT_IS_ANON) + > mp_sizeof_bool(ballot->is_anon) + > + mp_sizeof_uint(IPROTO_BALLOT_IS_BOOTED) + > + mp_sizeof_bool(ballot->is_booted) + > mp_sizeof_uint(UINT32_MAX) + > mp_sizeof_vclock_ignore0(&ballot->vclock) + > mp_sizeof_uint(UINT32_MAX) + > @@ -469,13 +471,15 @@ iproto_reply_vote(struct obuf *out, const struct ballot *ballot, > char *data = buf + IPROTO_HEADER_LEN; > data = mp_encode_map(data, 1); > data = mp_encode_uint(data, IPROTO_BALLOT); > - data = mp_encode_map(data, 5); > + data = mp_encode_map(data, 6); > data = mp_encode_uint(data, IPROTO_BALLOT_IS_RO_CFG); > data = mp_encode_bool(data, ballot->is_ro_cfg); > data = mp_encode_uint(data, IPROTO_BALLOT_IS_RO); > data = mp_encode_bool(data, ballot->is_ro); > data = mp_encode_uint(data, IPROTO_BALLOT_IS_ANON); > data = mp_encode_bool(data, ballot->is_anon); > + data = mp_encode_uint(data, IPROTO_BALLOT_IS_BOOTED); > + data = mp_encode_bool(data, ballot->is_booted); > data = mp_encode_uint(data, IPROTO_BALLOT_VCLOCK); > data = mp_encode_vclock_ignore0(data, &ballot->vclock); > data = mp_encode_uint(data, IPROTO_BALLOT_GC_VCLOCK); > @@ -1360,6 +1364,7 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) > ballot->is_ro_cfg = false; > ballot->is_ro = false; > ballot->is_anon = false; > + ballot->is_booted = true; > vclock_create(&ballot->vclock); > > const char *start = NULL; > @@ -1424,6 +1429,11 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) > &ballot->gc_vclock) != 0) > goto err; > break; > + case IPROTO_BALLOT_IS_BOOTED: > + if (mp_typeof(*data) != MP_BOOL) > + goto err; > + ballot->is_booted = mp_decode_bool(&data); > + break; > default: > mp_next(&data); > } > diff --git a/src/box/xrow.h b/src/box/xrow.h > index 1d00b2e43..055fd31e1 100644 > --- a/src/box/xrow.h > +++ b/src/box/xrow.h > @@ -379,6 +379,8 @@ struct ballot { > * finished recovery/bootstrap; or anything else. > */ > bool is_ro; > + /** Set if the instance has finished its bootstrap/recovery. */ > + bool is_booted; > /** Current instance vclock. */ > struct vclock vclock; > /** Oldest vclock available on the instance. */ -- Serge Petrenko