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 5DF996EC55; Thu, 10 Jun 2021 16:56:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5DF996EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1623333364; bh=/gznnw9kJHN8fNyh4mhfa5tKDX3QftluFQnTgKyGRkI=; 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=LVnaPor24BQnxl1ItBZrLjl4hplTLrp6Ozmur/Jlk1BZDnuppIon8079dNV3xDT1n 2/uTljhFYtCd+f/Zk+DX7fYq1fZtrBNqfp2p5gU6RIg6f52qBuDzHEdJCPUy4l6CJt rmzxJVlEBv+W6EwN+cFOkWEcOc0g7KU+OmGggZsI= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (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 C219A6EC55 for ; Thu, 10 Jun 2021 16:56:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C219A6EC55 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1lrLAA-000187-3P; Thu, 10 Jun 2021 16:56:02 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com References: Message-ID: <9bddefc1-c4ac-39df-5786-2352cbd0e3c2@tarantool.org> Date: Thu, 10 Jun 2021 16:56:01 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54EECC50CDFE52CD8E09EC742E3E75A787182A05F53808504084293F072E664C11C373CB946CFC4BA1E209F066FEE1020C3E5FB1F14241D2AF X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BF6CFCE92D77DF21EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B997C8222C70C3D98638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E7445F417E56373A3DB0DB310283FDF6117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C91E4BF118115E4929735652A29929C6C4AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C3FA79E84ED94DD554BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7D151390FFDBF6399731C566533BA786AA5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C97831B0210EC6235DFACF778C2F04FB368B36 X-C1DE0DAB: 0D63561A33F958A5A8AD8EA05F555CE1B37E21370577A73261BA4D43C8FF325AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AE88D5ADEBE7C9835E0EF76A466BF4740B7CAEE7EC3B0943D8552C3292D434F544B0E46788245E2A1D7E09C32AA3244CF69D89040752A61870C142E28094871951E887DA02A9F7BFFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCpYK6nkTlbHe0rLOUfVeCg== X-Mailru-Sender: 583F1D7ACE8F49BD9DF7A8DAE6E2B08A2581A8AC86AA861D81A4354EA6429F3190EE8021CA853496424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 2/6] replication: ballot.is_ro -> is_ro_cfg 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 пишет: > Rename the member to show its actual meaning. It is not the > real RO state of the instance. Only how it is configured. > > It can happen that the instance is read_only = false, but still is > in RO state due to other reasons. > > The patch is done in scope of #5613 where the ballot is going to > be extended and used a bit differently in the join-master search > algorithm. > > Part of #5613 LGTM. > --- > src/box/box.cc | 2 +- > src/box/iproto_constants.h | 2 +- > src/box/replication.cc | 2 +- > src/box/xrow.c | 12 ++++++------ > src/box/xrow.h | 4 ++-- > 5 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/src/box/box.cc b/src/box/box.cc > index 0e615e944..d35a339ad 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -2860,7 +2860,7 @@ box_process_subscribe(struct ev_io *io, struct xrow_header *header) > void > box_process_vote(struct ballot *ballot) > { > - ballot->is_ro = cfg_geti("read_only") != 0; > + ballot->is_ro_cfg = cfg_geti("read_only") != 0; > ballot->is_anon = replication_anon; > /* > * is_ro is true on initial load and is set to box.cfg.read_only > diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h > index 7362ddaf1..d4ee9e090 100644 > --- a/src/box/iproto_constants.h > +++ b/src/box/iproto_constants.h > @@ -162,7 +162,7 @@ enum iproto_metadata_key { > }; > > enum iproto_ballot_key { > - IPROTO_BALLOT_IS_RO = 0x01, > + IPROTO_BALLOT_IS_RO_CFG = 0x01, > IPROTO_BALLOT_VCLOCK = 0x02, > IPROTO_BALLOT_GC_VCLOCK = 0x03, > IPROTO_BALLOT_IS_LOADING = 0x04, > diff --git a/src/box/replication.cc b/src/box/replication.cc > index a1c6e3c7c..ce2b74065 100644 > --- a/src/box/replication.cc > +++ b/src/box/replication.cc > @@ -976,7 +976,7 @@ replicaset_round(bool skip_ro) > * replicas since there is still a possibility > * that all replicas exist in cluster table. > */ > - if (skip_ro && ballot->is_ro) > + if (skip_ro && ballot->is_ro_cfg) > continue; > if (leader == NULL) { > leader = replica; > diff --git a/src/box/xrow.c b/src/box/xrow.c > index 2e364cea5..6e2a87f8a 100644 > --- a/src/box/xrow.c > +++ b/src/box/xrow.c > @@ -450,7 +450,7 @@ iproto_reply_vote(struct obuf *out, const struct ballot *ballot, > { > 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_bool(ballot->is_ro) + > + mp_sizeof_uint(UINT32_MAX) + mp_sizeof_bool(ballot->is_ro_cfg) + > mp_sizeof_uint(UINT32_MAX) + mp_sizeof_bool(ballot->is_loading) + > mp_sizeof_uint(IPROTO_BALLOT_IS_ANON) + > mp_sizeof_bool(ballot->is_anon) + > @@ -470,8 +470,8 @@ iproto_reply_vote(struct obuf *out, const struct ballot *ballot, > data = mp_encode_map(data, 1); > data = mp_encode_uint(data, IPROTO_BALLOT); > data = mp_encode_map(data, 5); > - 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_RO_CFG); > + data = mp_encode_bool(data, ballot->is_ro_cfg); > data = mp_encode_uint(data, IPROTO_BALLOT_IS_LOADING); > data = mp_encode_bool(data, ballot->is_loading); > data = mp_encode_uint(data, IPROTO_BALLOT_IS_ANON); > @@ -1357,7 +1357,7 @@ xrow_encode_vote(struct xrow_header *row) > int > xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) > { > - ballot->is_ro = false; > + ballot->is_ro_cfg = false; > ballot->is_loading = false; > ballot->is_anon = false; > vclock_create(&ballot->vclock); > @@ -1399,10 +1399,10 @@ xrow_decode_ballot(struct xrow_header *row, struct ballot *ballot) > } > uint32_t key = mp_decode_uint(&data); > switch (key) { > - case IPROTO_BALLOT_IS_RO: > + case IPROTO_BALLOT_IS_RO_CFG: > if (mp_typeof(*data) != MP_BOOL) > goto err; > - ballot->is_ro = mp_decode_bool(&data); > + ballot->is_ro_cfg = mp_decode_bool(&data); > break; > case IPROTO_BALLOT_IS_LOADING: > if (mp_typeof(*data) != MP_BOOL) > diff --git a/src/box/xrow.h b/src/box/xrow.h > index b3c664be2..241a7af8e 100644 > --- a/src/box/xrow.h > +++ b/src/box/xrow.h > @@ -366,8 +366,8 @@ xrow_encode_auth(struct xrow_header *row, const char *salt, size_t salt_len, > > /** Reply to IPROTO_VOTE request. */ > struct ballot { > - /** Set if the instance is running in read-only mode. */ > - bool is_ro; > + /** Set if the instance is configured in read-only mode. */ > + bool is_ro_cfg; > /** > * A flag whether the instance is anonymous, not having an > * ID, and not going to request it. -- Serge Petrenko