mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-06 15:03:06 +00:00
sstables: add sstable's on closed handling
Motivation is that it will be useful for catching regression on compaction when releasing early exhausted sstables. That's because sstable's space is only released once it's closed. So this will allow us to write a test case and possibly use it for entities holding exhausted sstable. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -4126,6 +4126,8 @@ sstable::~sstable() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_on_closed(*this);
|
||||
}
|
||||
|
||||
sstring
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "db/large_partition_handler.hh"
|
||||
#include "column_translation.hh"
|
||||
#include "stats.hh"
|
||||
#include "utils/observable.hh"
|
||||
|
||||
#include <seastar/util/optimized_optional.hh>
|
||||
|
||||
@@ -388,6 +389,10 @@ public:
|
||||
}
|
||||
std::vector<sstring> component_filenames() const;
|
||||
|
||||
utils::observer<sstable&> add_on_closed_handler(std::function<void (sstable&)> on_closed_handler) noexcept {
|
||||
return _on_closed.observe(on_closed_handler);
|
||||
}
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
auto sstable_write_io_check(Func&& func, Args&&... args) const {
|
||||
return do_io_check(_write_error_handler, func, std::forward<Args>(args)...);
|
||||
@@ -429,6 +434,7 @@ private:
|
||||
stdx::optional<dht::decorated_key> _first;
|
||||
stdx::optional<dht::decorated_key> _last;
|
||||
utils::UUID _run_identifier;
|
||||
utils::observable<sstable&> _on_closed;
|
||||
|
||||
lw_shared_ptr<file_input_stream_history> _single_partition_history = make_lw_shared<file_input_stream_history>();
|
||||
lw_shared_ptr<file_input_stream_history> _partition_range_history = make_lw_shared<file_input_stream_history>();
|
||||
|
||||
Reference in New Issue
Block a user