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 E2AE06EC40; Sat, 5 Jun 2021 02:39:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E2AE06EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1622849943; bh=i5EjmWeKK7WJh0H9PNNx281Ef96jRL38EAFdKWtgHxM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Jur/HYWNatC+t0gpccZRACzxTyfrWfg4dlj1FqHZRGWROCxlJrgh5I7hiY659fj6E YPQJwamaUOf5buYK/RWBErFb/g1atmvDdmJP7hmzlyIuL99l5v6DIpe29vkEDX03UA P5Q8bSRShkxj4fTKkMDKJ9PJq2iSR9hwNRgY6cS8= Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 BA1AD6EC41 for ; Sat, 5 Jun 2021 02:38:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BA1AD6EC41 Received: by smtp16.mail.ru with esmtpa (envelope-from ) id 1lpJO6-0001Ge-Vg; Sat, 05 Jun 2021 02:38:03 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Sat, 5 Jun 2021 01:37:56 +0200 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C5407454A95E60932C8E3171F0D0805CD56182A05F538085040FF76B59B1A81190980B1F415495AAE6D7EBE27143241C1127E705937D85A46C3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB45732B85BEE83BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370BACBAB4C30C4AEB8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E322F945373DACF9F1DE94FFA53AF8BD117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCEA77C8EAE1CE44B0A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE902A1BE408319B29D7C2347B1D03E769D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE389DDFE3E282F3DD16E0066C2D8992A16C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F79006373BC478629CBEC79DEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C978311767CEB4D52F6362E6846C195B0237D3 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CC176FDF34A1E429F60F11469A42761BAA7E260E74A549F059C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFD99FB7B2A39B4961699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34951738D4D62E58A48A77C1645052737C68AB217BFCE530F8FE47AE7EA03DE447F1187E1E74A4BE1D1D7E09C32AA3244CC772B4CB786BEDF3F62B96B8041C474C7C0C08F7987826B9FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojz99asgmzejonuDPGCowe8g== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110B8F3BE3BFF3B965003760132911205A11135FE713E83A31407784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- 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. -- 2.24.3 (Apple Git-128)