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

#include <fragment-mgr.h>

Collaboration diagram for impala::FragmentMgr:

Classes

class  FragmentExecState
 Execution state of a single plan fragment. More...
 

Public Member Functions

Status ExecPlanFragment (const TExecPlanFragmentParams &params)
 
void CancelPlanFragment (TCancelPlanFragmentResult &return_val, const TCancelPlanFragmentParams &params)
 Cancels a plan fragment that is running asynchronously. More...
 
boost::shared_ptr
< FragmentExecState
GetFragmentExecState (const TUniqueId &fragment_instance_id)
 

Private Types

typedef boost::unordered_map
< TUniqueId, boost::shared_ptr
< FragmentExecState > > 
FragmentExecStateMap
 

Private Member Functions

void FragmentExecThread (FragmentExecState *exec_state)
 

Private Attributes

boost::mutex fragment_exec_state_map_lock_
 protects fragment_exec_state_map_ More...
 
FragmentExecStateMap fragment_exec_state_map_
 

Detailed Description

Manages execution of individual plan fragments, which are typically run as a result of ExecPlanFragment() RPCs that arrive via the internal Impala interface. A fragment is started in ExecPlanFragment(), which starts a thread which runs FragmentExecThread() asynchronously and returns. After this point a fragment may terminate either by cancellation via CancelPlanFragment(), or when FragmentExecThread() returns. TODO: Remove Thrift args from methods where it would improve readability; ImpalaInternalService can take care of translation to / from Thrift, as it already does for ExecPlanFragment()'s return value.

Definition at line 38 of file fragment-mgr.h.

Member Typedef Documentation

typedef boost::unordered_map<TUniqueId, boost::shared_ptr<FragmentExecState> > impala::FragmentMgr::FragmentExecStateMap
private

map from fragment id to exec state; FragmentExecState is owned by us and referenced as a shared_ptr to allow asynchronous calls to CancelPlanFragment()

Definition at line 68 of file fragment-mgr.h.

Member Function Documentation

void FragmentMgr::CancelPlanFragment ( TCancelPlanFragmentResult &  return_val,
const TCancelPlanFragmentParams &  params 
)

Cancels a plan fragment that is running asynchronously.

Definition at line 115 of file fragment-mgr.cc.

References impala::Status::SetTStatus(), and VLOG_QUERY.

Status FragmentMgr::ExecPlanFragment ( const TExecPlanFragmentParams &  params)

Registers a new FragmentExecState, Prepare()'s it, and launches the thread that runs FragmentExecThread() before returning. Returns OK if there was no error, otherwise returns an error if the fragment is malformed (e.g. no sink), or if there is an error during Prepare().

Definition at line 35 of file fragment-mgr.cc.

References FragmentExecThread(), impala::ExecEnv::GetInstance(), impala::Status::OK, RETURN_IF_ERROR, and VLOG_QUERY.

void FragmentMgr::FragmentExecThread ( FragmentExecState exec_state)
private

Call exec_state->Exec(), and then removes exec_state from the fragment map. Run in the fragment's execution thread.

Definition at line 68 of file fragment-mgr.cc.

References impala::FragmentMgr::FragmentExecState::Exec(), impala::FragmentMgr::FragmentExecState::fragment_instance_id(), and impala::ImpaladMetrics::IMPALA_SERVER_NUM_FRAGMENTS.

Referenced by ExecPlanFragment().

shared_ptr< FragmentMgr::FragmentExecState > FragmentMgr::GetFragmentExecState ( const TUniqueId &  fragment_instance_id)

Returns a shared pointer to the FragmentExecState if one can be found for the given id. If the id is not found, the shared pointer will contain NULL.

Definition at line 104 of file fragment-mgr.cc.

Member Data Documentation

FragmentExecStateMap impala::FragmentMgr::fragment_exec_state_map_
private

Definition at line 69 of file fragment-mgr.h.

boost::mutex impala::FragmentMgr::fragment_exec_state_map_lock_
private

protects fragment_exec_state_map_

Definition at line 63 of file fragment-mgr.h.


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