mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Simplify settings overrides or clickhouse-local
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
a7b14f87e0
commit
59f11863d7
@ -71,6 +71,15 @@ namespace ErrorCodes
|
|||||||
extern const int FILE_ALREADY_EXISTS;
|
extern const int FILE_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void applySettingsOverridesForLocal(ContextMutablePtr context)
|
||||||
|
{
|
||||||
|
Settings settings = context->getSettings();
|
||||||
|
|
||||||
|
settings.allow_introspection_functions = true;
|
||||||
|
settings.storage_file_read_method = LocalFSReadMethod::mmap;
|
||||||
|
|
||||||
|
context->setSettings(settings);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalServer::processError(const String &) const
|
void LocalServer::processError(const String &) const
|
||||||
{
|
{
|
||||||
@ -657,6 +666,12 @@ void LocalServer::processConfig()
|
|||||||
CompiledExpressionCacheFactory::instance().init(compiled_expression_cache_size, compiled_expression_cache_elements_size);
|
CompiledExpressionCacheFactory::instance().init(compiled_expression_cache_size, compiled_expression_cache_elements_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// NOTE: it is important to apply any overrides before
|
||||||
|
/// setDefaultProfiles() calls since it will copy current context (i.e.
|
||||||
|
/// there is separate context for Buffer tables).
|
||||||
|
applySettingsOverridesForLocal(global_context);
|
||||||
|
applyCmdOptions(global_context);
|
||||||
|
|
||||||
/// Load global settings from default_profile and system_profile.
|
/// Load global settings from default_profile and system_profile.
|
||||||
global_context->setDefaultProfiles(config());
|
global_context->setDefaultProfiles(config());
|
||||||
|
|
||||||
@ -671,7 +686,6 @@ void LocalServer::processConfig()
|
|||||||
std::string default_database = config().getString("default_database", "_local");
|
std::string default_database = config().getString("default_database", "_local");
|
||||||
DatabaseCatalog::instance().attachDatabase(default_database, std::make_shared<DatabaseMemory>(default_database, global_context));
|
DatabaseCatalog::instance().attachDatabase(default_database, std::make_shared<DatabaseMemory>(default_database, global_context));
|
||||||
global_context->setCurrentDatabase(default_database);
|
global_context->setCurrentDatabase(default_database);
|
||||||
applyCmdOptions(global_context);
|
|
||||||
|
|
||||||
if (config().has("path"))
|
if (config().has("path"))
|
||||||
{
|
{
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#include <Core/SettingsOverridesLocal.h>
|
|
||||||
#include <Core/Settings.h>
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
|
|
||||||
void applySettingsOverridesForLocal(Settings & settings)
|
|
||||||
{
|
|
||||||
settings.allow_introspection_functions = true;
|
|
||||||
settings.storage_file_read_method = LocalFSReadMethod::mmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
|
|
||||||
struct Settings;
|
|
||||||
|
|
||||||
/// Update some settings defaults for clickhouse-local
|
|
||||||
void applySettingsOverridesForLocal(Settings & settings);
|
|
||||||
|
|
||||||
}
|
|
@ -48,7 +48,6 @@
|
|||||||
#include <Interpreters/PreparedSets.h>
|
#include <Interpreters/PreparedSets.h>
|
||||||
#include <Core/Settings.h>
|
#include <Core/Settings.h>
|
||||||
#include <Core/SettingsQuirks.h>
|
#include <Core/SettingsQuirks.h>
|
||||||
#include <Core/SettingsOverridesLocal.h>
|
|
||||||
#include <Access/AccessControl.h>
|
#include <Access/AccessControl.h>
|
||||||
#include <Access/ContextAccess.h>
|
#include <Access/ContextAccess.h>
|
||||||
#include <Access/EnabledRolesInfo.h>
|
#include <Access/EnabledRolesInfo.h>
|
||||||
@ -3647,8 +3646,6 @@ void Context::setDefaultProfiles(const Poco::Util::AbstractConfiguration & confi
|
|||||||
setCurrentProfile(shared->system_profile_name);
|
setCurrentProfile(shared->system_profile_name);
|
||||||
|
|
||||||
applySettingsQuirks(settings, &Poco::Logger::get("SettingsQuirks"));
|
applySettingsQuirks(settings, &Poco::Logger::get("SettingsQuirks"));
|
||||||
if (shared->application_type == ApplicationType::LOCAL)
|
|
||||||
applySettingsOverridesForLocal(settings);
|
|
||||||
|
|
||||||
shared->buffer_profile_name = config.getString("buffer_profile", shared->system_profile_name);
|
shared->buffer_profile_name = config.getString("buffer_profile", shared->system_profile_name);
|
||||||
buffer_context = Context::createCopy(shared_from_this());
|
buffer_context = Context::createCopy(shared_from_this());
|
||||||
|
Loading…
Reference in New Issue
Block a user