[Tarantool-patches] [PATCH 2/3] [tosquash] raft: fix 99% CPU issue in raft io worker

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Sep 26 00:29:12 MSK 2020


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)



More information about the Tarantool-patches mailing list