MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbRootFragment Class Reference

Public Member Functions

void init (NdbQueryImpl &query, Uint32 fragNo)
Uint32 getFragNo () const
void prepareNextReceiveSet ()
void grabNextResultSet ()
bool hasReceivedMore () const
void setReceivedMore ()
void incrOutstandingResults (Int32 delta)
void clearOutstandingResults ()
void setConfReceived (Uint32 tcPtrI)
bool isFragBatchComplete () const
NdbResultStreamgetResultStream (Uint32 operationNo) const
NdbResultStreamgetResultStream (const NdbQueryOperationImpl &op) const
Uint32 getReceiverId () const
Uint32 getReceiverTcPtrI () const
bool finalBatchReceived () const
bool isEmpty () const
void setRemainingSubScans (Uint32 nodeMask)
void postFetchRelease ()

Static Public Member Functions

static void buildReciverIdMap (NdbRootFragment *frags, Uint32 noOfFrags)
static NdbRootFragmentreceiverIdLookup (NdbRootFragment *frags, Uint32 noOfFrags, Uint32 receiverId)
static void clear (NdbRootFragment *frags, Uint32 noOfFrags)

Detailed Description

If a query has a scan operation as its root, then that scan will normally read from several fragments of its target table. Each such root fragment scan, along with any child lookup operations that are spawned from it, runs independently, in the sense that:

  • The API will know when it has received all data from a fragment for a given batch and all child operations spawned from it.
  • When one fragment is complete (for a batch) the API will make these data avaliable to the application, even if other fragments are not yet complete.
  • The tuple identifiers that are used for matching children with parents are only guaranteed to be unique within one batch, operation, and root operation fragment. Tuples derived from different root fragments must thus be kept apart.

This class manages the state of one such read operation, from one particular fragment of the target table of the root operation. If the root operation is a lookup, then there will be only one instance of this class.

Definition at line 177 of file NdbQueryOperation.cpp.

Member Function Documentation

void NdbRootFragment::buildReciverIdMap ( NdbRootFragment frags,
Uint32  noOfFrags 
)
static

Build hash map for mapping from root receiver id to NdbRootFragment instance.

For reasons unknow, NdbObjectIdMap shifts ids two bits to the left, so we must do the opposite to get a good hash distribution.

Definition at line 1088 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void NdbRootFragment::clear ( NdbRootFragment rootFrags,
Uint32  noOfFrags 
)
static

Throw any pending ResultSets from specified rootFrags[]

Definition at line 1205 of file NdbQueryOperation.cpp.

Here is the caller graph for this function:

bool NdbRootFragment::finalBatchReceived ( ) const
Returns
True if there are no more batches to be received for this fragment.

Definition at line 1291 of file NdbQueryOperation.cpp.

Uint32 NdbRootFragment::getReceiverId ( ) const

SPJ requests are identified by the receiver-id of the root ResultStream for each RootFragment. Furthermore a NEXTREQ use the tcPtrI saved in this ResultStream to identify the 'cursor' to restart.

We provide some convenient accessors for fetching this info

Definition at line 1309 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NdbResultStream & NdbRootFragment::getResultStream ( Uint32  operationNo) const

Get the result stream that handles results derived from this root fragment for a particular operation.

Parameters
operationNoThe id of the operation.
Returns
The result stream for this root fragment.

Definition at line 1195 of file NdbQueryOperation.cpp.

Here is the caller graph for this function:

void NdbRootFragment::grabNextResultSet ( )

Prepare for reading another batch of results.

Let the application thread takes ownership of an available ResultSet, prepare it for reading first row. Need mutex lock as 'm_availResultSets' is accesed both from receiver and application thread.

Definition at line 1267 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

bool NdbRootFragment::hasReceivedMore ( ) const

Check if another ResultSets has been received and is available for reading. It will be given to the application thread when it call ::grabNextResultSet(). Need mutex lock as 'm_availResultSets' is accesed both from receiver and application thread.

Definition at line 1235 of file NdbQueryOperation.cpp.

void NdbRootFragment::init ( NdbQueryImpl query,
Uint32  fragNo 
)

Initialize object.

Parameters
queryEnclosing query.
fragNoThis object manages state for reading from the fragNo'th fragment that the root operation accesses.

Definition at line 1154 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool NdbRootFragment::isEmpty ( ) const
Returns
True if there are no more results from this root fragment (for the current batch).

Definition at line 1296 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

bool NdbRootFragment::isFragBatchComplete ( ) const
inline

The root operation will read from a number of fragments of a table. This method checks if all results for the current batch has been received for a given fragment. This includes both results for the root operation and any child operations. Note that child operations may access other fragments; the fragment number only refers to what the root operation does.

Returns
True if current batch is complete for this fragment.

Definition at line 242 of file NdbQueryOperation.cpp.

Here is the caller graph for this function:

void NdbRootFragment::postFetchRelease ( )

Release resources after last row has been returned

Release what we want need anymore after last available row has been returned from datanodes.

Don't 'delete' the object as it was in-place constructed from ResultStreamAlloc'ed memory. Memory is released by ResultStreamAlloc::reset().

Definition at line 1177 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

void NdbRootFragment::prepareNextReceiveSet ( )

Prepare for receiving another batch of results.

Reset resultStream and all its descendants, since all these streams will get a new set of rows in the next batch.

Definition at line 1240 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

NdbRootFragment * NdbRootFragment::receiverIdLookup ( NdbRootFragment frags,
Uint32  noOfFrags,
Uint32  receiverId 
)
static

Find NdbRootFragment instance corresponding to a given root receiver id.

For reasons unknow, NdbObjectIdMap shifts ids two bits to the left, so we must do the opposite to get a good hash distribution.

Definition at line 1108 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void NdbRootFragment::setReceivedMore ( )

Signal that another complete ResultSet is available for this NdbRootFragment. Need mutex lock as 'm_availResultSets' is accesed both from receiver and application thread.

Definition at line 1222 of file NdbQueryOperation.cpp.

void NdbRootFragment::setRemainingSubScans ( Uint32  nodeMask)
inline

This method is used for marking which streams belonging to this NdbRootFragment which has remaining batches for a sub scan instantiated from the current batch of its parent operation.

Definition at line 278 of file NdbQueryOperation.cpp.


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