Merge branch 'master' of github.com:yandex/ClickHouse

This commit is contained in:
Alexey Milovidov 2018-04-17 00:04:36 +03:00
commit 798bee18a7
3 changed files with 5 additions and 2 deletions

View File

@ -47,6 +47,8 @@ public:
String current_user;
String current_query_id;
Poco::Net::SocketAddress current_address;
/// Use current user and password when sending query to replica leader
String current_password;
/// When query_kind == INITIAL_QUERY, these values are equal to current.
String initial_user;

View File

@ -564,6 +564,7 @@ void Context::setUser(const String & name, const String & password, const Poco::
client_info.current_user = name;
client_info.current_address = address;
client_info.current_password = password;
if (!quota_key.empty())
client_info.quota_key = quota_key;

View File

@ -3270,14 +3270,14 @@ void StorageReplicatedMergeTree::sendRequestToLeaderReplica(const ASTPtr & query
else
throw Exception("Can't proxy this query. Unsupported query type", ErrorCodes::NOT_IMPLEMENTED);
/// NOTE Works only if there is access from the default user without a password. You can fix it by adding a parameter to the server config.
/// Query send with current user credentials
auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithoutFailover(context.getSettingsRef());
Connection connection(
leader_address.host,
leader_address.queries_port,
leader_address.database,
"", "", timeouts, "ClickHouse replica");
context.getClientInfo().current_user, context.getClientInfo().current_password, timeouts, "ClickHouse replica");
RemoteBlockInputStream stream(connection, formattedAST(new_query), {}, context, &settings);
NullBlockOutputStream output({});