From 824ceb32aca3273de4d9eae7838e0a9341998de6 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Thu, 15 Jun 2017 14:54:09 +0300 Subject: [PATCH] vinyl: do not call vy_scheduler_complete_dump on index deletion Currently, vy_scheduler_remove_mem() calls vy_scheduler_complete_dump() if vy_scheduler_dump_in_progress() returns false, but the latter doesn't necessarily mean that the dump has just been completed. The point is that vy_scheduler_remove_mem() is called not only for a memory tree that has just been dumped to disk, but also for all memory trees of a dropped index, i.e. dropping an index when there's no dump in progress results in vy_scheduler_complete_dump() invocation. This doesn't do any harm now, but looks ugly. Besides, I'm planning to account dump bandwidth in vy_scheduler_complete_dump(), which must only be done on actual dump completion. --- 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 50739f5d66..887ffcd974 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -4229,8 +4229,14 @@ vy_scheduler_remove_mem(struct vy_scheduler *scheduler, struct vy_mem *mem) assert(!rlist_empty(&mem->in_dump_fifo)); rlist_del_entry(mem, in_dump_fifo); - if (!vy_scheduler_dump_in_progress(scheduler)) + if (mem->generation < scheduler->generation && + !vy_scheduler_dump_in_progress(scheduler)) { + /* + * The last in-memory tree left from the previous + * generation has just been deleted, complete dump. + */ vy_scheduler_complete_dump(scheduler); + } } /* -- GitLab