From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org
Subject: [Tarantool-patches] [PATCH 2/3] [tosquash] raft: fix 99% CPU issue in raft io worker
Date: Fri, 25 Sep 2020 23:29:12 +0200 [thread overview]
Message-ID: <a6dbf2fdecb60db7bf914e27e42aa91ba67a1525.1601069274.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1601069274.git.v.shpilevoy@tarantool.org>
The idle flag was never set to true after being set to false. So
the fiber infinitely called fiber_sleep(0) when didn't have
anything else to do.
---
src/box/raft.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/box/raft.c b/src/box/raft.c
index 9ef03d8c4..8e5f7803c 100644
--- a/src/box/raft.c
+++ b/src/box/raft.c
@@ -631,8 +631,9 @@ static int
raft_worker_f(va_list args)
{
(void)args;
- bool is_idle = true;
+ bool is_idle;
while (!fiber_is_cancelled()) {
+ is_idle = true;
if (raft.is_write_in_progress) {
raft_worker_handle_io();
is_idle = false;
--
2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-09-25 21:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 21:29 [Tarantool-patches] [PATCH 0/3] Raft follow-ups Vladislav Shpilevoy
2020-09-25 21:29 ` [Tarantool-patches] [PATCH 1/3] [tosquash] raft: vote without a new term when possible Vladislav Shpilevoy
2020-09-25 21:29 ` Vladislav Shpilevoy [this message]
2020-09-25 21:29 ` [Tarantool-patches] [PATCH 3/3] [tosquash] raft: don't start new election immediately after restart Vladislav Shpilevoy
2020-09-28 7:09 ` [Tarantool-patches] [PATCH 0/3] Raft follow-ups Serge Petrenko
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=a6dbf2fdecb60db7bf914e27e42aa91ba67a1525.1601069274.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 2/3] [tosquash] raft: fix 99% CPU issue in raft io worker' \
/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