mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
fix
This commit is contained in:
parent
59c0f4c652
commit
9f954ece81
@ -202,8 +202,7 @@ LoadTaskPtr DatabaseOrdinary::startupTableAsync(
|
||||
fmt::format("startup table {}", name.getFullName()),
|
||||
[this, name] (AsyncLoader &, const LoadJobPtr &)
|
||||
{
|
||||
// `DatabaseOnDisk::tryGetTable()` is used to avoid waiting for a startup
|
||||
if (auto table = DatabaseOnDisk::tryGetTable(name.table, {}))
|
||||
if (auto table = tryGetTableNoWait(name.table))
|
||||
{
|
||||
/// Since startup() method can use physical paths on disk we don't allow any exclusive actions (rename, drop so on)
|
||||
/// until startup finished.
|
||||
|
@ -200,11 +200,7 @@ bool DatabaseWithOwnTablesBase::isTableExist(const String & table_name, ContextP
|
||||
StoragePtr DatabaseWithOwnTablesBase::tryGetTable(const String & table_name, ContextPtr) const
|
||||
{
|
||||
waitTableStarted(table_name);
|
||||
std::lock_guard lock(mutex);
|
||||
auto it = tables.find(table_name);
|
||||
if (it != tables.end())
|
||||
return it->second;
|
||||
return {};
|
||||
return tryGetTableNoWait(table_name);
|
||||
}
|
||||
|
||||
DatabaseTablesIteratorPtr DatabaseWithOwnTablesBase::getTablesIterator(ContextPtr, const FilterByNameFunction & filter_by_table_name) const
|
||||
@ -376,4 +372,13 @@ void DatabaseWithOwnTablesBase::createTableRestoredFromBackup(const ASTPtr & cre
|
||||
interpreter.execute();
|
||||
}
|
||||
|
||||
StoragePtr DatabaseWithOwnTablesBase::tryGetTableNoWait(const String & table_name) const
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
auto it = tables.find(table_name);
|
||||
if (it != tables.end())
|
||||
return it->second;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ protected:
|
||||
void attachTableUnlocked(const String & table_name, const StoragePtr & table) TSA_REQUIRES(mutex);
|
||||
StoragePtr detachTableUnlocked(const String & table_name) TSA_REQUIRES(mutex);
|
||||
StoragePtr getTableUnlocked(const String & table_name) const TSA_REQUIRES(mutex);
|
||||
StoragePtr tryGetTableNoWait(const String & table_name) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user