mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Add separate constants for interface LOCAL and TCP_INTERSERVER.
This commit is contained in:
parent
c257cd61e5
commit
3ab1177d7e
@ -376,8 +376,8 @@ void LocalServer::processQueries()
|
|||||||
throw Exception("Cannot parse and execute the following part of query: " + String(parse_res.first), ErrorCodes::SYNTAX_ERROR);
|
throw Exception("Cannot parse and execute the following part of query: " + String(parse_res.first), ErrorCodes::SYNTAX_ERROR);
|
||||||
|
|
||||||
/// Authenticate and create a context to execute queries.
|
/// Authenticate and create a context to execute queries.
|
||||||
Session session{global_context, ClientInfo::Interface::TCP};
|
Session session{global_context, ClientInfo::Interface::LOCAL};
|
||||||
session.authenticate("default", "", Poco::Net::SocketAddress{});
|
session.authenticate("default", "", {});
|
||||||
|
|
||||||
/// Use the same context for all queries.
|
/// Use the same context for all queries.
|
||||||
auto context = session.makeQueryContext();
|
auto context = session.makeQueryContext();
|
||||||
|
@ -256,8 +256,8 @@ void registerDictionarySourceClickHouse(DictionarySourceFactory & factory)
|
|||||||
if (configuration.is_local)
|
if (configuration.is_local)
|
||||||
{
|
{
|
||||||
/// Start local session in case when the dictionary is loaded in-process (without TCP communication).
|
/// Start local session in case when the dictionary is loaded in-process (without TCP communication).
|
||||||
local_session = std::make_shared<Session>(global_context, ClientInfo::Interface::TCP);
|
local_session = std::make_shared<Session>(global_context, ClientInfo::Interface::LOCAL);
|
||||||
local_session->authenticate(configuration.user, configuration.password, Poco::Net::SocketAddress{"127.0.0.1", 0});
|
local_session->authenticate(configuration.user, configuration.password, {});
|
||||||
context = local_session->makeQueryContext();
|
context = local_session->makeQueryContext();
|
||||||
context->applySettingsChanges(readSettingsFromDictionaryConfig(config, config_prefix));
|
context->applySettingsChanges(readSettingsFromDictionaryConfig(config, config_prefix));
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ public:
|
|||||||
GRPC = 3,
|
GRPC = 3,
|
||||||
MYSQL = 4,
|
MYSQL = 4,
|
||||||
POSTGRESQL = 5,
|
POSTGRESQL = 5,
|
||||||
|
LOCAL = 6,
|
||||||
|
TCP_INTERSERVER = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HTTPMethod : uint8_t
|
enum class HTTPMethod : uint8_t
|
||||||
|
@ -261,10 +261,14 @@ void Session::authenticate(const Credentials & credentials_, const Poco::Net::So
|
|||||||
if (session_context)
|
if (session_context)
|
||||||
throw Exception("If there is a session context it must be created after authentication", ErrorCodes::LOGICAL_ERROR);
|
throw Exception("If there is a session context it must be created after authentication", ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
user_id = global_context->getAccessControlManager().login(credentials_, address_.host());
|
auto address = address_;
|
||||||
|
if ((address == Poco::Net::SocketAddress{}) && (prepared_client_info->interface == ClientInfo::Interface::LOCAL))
|
||||||
|
address = Poco::Net::SocketAddress{"127.0.0.1", 0};
|
||||||
|
|
||||||
|
user_id = global_context->getAccessControlManager().login(credentials_, address.host());
|
||||||
|
|
||||||
prepared_client_info->current_user = credentials_.getUserName();
|
prepared_client_info->current_user = credentials_.getUserName();
|
||||||
prepared_client_info->current_address = address_;
|
prepared_client_info->current_address = address;
|
||||||
|
|
||||||
#if defined(ARCADIA_BUILD)
|
#if defined(ARCADIA_BUILD)
|
||||||
/// This is harmful field that is used only in foreign "Arcadia" build.
|
/// This is harmful field that is used only in foreign "Arcadia" build.
|
||||||
|
@ -979,6 +979,7 @@ void TCPHandler::receiveHello()
|
|||||||
is_interserver_mode = (user == USER_INTERSERVER_MARKER);
|
is_interserver_mode = (user == USER_INTERSERVER_MARKER);
|
||||||
if (is_interserver_mode)
|
if (is_interserver_mode)
|
||||||
{
|
{
|
||||||
|
client_info.interface = ClientInfo::Interface::TCP_INTERSERVER;
|
||||||
receiveClusterNameAndSalt();
|
receiveClusterNameAndSalt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user