mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Allow to DROP database with Dictionary engine
This commit is contained in:
parent
de8a15b5f4
commit
90898905e0
@ -86,7 +86,7 @@ DatabaseIteratorPtr DatabaseDictionary::getIterator(const Context & context, con
|
||||
|
||||
bool DatabaseDictionary::empty(const Context & context) const
|
||||
{
|
||||
return context.getExternalDictionaries().getNumberOfNames() == 0;
|
||||
return !context.getExternalDictionaries().hasCurrentlyLoadedObjects();
|
||||
}
|
||||
|
||||
StoragePtr DatabaseDictionary::detachTable(const String & /*table_name*/)
|
||||
|
@ -343,12 +343,6 @@ public:
|
||||
enable_async_loading = enable;
|
||||
}
|
||||
|
||||
size_t getNumberOfNames() const
|
||||
{
|
||||
std::lock_guard lock{mutex};
|
||||
return infos.size();
|
||||
}
|
||||
|
||||
/// Returns the status of the object.
|
||||
/// If the object has not been loaded yet then the function returns Status::NOT_LOADED.
|
||||
/// If the specified name isn't found in the configuration then the function returns Status::NOT_EXIST.
|
||||
@ -406,6 +400,15 @@ public:
|
||||
return count;
|
||||
}
|
||||
|
||||
bool hasCurrentlyLoadedObjects() const
|
||||
{
|
||||
std::lock_guard lock{mutex};
|
||||
for (auto & [name, info] : infos)
|
||||
if (info.loaded())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Starts loading of a specified object.
|
||||
void load(const String & name)
|
||||
{
|
||||
@ -995,9 +998,9 @@ void ExternalLoader::enablePeriodicUpdates(bool enable_, const ExternalLoaderUpd
|
||||
periodic_updater->enable(enable_, settings_);
|
||||
}
|
||||
|
||||
size_t ExternalLoader::getNumberOfNames() const
|
||||
bool ExternalLoader::hasCurrentlyLoadedObjects() const
|
||||
{
|
||||
return loading_dispatcher->getNumberOfNames();
|
||||
return loading_dispatcher->hasCurrentlyLoadedObjects();
|
||||
}
|
||||
|
||||
ExternalLoader::Status ExternalLoader::getCurrentStatus(const String & name) const
|
||||
|
@ -107,9 +107,6 @@ public:
|
||||
/// Sets settings for periodic updates.
|
||||
void enablePeriodicUpdates(bool enable, const ExternalLoaderUpdateSettings & settings = {});
|
||||
|
||||
/// Returns the names of all the objects in the configuration (loaded or not).
|
||||
size_t getNumberOfNames() const;
|
||||
|
||||
/// Returns the status of the object.
|
||||
/// If the object has not been loaded yet then the function returns Status::NOT_LOADED.
|
||||
/// If the specified name isn't found in the configuration then the function returns Status::NOT_EXIST.
|
||||
@ -132,6 +129,9 @@ public:
|
||||
Loadables getCurrentlyLoadedObjects(const FilterByNameFunction & filter_by_name) const;
|
||||
size_t getNumberOfCurrentlyLoadedObjects() const;
|
||||
|
||||
/// Returns true if any object was loaded.
|
||||
bool hasCurrentlyLoadedObjects() const;
|
||||
|
||||
static constexpr Duration NO_TIMEOUT = Duration::max();
|
||||
|
||||
/// Starts loading of a specified object.
|
||||
|
@ -30,5 +30,5 @@ CREATE DATABASE test_DatabaseDictionary ENGINE = Dictionary;
|
||||
|
||||
SELECT sum(ignore(*, metadata_modification_time, engine_full, create_table_query)) FROM system.tables;
|
||||
|
||||
DROP DATABASE test_DatabaseDictionary; -- { serverError 48 }
|
||||
DROP DATABASE test_DatabaseDictionary;
|
||||
DROP DATABASE test_DatabaseMemory;
|
||||
|
Loading…
Reference in New Issue
Block a user