Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::ResourceBroker Class Reference

#include <resource-broker.h>

Collaboration diagram for impala::ResourceBroker:

Classes

class  AllocatedRequest
 
class  PendingRequest
 

Public Member Functions

 ResourceBroker (const std::vector< TNetworkAddress > &llama_addresses, const TNetworkAddress &llama_callback_address, MetricGroup *metrics)
 
Status Init ()
 
void Close ()
 Closes the llama_client_cache_ and joins the llama_callback_server_. More...
 
Status Reserve (const TResourceBrokerReservationRequest &request, TResourceBrokerReservationResponse *response)
 Requests resources from Llama. Blocks until the request has been granted or denied. More...
 
Status Expand (const TResourceBrokerExpansionRequest &request, TResourceBrokerExpansionResponse *response)
 
void ClearRequests (const TUniqueId &reservation_id, bool include_reservation)
 
Status Release (const TResourceBrokerReleaseRequest &request, TResourceBrokerReleaseResponse *response)
 
void AMNotification (const llama::TLlamaAMNotificationRequest &request, llama::TLlamaAMNotificationResponse &response)
 
void NMNotification (const llama::TLlamaNMNotificationRequest &request, llama::TLlamaNMNotificationResponse &response)
 
const std::vector< std::string > & llama_nodes ()
 
Status RefreshLlamaNodes ()
 Retrieves the nodes known to Llama and stores them in llama_nodes_. More...
 
void set_scheduler (Scheduler *scheduler)
 
bool GetQueryResourceMgr (const TUniqueId &query_id, const TUniqueId &reservation_id, const TNetworkAddress &local_resource_address, QueryResourceMgr **res_mgr)
 
void UnregisterQueryResourceMgr (const TUniqueId &query_id)
 
template<>
void SendLlamaRpc (ClientConnection< llama::LlamaAMServiceClient > *llama_client, const llama::TLlamaAMGetNodesRequest &request, llama::TLlamaAMGetNodesResponse *response)
 
template<>
void SendLlamaRpc (ClientConnection< llama::LlamaAMServiceClient > *llama_client, const llama::TLlamaAMReservationRequest &request, llama::TLlamaAMReservationResponse *response)
 
template<>
void SendLlamaRpc (ClientConnection< llama::LlamaAMServiceClient > *llama_client, const llama::TLlamaAMReservationExpansionRequest &request, llama::TLlamaAMReservationExpansionResponse *response)
 
template<>
void SendLlamaRpc (ClientConnection< llama::LlamaAMServiceClient > *llama_client, const llama::TLlamaAMReleaseRequest &request, llama::TLlamaAMReleaseResponse *response)
 
template<>
Status ReRegisterWithLlama (const llama::TLlamaAMGetNodesRequest &request, llama::TLlamaAMGetNodesResponse *response)
 

Private Types

typedef std::map
< TNetworkAddress,
llama::TAllocatedResource > 
ResourceMap
 
typedef boost::unordered_map
< llama::TUniqueId,
PendingRequest * > 
PendingRequestMap
 
typedef boost::unordered_map
< llama::TUniqueId,
std::vector< AllocatedRequest > > 
AllocatedRequestMap
 
typedef boost::unordered_map
< TUniqueId, std::pair
< int32_t, QueryResourceMgr * > > 
QueryResourceMgrsMap
 

Private Member Functions

bool has_standby_llama ()
 
Status RegisterWithLlama ()
 
template<typename LlamaReqType , typename LlamaRespType >
Status LlamaRpc (LlamaReqType *request, LlamaRespType *response, StatsMetric< double > *rpc_time_metric)
 
template<typename LlamaReqType , typename LlamaRespType >
void SendLlamaRpc (ClientConnection< llama::LlamaAMServiceClient > *llama_client, const LlamaReqType &request, LlamaRespType *response)
 
template<typename LlamaReqType , typename LlamaRespType >
Status ReRegisterWithLlama (const LlamaReqType &request, LlamaRespType *response)
 
bool LlamaHasRestarted (const llama::TStatus &status) const
 Detects Llama restarts from the given return status of a Llama RPC. More...
 
void CreateLlamaReservationRequest (const TResourceBrokerReservationRequest &src, llama::TLlamaAMReservationRequest &dest)
 Creates a Llama reservation request from a resource broker reservation request. More...
 
