Revert "Remove "current_password" because it is harmful"

This reverts commit 66ccb2f6b1.
This commit is contained in:
Alexey Milovidov 2020-06-15 05:13:41 +03:00
parent 5866401f60
commit bbe5f4c909
4 changed files with 4 additions and 3 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

@ -660,6 +660,7 @@ void Context::setUser(const String & name, const String & password, const Poco::
auto lock = getLock();
client_info.current_user = name;
client_info.current_password = password;
client_info.current_address = address;
auto new_user_id = getAccessControlManager().find<User>(name);

View File

@ -4416,7 +4416,7 @@ void StorageReplicatedMergeTree::sendRequestToLeaderReplica(const ASTPtr & query
const auto & query_settings = query_context.getSettingsRef();
const auto & query_client_info = query_context.getClientInfo();
String user = query_client_info.current_user;
String password;
String password = query_client_info.current_password;
if (auto address = findClusterAddress(leader_address); address)
{

View File

@ -222,7 +222,6 @@ private:
zkutil::EphemeralNodeHolderPtr replica_is_active_node;
/** Is this replica "leading". The leader replica selects the parts to merge.
* It can be false only when old ClickHouse versions are working on the same cluster, because now we allow multiple leaders.
*/
std::atomic<bool> is_leader {false};
zkutil::LeaderElectionPtr leader_election;
@ -498,7 +497,6 @@ private:
bool waitForReplicaToProcessLogEntry(const String & replica_name, const ReplicatedMergeTreeLogEntryData & entry, bool wait_for_non_active = true);
/// Choose leader replica, send requst to it and wait.
/// Only makes sense when old ClickHouse versions are working on the same cluster, because now we allow multiple leaders.
void sendRequestToLeaderReplica(const ASTPtr & query, const Context & query_context);
/// Throw an exception if the table is readonly.