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 F25586901A; Wed, 14 Apr 2021 17:21:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F25586901A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618410114; bh=psp9U2AxETdaiVwUIs40+TISAKqBGUGkJuaW4HSkAMk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=GZCysJ+RTRxXTv0tW0MVlQeeqoBCZbHeiGtNQ8U5NiTgYO7xxqhoE9B6T1CPZC3ia 3pLtothmhZGqzF0DNZa9aM+ZiwxR1H4+g0n5GmE3lUvhppBg8AK6rGjM73Ss0D7uti KUoUwiLngTamyVfSPFGhGCXcdaBV84MIisH0hGkQ= Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (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 2561069020 for ; Wed, 14 Apr 2021 17:17:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2561069020 Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1lWgKh-000456-Ge; Wed, 14 Apr 2021 17:17:31 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Wed, 14 Apr 2021 17:17:19 +0300 Message-Id: <0498bc6e2a21649f789b882fbba3f9638d828290.1618409665.git.sergepetrenko@tarantool.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D0F00AE41BB9A5343182A05F53808504002999FA4BAA5716C9A07DF779C7508900941A7406FF6346FB2F11493418543CA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE707314F92EEE30EB3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637956E96668349D4418638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2956934B9B18FBB5F209C73A9008084EFBE5E7F44427E1A0ED2E47CDBA5A96583C09775C1D3CA48CFA12191B5F2BB8629117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77E7E81EEA8A9722B8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD26923F8577A6DFFEA7C0C41DF77B78C0F1A7B076A6E789B0E97A8DF7F3B2552694A1E7802607F20496D49FD398EE364050F437C869540D2AB0FE21AE983DBD7FFC1B3661434B16C20AC78D18283394535A9E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B643EA11082B2E15FD089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C4C7A0BC55FA0FE5FCB91D1FC057429144F999BBBDF251BF5098C12E43CECFE3C8B1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDB63AF70AF8205D7DCDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3430FC2BC1B917F0181B7EAF57EB1452A117F996745DAFD6D052407138C6EC919069CCA628362BAD221D7E09C32AA3244C93560A7C8DAB3968039BF029C58CC4FEA995755A1445935E927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojrcJA+pXcDunD1ehWuN8yuQ== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F832D6326595065D5C7C04EB4C2D623D391FC7E3D8DE8D36FB424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v3 09/10] box: remove parameter from clear_synchro_queue 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: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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)