apply some comments

This commit is contained in:
Konstantin Morozov 2024-07-02 14:58:04 +00:00
parent 51d293beb9
commit f76bd8ed77
6 changed files with 12 additions and 30 deletions

View File

@ -437,12 +437,6 @@ DatabaseAtomic::getTablesIterator(ContextPtr local_context, const IDatabase::Fil
return std::make_unique<AtomicDatabaseTablesSnapshotIterator>(std::move(typeid_cast<DatabaseTablesSnapshotIterator &>(*base_iter)));
}
DatabaseDetachedTablesSnapshotIteratorPtr DatabaseAtomic::getDetachedTablesIterator(
ContextPtr local_context, const IDatabase::FilterByNameFunction & filter_by_table_name, const bool skip_not_loaded) const
{
return DatabaseOrdinary::getDetachedTablesIterator(local_context, filter_by_table_name, skip_not_loaded);
}
UUID DatabaseAtomic::tryGetTableUUID(const String & table_name) const
{
if (auto table = tryGetTable(table_name, getContext()))

View File

@ -49,9 +49,6 @@ public:
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name, bool skip_not_loaded) const override;
DatabaseDetachedTablesSnapshotIteratorPtr
getDetachedTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name, bool skip_not_loaded) const override;
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
LoadTaskPtr startupDatabaseAsync(AsyncLoader & async_loader, LoadJobSet startup_after, LoadingStrictnessLevel mode) override;

View File

@ -22,8 +22,8 @@
#include <Storages/IStorage.h>
#include <Storages/StorageFactory.h>
#include <TableFunctions/TableFunctionFactory.h>
#include "Common/Exception.h"
#include <Common/CurrentMetrics.h>
#include <Common/Exception.h>
#include <Common/assert_cast.h>
#include <Common/escapeForFileName.h>
#include <Common/filesystemHelpers.h>
@ -310,11 +310,14 @@ void DatabaseOnDisk::detachTablePermanently(ContextPtr query_context, const Stri
FS::createFile(detached_permanently_flag);
std::lock_guard lock(mutex);
if (!snapshot_detached_tables.contains(table_name))
if (const auto it = snapshot_detached_tables.find(table_name); it == snapshot_detached_tables.end())
{
throw Exception(ErrorCodes::LOGICAL_ERROR, "Snapshot doesn't contain info about detached table={}", table_name);
}
snapshot_detached_tables[table_name].is_permanently = true;
else
{
it->second.is_permanently = true;
}
}
catch (Exception & e)
{

View File

@ -1,14 +1,14 @@
#include <numeric>
#include <Databases/TablesLoader.h>
#include <Databases/IDatabase.h>
#include <Databases/DDLDependencyVisitor.h>
#include <Databases/DDLLoadingDependencyVisitor.h>
#include <Databases/IDatabase.h>
#include <Databases/TablesLoader.h>
#include <Interpreters/Context.h>
#include <Interpreters/DatabaseCatalog.h>
#include <Interpreters/Context.h>
#include <Interpreters/ExternalDictionariesLoader.h>
#include <Poco/Util/AbstractConfiguration.h>
#include <Common/CurrentMetrics.h>
#include <Common/logger_useful.h>
#include <Common/CurrentMetrics.h>
#include <numeric>
namespace DB

View File

@ -50,18 +50,6 @@ bool needTable(const DatabasePtr & database, const Block & header)
}
return false;
}
template <typename T>
void fillColumns(T table_it, MutableColumnPtr & database_column, MutableColumnPtr & engine_column)
{
for (; table_it->isValid(); table_it->next())
{
database_column->insert(table_it->name());
if (engine_column)
engine_column->insert(table_it->table()->getName());
}
}
}
namespace detail

View File

@ -2,7 +2,7 @@
SELECT 'database atomic tests';
DROP DATABASE IF EXISTS test03172_system_detached_tables;
CREATE DATABASE IF NOT EXISTS test03172_system_detached_tables;
CREATE DATABASE IF NOT EXISTS test03172_system_detached_tables ENGINE=Atomic;
CREATE TABLE test03172_system_detached_tables.test_table (n Int64) ENGINE=MergeTree ORDER BY n;
SELECT * FROM system.detached_tables WHERE database='test03172_system_detached_tables';