Skip to content

Commit

Permalink
HDFS-11908: libhdfs++: Authentication failure when first NN of a kerb…
Browse files Browse the repository at this point in the history
…erized HA cluster is standby. Contributed by James Clampffer
  • Loading branch information
James Clampffer committed Mar 22, 2018
1 parent e64ba87 commit 23afd50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class RpcConnection : public std::enable_shared_from_this<RpcConnection> {

void SetEventHandlers(std::shared_ptr<LibhdfsEvents> event_handlers);
void SetClusterName(std::string cluster_name);
void SetAuthInfo(const AuthInfo& auth_info);

LockFreeRpcEngine *engine() { return engine_; }
::asio::io_service &io_service();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ void RpcConnection::SetClusterName(std::string cluster_name) {
cluster_name_ = cluster_name;
}

void RpcConnection::SetAuthInfo(const AuthInfo& auth_info) {
std::lock_guard<std::mutex> state_lock(connection_state_lock_);
auth_info_ = auth_info;
}

void RpcConnection::CommsError(const Status &status) {
assert(lock_held(connection_state_lock_)); // Must be holding lock before calling
LOG_DEBUG(kRPC, << "RpcConnection::CommsError called");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ std::shared_ptr<RpcConnection> RpcEngine::NewConnection()

std::shared_ptr<RpcConnection> RpcEngine::InitializeConnection()
{
std::shared_ptr<RpcConnection> result = NewConnection();
result->SetEventHandlers(event_handlers_);
result->SetClusterName(cluster_name_);
return result;
std::shared_ptr<RpcConnection> newConn = NewConnection();
newConn->SetEventHandlers(event_handlers_);
newConn->SetClusterName(cluster_name_);
newConn->SetAuthInfo(auth_info_);

return newConn;
}

void RpcEngine::AsyncRpcCommsError(
Expand Down

0 comments on commit 23afd50

Please sign in to comment.