Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 10/10] box.ctl: rename clear_synchro_queue to promote
Date: Fri, 16 Apr 2021 19:13:42 +0300	[thread overview]
Message-ID: <2122e035-5244-82c7-2058-7b7b398daf68@tarantool.org> (raw)
In-Reply-To: <8bc83a40-710e-0e11-7e3a-f7abcc49846d@tarantool.org>



16.04.2021 02:31, Vladislav Shpilevoy пишет:
> Thanks for the patch!
>
>> diff --git a/test/replication/election_basic.result b/test/replication/election_basic.result
>> index d5320b3ff..78c911245 100644
>> --- a/test/replication/election_basic.result
>> +++ b/test/replication/election_basic.result
>> @@ -108,6 +108,31 @@ assert(box.info.election.leader == box.info.id)
>>    | - true
>>    | ...
>>   
>> +-- Manual election mode. A voter most of the time, a leader once
>> +-- `box.ctl.promote()` is called.
>> +box.cfg{election_mode = 'manual'}
>> + | ---
>> + | ...
>> +
>> +assert(box.info.election.state == 'follower')
>> + | ---
>> + | - true
>> + | ...
>> +term = box.info.election.term
>> + | ---
>> + | ...
>> +box.ctl.promote()
>> + | ---
>> + | ...
>> +assert(box.info.election.state == 'leader')
>> + | ---
>> + | - error: assertion failed!
>> + | ...
>> +assert(box.info.election.term > term)
>> + | ---
>> + | - error: assertion failed!
> Hm. Shouldn't these assertions pass?

Ouch. Yes, they should. The assertions failed because
promote does nothing when node was a leader in this term.
So we can't test box.ctl.promote() with one instance.
The test will fail as long as the instance already was the
leader in current term. And this is the only case when
there is only one instance in test.

Even if I move election_mode='manual' above the
election_mode='candidate', the same test will fail on conf='vinyl'.

===============================

diff --git a/test/replication/election_basic.result 
b/test/replication/election_basic.result
index 78c911245..d5320b3ff 100644
--- a/test/replication/election_basic.result
+++ b/test/replication/election_basic.result
@@ -108,31 +108,6 @@ assert(box.info.election.leader == box.info.id)
   | - true
   | ...

--- Manual election mode. A voter most of the time, a leader once
--- `box.ctl.promote()` is called.
-box.cfg{election_mode = 'manual'}
- | ---
- | ...
-
-assert(box.info.election.state == 'follower')
- | ---
- | - true
- | ...
-term = box.info.election.term
- | ---
- | ...
-box.ctl.promote()
- | ---
- | ...
-assert(box.info.election.state == 'leader')
- | ---
- | - error: assertion failed!
- | ...
-assert(box.info.election.term > term)
- | ---
- | - error: assertion failed!
- | ...
-
  box.cfg{ \
      election_mode = 
'off',                                                      \
      election_timeout = 
old_election_timeout                                     \
diff --git a/test/replication/election_basic.test.lua 
b/test/replication/election_basic.test.lua
index 5fc398848..821f73cea 100644
--- a/test/replication/election_basic.test.lua
+++ b/test/replication/election_basic.test.lua
@@ -39,16 +39,6 @@ assert(box.info.election.term > term)
  assert(box.info.election.vote == box.info.id)
  assert(box.info.election.leader == box.info.id)

--- Manual election mode. A voter most of the time, a leader once
--- `box.ctl.promote()` is called.
-box.cfg{election_mode = 'manual'}
-
-assert(box.info.election.state == 'follower')
-term = box.info.election.term
-box.ctl.promote()
-assert(box.info.election.state == 'leader')
-assert(box.info.election.term > term)
-
  box.cfg{ \
      election_mode = 
'off',                                                      \
      election_timeout = 
old_election_timeout                                     \

-- 
Serge Petrenko


  reply	other threads:[~2021-04-16 16:13 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 14:17 [Tarantool-patches] [PATCH v3 00/10] raft: introduce manual elections and fix a bug with re-applying rolled back transactions Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 01/10] wal: enrich row's meta information with sync replication flags Serge Petrenko via Tarantool-patches
2021-04-15 23:18   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16  7:08     ` Serge Petrenko via Tarantool-patches
2021-04-16  7:11       ` Serge Petrenko via Tarantool-patches
2021-04-16  8:57       ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 02/10] xrow: introduce a PROMOTE entry Serge Petrenko via Tarantool-patches
2021-04-15 23:19   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 16:18     ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 03/10] box: actualise iproto_key_type array Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 04/10] box: make clear_synchro_queue() write a PROMOTE entry instead of CONFIRM + ROLLBACK Serge Petrenko via Tarantool-patches
2021-04-15 23:20   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16  9:28     ` Serge Petrenko via Tarantool-patches
2021-04-16 14:03       ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 05/10] box: write PROMOTE even for empty limbo Serge Petrenko via Tarantool-patches
2021-04-15 23:21   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16  9:33     ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 06/10] raft: keep track of greatest known term and filter replication sources based on that Serge Petrenko via Tarantool-patches
2021-04-15 23:27   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 14:16     ` Serge Petrenko via Tarantool-patches
2021-04-16 22:13       ` Vladislav Shpilevoy via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 07/10] replication: introduce a new election mode: "manual" Serge Petrenko via Tarantool-patches
2021-04-15 23:27   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 14:18     ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 08/10] Support manual elections in `box.ctl.clear_synchro_queue()` Serge Petrenko via Tarantool-patches
2021-04-15 23:30   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 15:38     ` Serge Petrenko via Tarantool-patches
2021-04-16 15:40       ` Serge Petrenko via Tarantool-patches
2021-04-16 15:50         ` Serge Petrenko via Tarantool-patches
2021-04-14 14:17 ` [Tarantool-patches] [PATCH v3 09/10] box: remove parameter from clear_synchro_queue Serge Petrenko via Tarantool-patches
2021-04-14 14:18 ` [Tarantool-patches] [PATCH v3 10/10] box.ctl: rename clear_synchro_queue to promote Serge Petrenko via Tarantool-patches
2021-04-15 23:31   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 16:13     ` Serge Petrenko via Tarantool-patches [this message]
2021-04-14 18:21 ` [Tarantool-patches] [PATCH v3 00/10] raft: introduce manual elections and fix a bug with re-applying rolled back transactions Cyrill Gorcunov via Tarantool-patches
2021-04-15 23:16 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 16:35   ` Serge Petrenko via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2122e035-5244-82c7-2058-7b7b398daf68@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 10/10] box.ctl: rename clear_synchro_queue to promote' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox