mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
schema_registry, database: flush entries when no longer in use
The schema registry disarms internal timers when it is destroyed.
This accesses the Seastar reactor. However, after [1] we don't have ordering
between the reactor destruction and the thread_local registry destruction.
Fix this by flushing all entries when the database is destroyed. The
database object is fundamental so it's unlikely we'll have anything
using the registry after it's gone.
[1] 101b245ed7
This commit is contained in:
@@ -636,6 +636,7 @@ void database::set_format(sstables::sstable_version_types format) noexcept {
|
||||
|
||||
database::~database() {
|
||||
_user_types->deactivate();
|
||||
local_schema_registry().clear();
|
||||
}
|
||||
|
||||
void database::update_version(const table_schema_version& version) {
|
||||
|
||||
@@ -164,6 +164,10 @@ schema_ptr schema_registry::get_or_load(table_schema_version v, const schema_loa
|
||||
return e.get_schema();
|
||||
}
|
||||
|
||||
void schema_registry::clear() {
|
||||
_entries.clear();
|
||||
}
|
||||
|
||||
schema_ptr schema_registry_entry::load(frozen_schema fs) {
|
||||
_frozen_schema = std::move(fs);
|
||||
auto s = get_schema();
|
||||
|
||||
@@ -150,6 +150,12 @@ public:
|
||||
// The schema instance pointed to by the argument will be attached to the registry
|
||||
// entry and will keep it alive.
|
||||
schema_ptr learn(const schema_ptr&);
|
||||
|
||||
// Removes all entries from the registry. This in turn removes all dependencies
|
||||
// on the Seastar reactor.
|
||||
//
|
||||
// Prerequisite: all futures from get_or_load() are resolved.
|
||||
void clear();
|
||||
};
|
||||
|
||||
schema_registry& local_schema_registry();
|
||||
|
||||
Reference in New Issue
Block a user