From e128864dd942625b320a880e571e21e6b6b288c0 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Tue, 20 Sep 2016 15:01:43 +0300
Subject: [PATCH] vinyl: disable scheduler during recovery

---
 src/box/vinyl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index d6823ce45a..2e3ac33459 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -3197,7 +3197,8 @@ vy_scheduler_add_index(struct vy_scheduler *scheduler, struct vy_index *index)
 	scheduler->indexes[scheduler->count++] = index;
 	vy_index_ref(index);
 	/* Start scheduler threads on demand */
-	if (!scheduler->is_worker_pool_running)
+	if (!scheduler->is_worker_pool_running &&
+	     scheduler->env->status == VINYL_ONLINE)
 		vy_scheduler_start(scheduler);
 	return 0;
 }
@@ -3532,6 +3533,7 @@ static void
 vy_scheduler_start(struct vy_scheduler *scheduler)
 {
 	assert(!scheduler->is_worker_pool_running);
+	assert(scheduler->env->status == VINYL_ONLINE);
 
 	/* Start worker threads */
 	scheduler->is_worker_pool_running = true;
@@ -5343,6 +5345,10 @@ vy_end_recovery(struct vy_env *e)
 	e->status = VINYL_ONLINE;
 	/* enable quota */
 	vy_quota_enable(e->quota);
+
+	/* Start scheduler if there is at least one index */
+	if (e->scheduler->count > 0)
+		vy_scheduler_start(e->scheduler);
 }
 
 /** }}} Recovery */
-- 
GitLab