From bbc8dbbab548b378ee39bf2084027b95970e63e6 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 21 May 2015 15:48:51 +0300 Subject: [PATCH] db: abstract memtable empty test --- database.cc | 2 +- memtable.hh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/database.cc b/database.cc index 040c633415..e3b5c1210e 100644 --- a/database.cc +++ b/database.cc @@ -352,7 +352,7 @@ void column_family::add_memtable() { void column_family::seal_active_memtable() { auto old = _memtables->back(); - if (old->all_partitions().empty()) { + if (old->empty()) { return; } add_memtable(); diff --git a/memtable.hh b/memtable.hh index eb1c3bcd6e..2af7fefb75 100644 --- a/memtable.hh +++ b/memtable.hh @@ -30,4 +30,5 @@ public: void apply(const mutation& m); void apply(const frozen_mutation& m); const partitions_type& all_partitions() const; + bool empty() const { return partitions.empty(); } };