void CreateLlamaReleaseRequest (const TResourceBrokerReleaseRequest &src, llama::TLlamaAMReleaseRequest &dest)
 Creates a Llama release request from a resource broker release request. More...
 
bool WaitForNotification (int64_t timeout, ResourceMap *resources, bool *timed_out, PendingRequest *reservation)
 

Private Attributes

std::vector< TNetworkAddress > llama_addresses_
 Llama availability group. More...
 
int active_llama_addr_idx_
 
TNetworkAddress llama_callback_address_
 
MetricGroupmetrics_
 
Schedulerscheduler_
 
StringPropertyactive_llama_metric_
 
StringPropertyactive_llama_handle_metric_
 
StatsMetric< double > * reservation_rpc_time_metric_
 
StatsMetric< double > * reservation_response_time_metric_
 
IntCounterreservation_requests_total_metric_
 Total number of reservation requests. More...
 
IntCounterreservation_requests_fulfilled_metric_
 Number of fulfilled reservation requests. More...
 
IntCounterreservation_requests_failed_metric_
 
IntCounterreservation_requests_rejected_metric_
 Number of well-formed reservation requests rejected by the central scheduler. More...
 
IntCounterreservation_requests_timedout_metric_
 
StatsMetric< double > * expansion_rpc_time_metric_
 
StatsMetric< double > * expansion_response_time_metric_
 
IntCounterexpansion_requests_total_metric_
 Total number of expansion requests. More...
 
IntCounterexpansion_requests_fulfilled_metric_
 Number of fulfilled expansion requests. More...
 
IntCounterexpansion_requests_failed_metric_
 
IntCounterexpansion_requests_rejected_metric_
 Number of well-formed expansion requests rejected by the central scheduler. More...
 
IntCounterexpansion_requests_timedout_metric_
 
UIntGaugeallocated_memory_metric_
 Total amount of memory currently allocated by Llama to this node. More...
 
UIntGaugeallocated_vcpus_metric_
 Total number of vcpu cores currently allocated by Llama to this node. More...
 
IntCounterrequests_released_metric_
 Total number of fulfilled reservation requests that have been released. More...
 
boost::uuids::uuid llama_client_id_
 
boost::shared_ptr
< llama::LlamaNotificationServiceIf > 
llama_callback_thrift_iface_
 Thrift API implementation which proxies Llama notifications onto this ResourceBroker. More...
 
boost::scoped_ptr< ThriftServerllama_callback_server_
 
boost::scoped_ptr< ClientCache
< llama::LlamaAMServiceClient > > 
llama_client_cache_
 Cache of Llama client connections. More...
 
boost::mutex llama_registration_lock_
 
llama::TUniqueId llama_handle_
 Handle received from Llama during registration. Set in RegisterWithLlama(). More...
 
std::vector< std::string > llama_nodes_
 List of nodes registered with Llama. Set in RefreshLlamaNodes(). More...
 
boost::mutex pending_requests_lock_
 Protects pending_requests_. More...
 
PendingRequestMap pending_requests_
 
boost::mutex allocated_requests_lock_
 Protectes allocated_requests_. More...
 
AllocatedRequestMap allocated_requests_
 
boost::mutex query_resource_mgrs_lock_
 Protects query_resource_mgrs_. More...
 
QueryResourceMgrsMap query_resource_mgrs_
 

Detailed Description

Mediates resource-reservation requests between Impala and Yarn via the Llama service. The resource broker requests resources via the Llama's thrift interface and exposes a thrift server for the Llama to notify it of granted/denied/preempted resource reservations. The reserve/release API of the resource broker is blocking. The resource broker is configured with a list of Llama addresses that are cycled through for failover. TODO: Implement NM notification service.

Definition at line 44 of file resource-broker.h.

Member Typedef Documentation

typedef boost::unordered_map<llama::TUniqueId, std::vector<AllocatedRequest> > impala::ResourceBroker::AllocatedRequestMap
private

Map from reservation ID to all satisfied requests - reservation and expansion - associated with that reservation. Used only for bookkeeping so that Impala can report on the current resource usage.

Definition at line 377 of file resource-broker.h.

