memtables: always seal through memtable_list seal function

I would like to be able to apply a function at the end of every flush, that is
common for both memtables and streaming memtables. For instance, to unthrottle
current waiters. Right now some calls to seal_active_memtable are open coded,
calling the column family's function directly, for both the main memtable list
and the streaming list.

This patch moves all the current open code callers to call the respective
memtable_list function.

Signed-off-by: Glauber Costa <glauber@scylladb.com>
Message-Id: <0c780254f3c4eb03e2bcd856b83941cf49a84b85.1463448522.git.glauber@scylladb.com>
This commit is contained in:
Glauber Costa
2016-05-16 21:35:12 -04:00
committed by Avi Kivity
parent 4972a72380
commit 4981362f57

View File

@@ -784,8 +784,8 @@ column_family::start() {
future<>
column_family::stop() {
seal_active_memtable();
seal_active_streaming_memtable();
_memtables->seal_active_memtable();
_streaming_memtables->seal_active_memtable();
return _compaction_manager.remove(this).then([this] {
// Nest, instead of using when_all, so we don't lose any exceptions.
return _flush_queue->close().then([this] {
@@ -2535,7 +2535,7 @@ future<> column_family::flush() {
// FIXME: this will synchronously wait for this write to finish, but doesn't guarantee
// anything about previous writes.
_stats.pending_flushes++;
return seal_active_memtable().finally([this]() mutable {
return _memtables->seal_active_memtable().finally([this]() mutable {
_stats.pending_flushes--;
// In origin memtable_switch_count is incremented inside
// ColumnFamilyMeetrics Flush.run
@@ -2557,7 +2557,7 @@ future<> column_family::flush(const db::replay_position& pos) {
// We ignore this for now and just say that if we're asked for
// a CF and it exists, we pretty much have to have data that needs
// flushing. Let's do it.
return seal_active_memtable();
return _memtables->seal_active_memtable();
}
// FIXME: We can do much better than this in terms of cache management. Right
@@ -2574,7 +2574,7 @@ future<> column_family::flush_streaming_mutations(std::vector<query::partition_r
// need this code to go away as soon as we can (see FIXME above). So the double gate is a better
// temporary counter measure.
return with_gate(_streaming_flush_gate, [this, ranges = std::move(ranges)] {
return seal_active_streaming_memtable_delayed().finally([this, ranges = std::move(ranges)] {
return _streaming_memtables->seal_active_memtable().finally([this, ranges = std::move(ranges)] {
if (_config.enable_cache) {
for (auto& range : ranges) {
_cache.invalidate(range);