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 D07146EC56; Fri, 16 Jul 2021 02:49:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D07146EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626392994; bh=db44PBa3O7CHunDfvNg/8I50J7lSBNqR2PkQZxdoOEI=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=A3BETYtRJo8+NitfbeuGGC0pOOgPivP7DYqEWlb38vg3RWjyVVXOq6E80sje3j1KT Lg8v/u3zOCL3C6NGdY9itQ7QRgwkaZzqFKK9ChV2VmPAJlHeBlXAI3jsRuFNhhMBjP gVwn0/hJhx0PHQGFiazt0x7X6h4XbcGhRk17xcGQ= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 799DD6EC55 for ; Fri, 16 Jul 2021 02:49:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 799DD6EC55 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1m4B71-000289-Mk; Fri, 16 Jul 2021 02:49:52 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergepetrenko@tarantool.org Date: Fri, 16 Jul 2021 01:49:48 +0200 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3FDAB68B812060C77E621B90589399EB5182A05F538085040D7220192D483F8DAA1F355E791EDE152E0F6338176268E45B62FEA9FC46246EB X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7EA3138A79BBB0710EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637889C00975665ABF68638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D86B105D15602596BBFE109DF01CEA89DB117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC9FC99A4BA45EE8B4A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209647ADFADE5905B1E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B65D56369A3576CBA5089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CAA8DC07915BC95B7A51E6B8F587D699CC579D8FC1DC534679C2B6934AE262D3EE7EAB7254005DCED283A4D26F80D534D1E0A4E2319210D9B64D260DF9561598F01A9E91200F654B00191F08AA555D0B08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348F1757F8DFBC5C3304E5CBF3F3B28F81175B9D87C0D81A11D31B42112523A10E2910AC30D52DDBAF1D7E09C32AA3244CB80F41286C157D44DAA614F79A6A3F15259227199D06760AFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXjR8My76CdBrv9MAaQ1KPvb X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DA16A2C337AF6BF6DF014838C110387B23841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 0/2] Bootstrap voter 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" In the patch I don't like this start/stop_candidate() calls. They look bulky. I wanted to replace them with a function like raft_try_candidate() which would make the instance a candidate for one current term. Also I don't like box_raft_wait_leader_found() in bootstrap. Even though it should always succeed in a couple of WAL writes. The only problem with having a one-term try_candidate() is the split vote in box_promote(). There between start_candidate() and stop_candidate() several terms can pass if they end without a leader elected. I want to keep this working. But I couldn't find a simple way to make raft_try_candidate() work like that. Nor I could find a nice way to retry the candidate attempts in box_promote(). In the end, if box_raft_wait_leader_found() fails, you need to restore the candidate state. And this leads to having some kind of start/stop_candidate anyway. If you have ideas how to make it look better, I am looking forward to hearing it. Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-6018-boot-voter Issue: https://github.com/tarantool/tarantool/issues/6018 Vladislav Shpilevoy (2): replication: introduce ballot.can_be_leader election: during bootstrap prefer candidates .../unreleased/gh-6018-election-boot-voter.md | 4 + src/box/box.cc | 28 ++++- src/box/iproto_constants.h | 1 + src/box/replication.cc | 11 +- src/box/xrow.c | 14 ++- src/box/xrow.h | 2 + .../gh-6018-election-boot-voter.result | 116 ++++++++++++++++++ .../gh-6018-election-boot-voter.test.lua | 59 +++++++++ test/replication/gh-6018-master.lua | 17 +++ test/replication/gh-6018-replica.lua | 15 +++ test/replication/suite.cfg | 1 + 11 files changed, 263 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/gh-6018-election-boot-voter.md create mode 100644 test/replication/gh-6018-election-boot-voter.result create mode 100644 test/replication/gh-6018-election-boot-voter.test.lua create mode 100644 test/replication/gh-6018-master.lua create mode 100644 test/replication/gh-6018-replica.lua -- 2.24.3 (Apple Git-128)