mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #1847 from yandex/CLICKHOUSE-3558
Add system_profile setting
This commit is contained in:
commit
20686ab405
@ -117,6 +117,7 @@ struct ContextShared
|
||||
mutable std::shared_ptr<ExternalDictionaries> external_dictionaries;
|
||||
mutable std::shared_ptr<ExternalModels> external_models;
|
||||
String default_profile_name; /// Default profile name used for default values.
|
||||
String system_profile_name; /// Profile used by system processes
|
||||
std::shared_ptr<ISecurityManager> security_manager; /// Known users.
|
||||
Quotas quotas; /// Known quotas for resource use.
|
||||
mutable UncompressedCachePtr uncompressed_cache; /// The cache of decompressed blocks.
|
||||
@ -1593,15 +1594,21 @@ void Context::setApplicationType(ApplicationType type)
|
||||
shared->application_type = type;
|
||||
}
|
||||
|
||||
void Context::setDefaultProfiles(const Poco::Util::AbstractConfiguration & config)
|
||||
{
|
||||
shared->default_profile_name = config.getString("default_profile", "default");
|
||||
shared->system_profile_name = config.getString("system_profile", shared->default_profile_name);
|
||||
setSetting("profile", shared->system_profile_name);
|
||||
}
|
||||
|
||||
String Context::getDefaultProfileName() const
|
||||
{
|
||||
return shared->default_profile_name;
|
||||
}
|
||||
|
||||
void Context::setDefaultProfileName(const String & name)
|
||||
String Context::getSystemProfileName() const
|
||||
{
|
||||
shared->default_profile_name = name;
|
||||
return shared->system_profile_name;
|
||||
}
|
||||
|
||||
String Context::getFormatSchemaPath() const
|
||||
|
@ -353,9 +353,10 @@ public:
|
||||
ApplicationType getApplicationType() const;
|
||||
void setApplicationType(ApplicationType type);
|
||||
|
||||
/// Set once
|
||||
/// Sets default_profile and system_profile, must be called once during the initialization
|
||||
void setDefaultProfiles(const Poco::Util::AbstractConfiguration & config);
|
||||
String getDefaultProfileName() const;
|
||||
void setDefaultProfileName(const String & name);
|
||||
String getSystemProfileName() const;
|
||||
|
||||
/// Base path for format schemas
|
||||
String getFormatSchemaPath() const;
|
||||
|
@ -227,6 +227,15 @@ DDLWorker::DDLWorker(const std::string & zk_root_dir, Context & context_, const
|
||||
task_max_lifetime = config->getUInt64(prefix + ".task_max_lifetime", static_cast<UInt64>(task_max_lifetime));
|
||||
cleanup_delay_period = config->getUInt64(prefix + ".cleanup_delay_period", static_cast<UInt64>(cleanup_delay_period));
|
||||
max_tasks_in_queue = std::max(static_cast<UInt64>(1), config->getUInt64(prefix + ".max_tasks_in_queue", max_tasks_in_queue));
|
||||
|
||||
if (config->has(prefix + ".profile"))
|
||||
context.setSetting("profile", config->getString(prefix + ".profile"));
|
||||
}
|
||||
|
||||
if (context.getSettingsRef().limits.readonly)
|
||||
{
|
||||
LOG_WARNING(log, "Distributed DDL worker is run with readonly settings, it will not be able to execute DDL queries"
|
||||
<< " Set apropriate system_profile or distributed_ddl.profile to fix this.");
|
||||
}
|
||||
|
||||
host_fqdn = getFQDNOrHostName();
|
||||
|
@ -312,10 +312,8 @@ try
|
||||
if (mark_cache_size)
|
||||
context->setMarkCache(mark_cache_size);
|
||||
|
||||
/// Load global settings from default profile.
|
||||
String default_profile_name = config().getString("default_profile", "default");
|
||||
context->setDefaultProfileName(default_profile_name);
|
||||
context->setSetting("profile", default_profile_name);
|
||||
/// Load global settings from default_profile and system_profile.
|
||||
context->setDefaultProfiles(config());
|
||||
|
||||
/** Init dummy default DB
|
||||
* NOTE: We force using isolated default database to avoid conflicts with default database from server enviroment
|
||||
|
@ -256,11 +256,9 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
if (uncompressed_cache_size)
|
||||
global_context->setUncompressedCache(uncompressed_cache_size);
|
||||
|
||||
/// Load global settings from default profile.
|
||||
/// Load global settings from default_profile and system_profile.
|
||||
global_context->setDefaultProfiles(config());
|
||||
Settings & settings = global_context->getSettingsRef();
|
||||
String default_profile_name = config().getString("default_profile", "default");
|
||||
global_context->setDefaultProfileName(default_profile_name);
|
||||
global_context->setSetting("profile", default_profile_name);
|
||||
|
||||
/// Size of cache for marks (index of MergeTree family of tables). It is necessary.
|
||||
size_t mark_cache_size = config().getUInt64("mark_cache_size");
|
||||
|
@ -105,9 +105,12 @@
|
||||
<!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->
|
||||
<users_config>users.xml</users_config>
|
||||
|
||||
<!-- Default profile of settings.. -->
|
||||
<!-- Default profile of settings. -->
|
||||
<default_profile>default</default_profile>
|
||||
|
||||
<!-- System profile of settings. This settings are used by internal processes (Buffer storage, Distibuted DDL worker and so on). -->
|
||||
<!-- <system_profile>default</system_profile> -->
|
||||
|
||||
<!-- Default database. -->
|
||||
<default_database>default</default_database>
|
||||
|
||||
@ -275,6 +278,9 @@
|
||||
<distributed_ddl>
|
||||
<!-- Path in ZooKeeper to queue with DDL queries -->
|
||||
<path>/clickhouse/task_queue/ddl</path>
|
||||
|
||||
<!-- Settings from this profile will be used to execute DDL queries -->
|
||||
<!-- <profile>default</profile> -->
|
||||
</distributed_ddl>
|
||||
|
||||
<!-- Settings to fine tune MergeTree tables. See documentation in source code, in MergeTreeSettings.h -->
|
||||
|
@ -338,6 +338,12 @@ BlockOutputStreamPtr StorageBuffer::write(const ASTPtr & /*query*/, const Settin
|
||||
|
||||
void StorageBuffer::startup()
|
||||
{
|
||||
if (context.getSettingsRef().limits.readonly)
|
||||
{
|
||||
LOG_WARNING(log, "Storage " << getName() << " is run with readonly settings, it will not be able to insert data."
|
||||
<< " Set apropriate system_profile to fix this.");
|
||||
}
|
||||
|
||||
flush_thread = std::thread(&StorageBuffer::flushThread, this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user