typedef boost::unordered_map<llama::TUniqueId, PendingRequest*> impala::ResourceBroker::PendingRequestMap
private

Map from unique request ID provided to Llama (for both reservation and expansion requests) to PendingRequest object used to coordinate when a response is received from Llama.

Definition at line 339 of file resource-broker.h.

typedef boost::unordered_map<TUniqueId, std::pair<int32_t, QueryResourceMgr*> > impala::ResourceBroker::QueryResourceMgrsMap
private

Definition at line 383 of file resource-broker.h.

typedef std::map<TNetworkAddress, llama::TAllocatedResource> impala::ResourceBroker::ResourceMap
private

Definition at line 111 of file resource-broker.h.

Constructor & Destructor Documentation

Member Function Documentation

void impala::ResourceBroker::AMNotification ( const llama::TLlamaAMNotificationRequest &  request,
llama::TLlamaAMNotificationResponse &  response 
)

Handles asynchronous Llama Application Master (AM) notifications including granted/denied/preempted reservations and resources.

Definition at line 691 of file resource-broker.cc.

References impala::Scheduler::HandlePreemptedReservation(), impala::Scheduler::HandlePreemptedResource(), llama_handle_, llama_registration_lock_, impala::OK, pending_requests_, pending_requests_lock_, scheduler_, VLOG_QUERY, and VLOG_RPC.

void impala::ResourceBroker::ClearRequests ( const TUniqueId &  reservation_id,
bool  include_reservation 
)

