database: Remove view from base table upon drop

This patch changes the drop_column_family() function to remove
a view schema from the list of views of its base table.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2016-11-29 13:02:45 +01:00
parent 4f166cfa6a
commit ecc4290bc6

View File

@@ -2110,9 +2110,13 @@ future<> database::drop_column_family(const sstring& ks_name, const sstring& cf_
auto uuid = find_uuid(ks_name, cf_name);
auto& ks = find_keyspace(ks_name);
auto cf = _column_families.at(uuid);
auto&& s = cf->schema();
_column_families.erase(uuid);
ks.metadata()->remove_column_family(cf->schema());
ks.metadata()->remove_column_family(s);
_ks_cf_to_uuid.erase(std::make_pair(ks_name, cf_name));
if (s->is_view()) {
find_column_family(s->view_info()->base_id()).remove_view(view_ptr(s));
}
return truncate(ks, *cf, std::move(tsf)).then([this, cf] {
return cf->stop();
}).then([this, cf] {