From f81fa5f75ca94ac75ddde35a8a3ec275e29e4219 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Wed, 14 Nov 2018 16:36:18 -0500 Subject: [PATCH] remove monitor if sstable write failed In (almost) all SSTable write paths, we need to inform the monitor that the write has failed as well. The monitor will remove the SSTable from controller's tracking at that point. Except there is one place where we are not doing that: streaming of big mutations. Streaming of big mutations is an interesting use case, in which it is done in 2 parts: if the writing of the SSTable fails right away, then we do the correct thing. But the SSTables are not commited at that point and the monitors are still kept around with the SSTables until a later time, when they are finally committed. Between those two points in time, it is possible that the streaming code will detect a failure and manually call fail_streaming_mutations(), which marks the SSTable for deletions. At that point we should propagate that information to the monitor as well, but we don't. Fixes #3732 (hopefully) Tests: unit (release) Signed-off-by: Glauber Costa Message-Id: <20181114213618.16789-1-glauber@scylladb.com> (cherry picked from commit 9f403334c858c473c47dc8fe96dc93a67e16d858) --- database.cc | 1 + database.hh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/database.cc b/database.cc index bfe12a38fb..f0b74d3efa 100644 --- a/database.cc +++ b/database.cc @@ -4256,6 +4256,7 @@ future<> table::fail_streaming_mutations(utils::UUID plan_id) { _streaming_memtables_big.erase(it); return entry->flush_in_progress.close().then([this, entry] { for (auto&& sst : entry->sstables) { + sst.monitor->write_failed(); sst.sstable->mark_for_deletion(); } }); diff --git a/database.hh b/database.hh index c981d1c47b..9cb5fd5ca2 100644 --- a/database.hh +++ b/database.hh @@ -298,6 +298,8 @@ public: class table; using column_family = table; +class database_sstable_write_monitor; + class table : public enable_lw_shared_from_this { public: struct config { @@ -395,7 +397,7 @@ private: // plan memtables and the resulting sstables are not made visible until // the streaming is complete. struct monitored_sstable { - std::unique_ptr monitor; + std::unique_ptr monitor; sstables::shared_sstable sstable; };