[Tarantool-patches] [PATCH v3 09/10] box: remove parameter from clear_synchro_queue
Serge Petrenko
sergepetrenko at tarantool.org
Wed Apr 14 17:17:19 MSK 2021
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)
More information about the Tarantool-patches
mailing list