mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Merge branch 'nikvas0/lazy_db' of https://github.com/nikvas0/ClickHouse into nikvas0/lazy_db
This commit is contained in:
commit
21b2b20729
@ -18,7 +18,7 @@ namespace detail
|
||||
ASTPtr getCreateQueryFromMetadata(const String & metadata_path, const String & database, bool throw_on_error);
|
||||
}
|
||||
|
||||
/* Class to provide basic operations with tables stored on disk.
|
||||
/* Class to provide basic operations with tables when metadata is stored on disk in .sql files.
|
||||
*/
|
||||
class DatabaseOnDisk
|
||||
{
|
||||
|
@ -264,7 +264,11 @@ BlockInputStreams StorageSystemColumns::read(
|
||||
MutableColumnPtr database_column_mut = ColumnString::create();
|
||||
for (const auto & database : databases)
|
||||
{
|
||||
if (context.hasDatabaseAccessRights(database.first) && database.second->getEngineName() != "Lazy")
|
||||
/// We are skipping "Lazy" database because we cannot afford initialization of all its tables.
|
||||
/// This should be documented.
|
||||
|
||||
if (context.hasDatabaseAccessRights(database.first)
|
||||
&& database.second->getEngineName() != "Lazy")
|
||||
database_column_mut->insert(database.first);
|
||||
}
|
||||
|
||||
|
@ -61,13 +61,15 @@ static ColumnPtr getFilteredDatabases(const ASTPtr & query, const Context & cont
|
||||
return block.getByPosition(0).column;
|
||||
}
|
||||
|
||||
static bool needLockStructure(const DatabasePtr& database, const Block& header)
|
||||
/// Avoid heavy operation on tables if we only queried columns that we can get without table object.
|
||||
/// Otherwise it will require table initialization for Lazy database.
|
||||
static bool needLockStructure(const DatabasePtr & database, const Block & header)
|
||||
{
|
||||
if (database->getEngineName() != "Lazy")
|
||||
return true;
|
||||
|
||||
static const std::set<std::string> columns_without_lock = { "database", "name", "metadata_modification_time" };
|
||||
for (const auto& column : header.getColumnsWithTypeAndName())
|
||||
for (const auto & column : header.getColumnsWithTypeAndName())
|
||||
{
|
||||
if (columns_without_lock.find(column.name) == columns_without_lock.end())
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user