database: immediately flush tables with no memtables.

If a table has no data, it may still take a long time to flush. This is
because before we even try to flush, we need go acquire a permit and
that can take a while if there is a long running flush already queued.

We can special case the situation in which there is no data in any of
the memtables owned by table and return immediately.

Signed-off-by: Glauber Costa <glauber@scylladb.com>
This commit is contained in:
Glauber Costa
2019-02-27 14:45:00 -05:00
parent ca288189a9
commit ed8261a0fe
2 changed files with 9 additions and 1 deletions

View File

@@ -1282,7 +1282,7 @@ future<> dirty_memory_manager::shutdown() {
}
future<> memtable_list::request_flush() {
if (!may_flush()) {
if (empty() || !may_flush()) {
return make_ready_future<>();
} else if (!_flush_coalescing) {
_flush_coalescing = shared_promise<>();