From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v3 09/10] box: remove parameter from clear_synchro_queue Date: Wed, 14 Apr 2021 17:17:19 +0300 [thread overview] Message-ID: <0498bc6e2a21649f789b882fbba3f9638d828290.1618409665.git.sergepetrenko@tarantool.org> (raw) In-Reply-To: <cover.1618409665.git.sergepetrenko@tarantool.org> The `try_wait` parameter became redundant with the inroduction of manual elections concept. It may be determined whether the node should wait for pending confirmations or not by looking at election mode, so remove the parameter. Part of #3055 --- src/box/box.cc | 5 +++-- src/box/box.h | 2 +- src/box/lua/ctl.c | 2 +- src/box/raft.c | 5 +---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index 6c7c8968a..9b663f54a 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1509,7 +1509,7 @@ box_wait_quorum(uint32_t lead_id, int64_t target_lsn, int quorum, } int -box_clear_synchro_queue(bool try_wait) +box_clear_synchro_queue(void) { /* A guard to block multiple simultaneous function invocations. */ static bool in_clear_synchro_queue = false; @@ -1528,9 +1528,11 @@ box_clear_synchro_queue(bool try_wait) return 0; bool run_elections = false; + bool try_wait = false; switch (box_election_mode) { case ELECTION_MODE_OFF: + try_wait = true; break; case ELECTION_MODE_VOTER: assert(box_raft()->state == RAFT_STATE_FOLLOWER); @@ -1544,7 +1546,6 @@ box_clear_synchro_queue(bool try_wait) return -1; } run_elections = true; - try_wait = false; break; case ELECTION_MODE_CANDIDATE: /* diff --git a/src/box/box.h b/src/box/box.h index e2321b9b0..90facd189 100644 --- a/src/box/box.h +++ b/src/box/box.h @@ -274,7 +274,7 @@ extern "C" { typedef struct tuple box_tuple_t; int -box_clear_synchro_queue(bool try_wait); +box_clear_synchro_queue(void); /* box_select is private and used only by FFI */ API_EXPORT int diff --git a/src/box/lua/ctl.c b/src/box/lua/ctl.c index d039a059f..5b8d0d0e4 100644 --- a/src/box/lua/ctl.c +++ b/src/box/lua/ctl.c @@ -84,7 +84,7 @@ lbox_ctl_on_schema_init(struct lua_State *L) static int lbox_ctl_clear_synchro_queue(struct lua_State *L) { - if (box_clear_synchro_queue(true) != 0) + if (box_clear_synchro_queue() != 0) return luaT_error(L); return 0; } diff --git a/src/box/raft.c b/src/box/raft.c index c7dc79f9b..e8c9f3d2c 100644 --- a/src/box/raft.c +++ b/src/box/raft.c @@ -88,9 +88,6 @@ box_raft_update_synchro_queue(struct raft *raft) { assert(raft == box_raft()); /* - * If the node became a leader, it means it will ignore all records from - * all the other nodes, and won't get late CONFIRM messages anyway. Can - * clear the queue without waiting for confirmations. * In case these are manual elections, we are already in the middle of a * `clear_synchro_queue` call. No need to call it once again. */ @@ -99,7 +96,7 @@ box_raft_update_synchro_queue(struct raft *raft) int rc = 0; uint32_t errcode = 0; do { - rc = box_clear_synchro_queue(false); + rc = box_clear_synchro_queue(); if (rc != 0) { struct error *err = diag_last_error(diag_get()); errcode = box_error_code(err); -- 2.24.3 (Apple Git-128)
next prev parent reply other threads:[~2021-04-14 14:21 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 ` Serge Petrenko via Tarantool-patches [this message] 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 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=0498bc6e2a21649f789b882fbba3f9638d828290.1618409665.git.sergepetrenko@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 09/10] box: remove parameter from clear_synchro_queue' \ /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