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 B618B6E200; Sat, 19 Jun 2021 01:53:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B618B6E200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1624056819; bh=7Bt3HRxVuu4AVXUHbvz4Jew6Ax2Dr7bUN8ATmLiKmMc=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=G4rymLN/a6R7E2nA/htvWc5O8Uk+iu2wtKQprg7B6UyU5vRF2pmU2N6gd/cma1idW thP7la+fzEASMwwLBxs1lw1N29FlKrwF8FzJbgC56ICoVNPnwcQVFZzV4S0BKLeH9l FKmHlzmmrNAx4LE6X6XmQwWUrw4A+qVmvCpA3rvk= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 CFBCD6E200 for ; Sat, 19 Jun 2021 01:53:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CFBCD6E200 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1luNMn-0006PR-29; Sat, 19 Jun 2021 01:53:37 +0300 To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <31dfa1eb-fa8a-001d-a47f-0038e71e7bdb@tarantool.org> Date: Sat, 19 Jun 2021 00:53:36 +0200 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 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD91C2C07775F13263A38E2610A94B554561BE460F683D6B25800894C459B0CD1B96DA0B9EA8876D58297F8BDABDA4D7E2A1423CBEC9FF1E7EF644255FD46611E48 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D298878E5C9226A3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006379703D7D5B138802D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F8FA51992A3B266F003AFF2CBDBA8336117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B65D56369A3576CBA5089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831A4743EE7585E1C989987FE5AEBDF0A48 X-C1DE0DAB: 0D63561A33F958A5A94F090D6A97CF4112EA38E618FEFD020306D70F620875E1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3498910055B812BD9CE65198DB73CE83BC43E4E568A445087324B517257E5BE531740D7583D6DB2D651D7E09C32AA3244C438164B54CDB161F98BBD8BBC05DA9F55595C85A795C7BAEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj0Roc5o5ut94d/+6MLtvSjQ== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382253C5770CA149BC467E52E6A903F992773841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 7/7] box: make promote/demote always bump the term 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" Thanks for the patch! See 4 comments below. > box: make promote always bump the term > > When called without elections, promote and resulted in multiple 1. 'and' is excess. > PROMOTE entries for the same term. This is not right, because all > the promotions for the same term except the first one would be ignored > as already seen. > > Part-of #6034 > > diff --git a/src/box/box.cc b/src/box/box.cc > index 6a0950f44..53a8f80e5 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -1687,16 +1687,18 @@ box_promote(void) > rc = -1; > } else { > promote: > - /* We cannot possibly get here in a volatile state. */ > - assert(box_raft()->volatile_term == box_raft()->term); > + if (try_wait) > + raft_new_term(box_raft()); 2. It starts to bother me, that we use try_wait flag as a kind of a state of the promote process rather just just a command 'you need to wait'. But I can't propose anything better right away. Just noticing. > diff --git a/test/replication/gh-4114-local-space-replication.result b/test/replication/gh-4114-local-space-replication.result > index 9b63a4b99..676400cef 100644 > --- a/test/replication/gh-4114-local-space-replication.result > +++ b/test/replication/gh-4114-local-space-replication.result> @@ -77,9 +76,9 @@ box.space.test:insert{3} > | - [3] > | ... > > -box.info.vclock[0] > +box.info.vclock[0] == a + 3 or box.info.vclock[0] - a 3. Maybe use an assertion? They really do look easier to read when you try to understand a test. > | --- > - | - 3 > + | - true > | ... > diff --git a/test/replication/gh-6034-promote-bump-term.result b/test/replication/gh-6034-promote-bump-term.result > new file mode 100644 > index 000000000..20e352922 > --- /dev/null > +++ b/test/replication/gh-6034-promote-bump-term.result > @@ -0,0 +1,37 @@ > +-- test-run result file version 2 > +test_run = require('test_run').new() > + | --- > + | ... > + > +-- gh-6034: test that every box.ctl.promote() bumps > +-- the instance's term. Even when elections are disabled. Even for consequent > +-- promotes on the same instance. > +election_mode = box.cfg.election_mode > + | --- > + | ... > +box.cfg{election_mode='off'} > + | --- > + | ... > + > +term = box.info.election.term > + | --- > + | ... > +box.ctl.promote() > + | --- > + | ... > +assert(box.info.election.term == term + 1) > + | --- > + | - true > + | ... > +box.ctl.promote() > + | --- > + | ... > +assert(box.info.election.term == term + 2) > + | --- > + | - true 4. Could you please remind why do we issue a new promote even if we own the limbo already? Especially if its ownership is going to get ever more strict after this series.