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 222266F87A; Fri, 16 Apr 2021 19:31:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 222266F87A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618590682; bh=S6cwJuSw7VDXFHhw4rBfLsV//+rqQpBUomG0s3QnmpU=; 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=Srv4GlfwhbL1koOB9ioIRQ+tsU26557z+UI5qYhrdeKX61XDdut0JRrxualw2MNMh mYn4WJxFbBaweERw8FAkOkwJnChnNOLdfFbBtyPeOtk00IzjCK+rBVv4FZeZSc8hXb lZXzInckghQh+wBmkFp1E4FaSszLKswtGbAKco0k= Received: from smtp17.mail.ru (smtp17.mail.ru [94.100.176.154]) (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 48AD774CDD for ; Fri, 16 Apr 2021 19:26:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 48AD774CDD Received: by smtp17.mail.ru with esmtpa (envelope-from ) id 1lXRIB-00008e-H8; Fri, 16 Apr 2021 19:26:03 +0300 To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Date: Fri, 16 Apr 2021 19:25:42 +0300 Message-Id: <7976d8c3856561489c5e1d1c56c4c6f91e2adb3c.1618590211.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: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74807BAE725B9AE625DE765B0E193B5B7687182A05F5380850400A67BE2332CA35ACA14E17F94C1BF516574E39228461F8D120D09754039BD131 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7904AD829351C4442EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063721F819F5952827038638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2D11E9A3752DB619C274EB868EE32B9E1BDFBBEFFF4125B51D2E47CDBA5A96583C09775C1D3CA48CF90D92131081DE748117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7A6779F98BF527B7A9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE7955B4824B9ECD150D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0FAC4EE88CF060D5BCD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3CE9959E2676FD87735872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADBD35190C2CBFC13E21BF2295BA96B810 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C4C7A0BC55FA0FE5FCB710B7F030ED88FC61961B3619E851B1EE529BBB88C3133CB1881A6453793CE9C32612AADDFBE061C61BE10805914D3804EBA3D8E7E5B87ABF8C51168CD8EBDB63AF70AF8205D7DCDC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3482189E76C6218D8F3FC2E605F8D521C789180C0C4BEB919E8923547B206829E98BF55DD34C1455171D7E09C32AA3244C237EB1F864E7B4913E697A249BC439A83C6EB905E3A8056B927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj3S6P1v0GIqRS7qBnPdw9Mg== X-Mailru-Sender: 583F1D7ACE8F49BDD2846D59FC20E9F8DF49C5E8585DB537088DFD6D0519EB0B047538D6AA8054D1424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok X-PR7D5YW: Astghik Subject: [Tarantool-patches] [PATCH v4 11/12] 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 fcd812c09..be7234302 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1504,7 +1504,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; @@ -1523,9 +1523,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); @@ -1535,7 +1537,6 @@ box_clear_synchro_queue(bool try_wait) case ELECTION_MODE_MANUAL: assert(box_raft()->state == RAFT_STATE_FOLLOWER); 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 425353207..9a67a7cb0 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)