Removes the record of all resource requests associated with this reservationID (except the reservation request itself, if include_reservation is false) so that the per-node accounting is correct when plan fragments finish. Does not communicate this to Llama (i.e. only updates the local node's accounting), so the coordinator should always call Release() to make sure that Llama knows the resources have gone.

Definition at line 636 of file resource-broker.cc.

References allocated_memory_metric_, allocated_requests_, allocated_requests_lock_, allocated_vcpus_metric_, impala::PrettyPrinter::Print(), and VLOG_QUERY.

Referenced by Release(), and impala::QueryResourceMgr::Shutdown().

void impala::ResourceBroker::Close ( )

Closes the llama_client_cache_ and joins the llama_callback_server_.

Definition at line 302 of file resource-broker.cc.

References llama_addresses_, llama_callback_server_, and llama_client_cache_.

void impala::ResourceBroker::CreateLlamaReleaseRequest ( const TResourceBrokerReleaseRequest &  src,
llama::TLlamaAMReleaseRequest &  dest 
)
private

Creates a Llama release request from a resource broker release request.

Definition at line 328 of file resource-broker.cc.

References llama_handle_.

Referenced by Release().

void impala::ResourceBroker::CreateLlamaReservationRequest ( const TResourceBrokerReservationRequest &  src,
llama::TLlamaAMReservationRequest &  dest 
)
private

Creates a Llama reservation request from a resource broker reservation request.

Definition at line 310 of file resource-broker.cc.

References llama_handle_, and impala::UUIDToTUniqueId().

Referenced by Reserve().

bool impala::ResourceBroker::GetQueryResourceMgr ( const TUniqueId &  query_id,
const TUniqueId &  reservation_id,
const TNetworkAddress &  local_resource_address,
QueryResourceMgr **  res_mgr 
)

Retrieves or creates a new QueryResourceMgr for the given query ID. Returns true if this is the first 'checkout' of this QueryResourceMgr, false otherwise. The other parameters are passed to the QueryResourceMgr constructor.

Definition at line 779 of file resource-broker.cc.

References impala::query_id(), query_resource_mgrs_, and query_resource_mgrs_lock_.

Referenced by impala::PlanFragmentExecutor::Prepare().

bool impala::ResourceBroker::has_standby_llama ( )
inlineprivate

Definition at line 113 of file resource-broker.h.

References llama_addresses_.

Status impala::ResourceBroker::Init ( )

Register this resource broker with LLama and starts the Llama callback service. Returns a non-OK status if the callback service failed to start (e.g., port in use) or if registration with the Llama failed (e.g., connection to Llama failed).

Definition at line 182 of file resource-broker.cc.

References llama_addresses_, llama_callback_address_, llama_callback_server_, llama_callback_thrift_iface_, llama_client_id_, metrics_, impala::Status::OK, RefreshLlamaNodes(), RegisterWithLlama(), RETURN_IF_ERROR, and scheduler_.

const std::vector<std::string>& impala::ResourceBroker::llama_nodes ( )
inline

Definition at line 91 of file resource-broker.h.

References llama_nodes_.

Referenced by impala::ResourceResolver::CreateLocalLlamaNodeMapping().

bool impala::ResourceBroker::LlamaHasRestarted ( const llama::TStatus &  status) const
private

Detects Llama restarts from the given return status of a Llama RPC.

Definition at line 286 of file resource-broker.cc.

References impala::LLAMA_RESTART_SEARCH_STRING, and impala::OK.

Referenced by LlamaRpc().

template<typename LlamaReqType , typename LlamaRespType >
Status impala::ResourceBroker::LlamaRpc ( LlamaReqType *  request,
LlamaRespType *  response,
StatsMetric< double > *  rpc_time_metric 
)
private

Issues the Llama RPC corresponding to the LlamaReqType and LlamaRespType. This function encapsulates the complex connect/rpc/retry logic for all Llama RPCs except Register(). If rpc_time_metric is non-NULL, the metric is updated upon success of the RPC. Returns a non-OK status if the RPC failed due to connectivity issues with the Llama. Returns OK if the RPC succeeded.

Definition at line 336 of file resource-broker.cc.

References active_llama_addr_idx_, impala::MonotonicStopWatch::ElapsedTime(), llama_addresses_, llama_client_cache_, llama_handle_, LlamaHasRestarted(), impala::Status::OK, impala::Status::ok(), ReRegisterWithLlama(), RETURN_IF_ERROR, SendLlamaRpc(), impala::MonotonicStopWatch::Start(), impala::StatsMetric< T >::Update(), and VLOG_RPC.

Referenced by Expand(), RefreshLlamaNodes(), Release(), and Reserve().

void impala::ResourceBroker::NMNotification ( const llama::TLlamaNMNotificationRequest &  request,
llama::TLlamaNMNotificationResponse &  response 
)

Handles asynchronous notifications from the Llama Node Manager (NM) auxiliary service, in particular, incoming Yarn container allocations that are going to claim resources. TODO: Implement once NM service is fully functional.

Definition at line 762 of file resource-broker.cc.

Status impala::ResourceBroker::RefreshLlamaNodes ( )

Retrieves the nodes known to Llama and stores them in llama_nodes_.

Definition at line 766 of file resource-broker.cc.

References llama_handle_, llama_nodes_, LlamaRpc(), llama::LlamaStatusToImpalaStatus(), impala::Status::OK, and RETURN_IF_ERROR.

Referenced by Init(), and ReRegisterWithLlama().

Status impala::ResourceBroker::RegisterWithLlama ( )
private

Registers this resource broker with the Llama. Cycles through the list of Llama addresses to find the active Llama which is accepting requests (if any). Returns a non-OK status if registration with any of the Llama's did not succeed within FLAGS_llama_registration_timeout_s seconds. Registration with the Llama is idempotent with respect to the llama_client_id_ (see comment on llama_client_id_ for details).

Definition at line 204 of file resource-broker.cc.

References active_llama_addr_idx_, active_llama_handle_metric_, active_llama_metric_, impala::Status::GetDetail(), llama_addresses_, llama_callback_address_, llama_client_cache_, llama_client_id_, llama_handle_, llama_registration_lock_, llama::LlamaStatusToImpalaStatus(), impala::MonotonicSeconds(), impala::Status::OK, impala::Status::ok(), RETURN_IF_ERROR, impala::SleepForMs(), and impala::UUIDToTUniqueId().

Referenced by Init(), and ReRegisterWithLlama().

Status impala::ResourceBroker::Release ( const TResourceBrokerReleaseRequest &  request,
TResourceBrokerReleaseResponse *  response 
)

Releases resources acquired from Llama for this reservation and all associated expansion requests across all nodes. Should therefore only be called once per query.

Definition at line 666 of file resource-broker.cc.

References allocated_requests_, allocated_requests_lock_, ClearRequests(), CreateLlamaReleaseRequest(), LlamaRpc(), llama::LlamaStatusToImpalaStatus(), impala::Status::OK, requests_released_metric_, reservation_rpc_time_metric_, RETURN_IF_ERROR, and VLOG_QUERY.

template<typename LlamaReqType , typename LlamaRespType >
Status impala::ResourceBroker::ReRegisterWithLlama ( const LlamaReqType &  request,
LlamaRespType *  response 
)
private

Re-registers with Llama to recover from the Llama being unreachable. Handles both Llama restart and failover. This function is a template to allow specialization on the Llama request/response type.

Definition at line 438 of file resource-broker.cc.

References RefreshLlamaNodes(), RegisterWithLlama(), and RETURN_IF_ERROR.

Referenced by LlamaRpc().

template<>
Status impala::ResourceBroker::ReRegisterWithLlama ( const llama::TLlamaAMGetNodesRequest &  request,
llama::TLlamaAMGetNodesResponse *  response 
)

Definition at line 445 of file resource-broker.cc.

References RegisterWithLlama().

template<typename LlamaReqType , typename LlamaRespType >
void impala::ResourceBroker::SendLlamaRpc ( ClientConnection< llama::LlamaAMServiceClient > *  llama_client,
const LlamaReqType &  request,
LlamaRespType *  response 
)
private

Sends the given Llama RPC request via the given client. This function must be specialized on the Llama request/response types. Throws a TException.

Definition at line 391 of file resource-broker.cc.

Referenced by LlamaRpc().

template<>
void impala::ResourceBroker::SendLlamaRpc ( ClientConnection< llama::LlamaAMServiceClient > *  llama_client,
const llama::TLlamaAMGetNodesRequest &  request,
llama::TLlamaAMGetNodesResponse *  response 
)

Definition at line 399 of file resource-broker.cc.

template<>
void impala::ResourceBroker::SendLlamaRpc ( ClientConnection< llama::LlamaAMServiceClient > *  llama_client,
const llama::TLlamaAMReservationRequest &  request,
llama::TLlamaAMReservationResponse *  response 
)

Definition at line 409 of file resource-broker.cc.

template<>
void impala::ResourceBroker::SendLlamaRpc ( ClientConnection< llama::LlamaAMServiceClient > *  llama_client,
const llama::TLlamaAMReservationExpansionRequest &  request,
llama::TLlamaAMReservationExpansionResponse *  response 
)

Definition at line 419 of file resource-broker.cc.

template<>
void impala::ResourceBroker::SendLlamaRpc ( ClientConnection< llama::LlamaAMServiceClient > *  llama_client,
const llama::TLlamaAMReleaseRequest &  request,
llama::TLlamaAMReleaseResponse *  response 
)

Definition at line 429 of file resource-broker.cc.

void impala::ResourceBroker::set_scheduler ( Scheduler scheduler)
inline

Definition at line 96 of file resource-broker.h.

References scheduler_.

void impala::ResourceBroker::UnregisterQueryResourceMgr ( const TUniqueId &  query_id)

Decrements the reference count for a particular QueryResourceMgr. If this is the last reference (i.e. the ref count goes to 0), the QueryResourceMgr is deleted. It's an error to call this with a query_id that does not have a registered QueryResourceMgr.

Definition at line 793 of file resource-broker.cc.

References query_resource_mgrs_, and query_resource_mgrs_lock_.

Referenced by impala::PlanFragmentExecutor::~PlanFragmentExecutor().

bool impala::ResourceBroker::WaitForNotification ( int64_t  timeout,
ResourceMap resources,
bool timed_out,
PendingRequest reservation 
)
private

Member Data Documentation

int impala::ResourceBroker::active_llama_addr_idx_
private

Indexes into llama_addresses_ indicating the currently active Llama. Protected by llama_registration_lock_.

Definition at line 168 of file resource-broker.h.

Referenced by LlamaRpc(), and RegisterWithLlama().

StringProperty* impala::ResourceBroker::active_llama_handle_metric_
private

Llama handle received from the active Llama upon registration. Set to "none" while not registered with Llama.

Definition at line 184 of file resource-broker.h.

Referenced by RegisterWithLlama(), and ResourceBroker().

StringProperty* impala::ResourceBroker::active_llama_metric_
private

Address of the active Llama. A Llama is considered active once we have successfully registered with it. Set to "none" while registering with the Llama.

Definition at line 180 of file resource-broker.h.

Referenced by RegisterWithLlama(), and ResourceBroker().

UIntGauge* impala::ResourceBroker::allocated_memory_metric_
private

Total amount of memory currently allocated by Llama to this node.

Definition at line 241 of file resource-broker.h.

Referenced by ClearRequests(), ResourceBroker(), and WaitForNotification().

AllocatedRequestMap impala::ResourceBroker::allocated_requests_
private

Definition at line 378 of file resource-broker.h.

Referenced by ClearRequests(), Release(), and WaitForNotification().

boost::mutex impala::ResourceBroker::allocated_requests_lock_
private

Protectes allocated_requests_.

Definition at line 371 of file resource-broker.h.

Referenced by ClearRequests(), Release(), and WaitForNotification().

UIntGauge* impala::ResourceBroker::allocated_vcpus_metric_
private

Total number of vcpu cores currently allocated by Llama to this node.

Definition at line 244 of file resource-broker.h.

Referenced by ClearRequests(), ResourceBroker(), and WaitForNotification().

IntCounter* impala::ResourceBroker::expansion_requests_failed_metric_
private

Expansion requests that failed due to a malformed request or an internal error in Llama.

Definition at line 231 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

IntCounter* impala::ResourceBroker::expansion_requests_fulfilled_metric_
private

Number of fulfilled expansion requests.

Definition at line 227 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

IntCounter* impala::ResourceBroker::expansion_requests_rejected_metric_
private

Number of well-formed expansion requests rejected by the central scheduler.

Definition at line 234 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

IntCounter* impala::ResourceBroker::expansion_requests_timedout_metric_
private

Number of well-formed expansion requests that did not get fulfilled within the timeout period.

Definition at line 238 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

IntCounter* impala::ResourceBroker::expansion_requests_total_metric_
private

Total number of expansion requests.

Definition at line 224 of file resource-broker.h.

Referenced by ResourceBroker().

StatsMetric<double>* impala::ResourceBroker::expansion_response_time_metric_
private

Accumulated statistics on the time taken to complete an expansion request (granted or denied). The time includes the request RPC to Llama and the time the requesting thread waits on the pending_requests_'s promise. The metric does not include requests that timed out.

Definition at line 221 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

StatsMetric<double>* impala::ResourceBroker::expansion_rpc_time_metric_
private

Accumulated statistics on the time taken to RPC an expansion request and receive an acknowledgement from Llama.

Definition at line 215 of file resource-broker.h.

Referenced by Expand(), and ResourceBroker().

std::vector<TNetworkAddress> impala::ResourceBroker::llama_addresses_
private

Llama availability group.

Definition at line 164 of file resource-broker.h.

Referenced by Close(), has_standby_llama(), Init(), LlamaRpc(), and RegisterWithLlama().

TNetworkAddress impala::ResourceBroker::llama_callback_address_
private

Address of thrift server started in this resource broker to handle Llama notifications.

Definition at line 172 of file resource-broker.h.

Referenced by Init(), and RegisterWithLlama().

boost::scoped_ptr<ThriftServer> impala::ResourceBroker::llama_callback_server_
private

Definition at line 259 of file resource-broker.h.

Referenced by Close(), and Init().

boost::shared_ptr<llama::LlamaNotificationServiceIf> impala::ResourceBroker::llama_callback_thrift_iface_
private

Thrift API implementation which proxies Llama notifications onto this ResourceBroker.

Definition at line 258 of file resource-broker.h.

Referenced by Init().

boost::scoped_ptr<ClientCache<llama::LlamaAMServiceClient> > impala::ResourceBroker::llama_client_cache_
private

Cache of Llama client connections.

Definition at line 262 of file resource-broker.h.

Referenced by Close(), LlamaRpc(), and RegisterWithLlama().

boost::uuids::uuid impala::ResourceBroker::llama_client_id_
private

Client id used to register with Llama. Set in Init(). Used to communicate to Llama whether this Impalad has restarted. Registration with Llama is idempotent if the same llama_client_id_ is passed, i.e., the same Llama handle is returned and resource allocations are preserved. From Llama's perspective an unknown llama_client_id_ indicates a new registration and all resources allocated by this Impalad under a different llama_client_id_ are consider lost and will be released.

Definition at line 255 of file resource-broker.h.

Referenced by Init(), and RegisterWithLlama().

llama::TUniqueId impala::ResourceBroker::llama_handle_
private

Handle received from Llama during registration. Set in RegisterWithLlama().

Definition at line 269 of file resource-broker.h.

Referenced by AMNotification(), CreateLlamaReleaseRequest(), CreateLlamaReservationRequest(), Expand(), LlamaRpc(), RefreshLlamaNodes(), and RegisterWithLlama().

std::vector<std::string> impala::ResourceBroker::llama_nodes_
private

List of nodes registered with Llama. Set in RefreshLlamaNodes().

Definition at line 272 of file resource-broker.h.

Referenced by llama_nodes(), and RefreshLlamaNodes().

boost::mutex impala::ResourceBroker::llama_registration_lock_
private

Lock to ensure that only a single registration with Llama is sent, e.g., when multiple concurrent requests realize that Llama has restarted.

Definition at line 266 of file resource-broker.h.

Referenced by AMNotification(), and RegisterWithLlama().

MetricGroup* impala::ResourceBroker::metrics_
private

Definition at line 174 of file resource-broker.h.

Referenced by Init().

PendingRequestMap impala::ResourceBroker::pending_requests_
private

Definition at line 340 of file resource-broker.h.

Referenced by AMNotification(), Expand(), Reserve(), and WaitForNotification().

boost::mutex impala::ResourceBroker::pending_requests_lock_
private

Protects pending_requests_.

Definition at line 334 of file resource-broker.h.

Referenced by AMNotification(), Expand(), Reserve(), and WaitForNotification().

QueryResourceMgrsMap impala::ResourceBroker::query_resource_mgrs_
private

Map from query ID to a (ref_count, QueryResourceMgr*) pair, i.e. one QueryResourceMgr per query. The refererence count is always non-zero - once it hits zero the entry in the map is removed and the QueryResourceMgr is deleted.

Definition at line 388 of file resource-broker.h.

Referenced by GetQueryResourceMgr(), and UnregisterQueryResourceMgr().

boost::mutex impala::ResourceBroker::query_resource_mgrs_lock_
private

Protects query_resource_mgrs_.

Definition at line 381 of file resource-broker.h.

Referenced by GetQueryResourceMgr(), and UnregisterQueryResourceMgr().

IntCounter* impala::ResourceBroker::requests_released_metric_
private

Total number of fulfilled reservation requests that have been released.

Definition at line 247 of file resource-broker.h.

Referenced by Release(), and ResourceBroker().

IntCounter* impala::ResourceBroker::reservation_requests_failed_metric_
private

Reservation requests that failed due to a malformed request or an internal error in Llama.

Definition at line 204 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

IntCounter* impala::ResourceBroker::reservation_requests_fulfilled_metric_
private

Number of fulfilled reservation requests.

Definition at line 200 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

IntCounter* impala::ResourceBroker::reservation_requests_rejected_metric_
private

Number of well-formed reservation requests rejected by the central scheduler.

Definition at line 207 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

IntCounter* impala::ResourceBroker::reservation_requests_timedout_metric_
private

Number of well-formed reservation requests that did not get fulfilled within the timeout period.

Definition at line 211 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

IntCounter* impala::ResourceBroker::reservation_requests_total_metric_
private

Total number of reservation requests.

Definition at line 197 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

StatsMetric<double>* impala::ResourceBroker::reservation_response_time_metric_
private

Accumulated statistics on the time taken to complete a reservation request (granted or denied). The time includes the request RPC to Llama and the time the requesting thread waits on the pending_requests_'s promise. The metric does not include requests that timed out.

Definition at line 194 of file resource-broker.h.

Referenced by Reserve(), and ResourceBroker().

StatsMetric<double>* impala::ResourceBroker::reservation_rpc_time_metric_
private

Accumulated statistics on the time taken to RPC a reservation request and receive an acknowledgement from Llama.

Definition at line 188 of file resource-broker.h.

Referenced by Release(), Reserve(), and ResourceBroker().

Scheduler* impala::ResourceBroker::scheduler_
private

Definition at line 176 of file resource-broker.h.

Referenced by AMNotification(), Init(), and set_scheduler().


The documentation for this class was generated from the following files: