MySQL 5.6.14 Source Code Document
|
Class of scan operations for use to scan ordered index. More...
#include <NdbIndexScanOperation.hpp>
Classes | |
struct | IndexBound |
struct | OldApiBoundInfo |
struct | OldApiScanRangeDefinition |
Public Types | |
enum | BoundType { BoundLE = 0, BoundLT = 1, BoundGE = 2, BoundGT = 3, BoundEQ = 4 } |
enum | { MaxRangeNo = 0xfff } |
Public Types inherited from NdbScanOperation | |
enum | ScanFlag { SF_TupScan = (1 << 16), SF_DiskScan = (2 << 16), SF_OrderBy = (1 << 24), SF_OrderByFull = (16 << 24), SF_Descending = (2 << 24), SF_ReadRangeNo = (4 << 24), SF_MultiRange = (8 << 24), SF_KeyInfo = 1 } |
Public Types inherited from NdbOperation | |
enum | OperationType { ReadRequest = 0, UpdateRequest = 1, InsertRequest = 2, DeleteRequest = 3, WriteRequest = 4, ReadExclusive = 5, RefreshRequest = 6, UnlockRequest = 7, OpenScanRequest, OpenRangeScanRequest, NotDefined2, NotDefined } |
enum | Type { PrimaryKeyAccess = 0, UniqueIndexAccess = 1, TableScan = 2, OrderedIndexScan = 3 } |
enum | LockMode { LM_Read = 0, LM_Exclusive = 1, LM_CommittedRead = 2, LM_Dirty = 2, LM_SimpleRead = 3 } |
enum | AbortOption { DefaultAbortOption = -1, AbortOnError = 0, AO_IgnoreError = 2 } |
Public Member Functions | |
virtual int | readTuples (LockMode lock_mode=LM_Read, Uint32 scan_flags=0, Uint32 parallel=0, Uint32 batch=0) |
int | readTuples (LockMode lock_mode, Uint32 batch, Uint32 parallel, bool order_by, bool order_desc=false, bool read_range_no=false, bool keyinfo=false, bool multi_range=false) |
int | setBound (const char *attr, int type, const void *value, Uint32 len) |
int | setBound (const char *attr, int type, const void *value) |
int | setBound (Uint32 anAttrId, int type, const void *aValue, Uint32 len) |
int | setBound (Uint32 anAttrId, int type, const void *aValue) |
int | end_of_bound (Uint32 range_no=0) |
int | get_range_no () |
int | setBound (const NdbRecord *key_record, const IndexBound &bound) |
int | setBound (const NdbRecord *key_record, const IndexBound &bound, const Ndb::PartitionSpec *partInfo, Uint32 sizeOfPartInfo=0) |
bool | getSorted () const |
bool | getDescending () const |
Public Member Functions inherited from NdbScanOperation | |
virtual int | readTuples (LockMode lock_mode=LM_Read, Uint32 scan_flags=0, Uint32 parallel=0, Uint32 batch=0) |
int | readTuples (int parallell) |
int | readTuplesExclusive (int parallell=0) |
virtual NdbBlob * | getBlobHandle (const char *anAttrName) |
virtual NdbBlob * | getBlobHandle (Uint32 anAttrId) |
int | setInterpretedCode (const NdbInterpretedCode *code) |
int | nextResult (bool fetchAllowed=true, bool forceSend=false) |
int | nextResult (const char **out_row_ptr, bool fetchAllowed, bool forceSend) |
int | nextResultCopyOut (char *buffer, bool fetchAllowed, bool forceSend) |
void | close (bool forceSend=false, bool releaseOp=false) |
NdbOperation * | lockCurrentTuple () |
NdbOperation * | lockCurrentTuple (NdbTransaction *lockTrans) |
NdbOperation * | updateCurrentTuple () |
NdbOperation * | updateCurrentTuple (NdbTransaction *updateTrans) |
int | deleteCurrentTuple () |
int | deleteCurrentTuple (NdbTransaction *takeOverTransaction) |
const NdbOperation * | lockCurrentTuple (NdbTransaction *takeOverTrans, const NdbRecord *result_rec, char *result_row=0, const unsigned char *result_mask=0, const NdbOperation::OperationOptions *opts=0, Uint32 sizeOfOptions=0) |
const NdbOperation * | updateCurrentTuple (NdbTransaction *takeOverTrans, const NdbRecord *attr_rec, const char *attr_row, const unsigned char *mask=0, const NdbOperation::OperationOptions *opts=0, Uint32 sizeOfOptions=0) |
const NdbOperation * | deleteCurrentTuple (NdbTransaction *takeOverTrans, const NdbRecord *result_rec, char *result_row=0, const unsigned char *result_mask=0, const NdbOperation::OperationOptions *opts=0, Uint32 sizeOfOptions=0) |
NdbTransaction * | getNdbTransaction () const |
bool | getPruned () const |
Public Member Functions inherited from NdbOperation | |
LockMode | getLockMode () const |
AbortOption | getAbortOption () const |
int | setAbortOption (AbortOption) |
void | setPartitionId (Uint32 id) |
Uint32 | getPartitionId () const |
const NdbLockHandle * | getLockHandle () const |
const NdbLockHandle * | getLockHandle () |
const NdbOperation * | next () const |
const NdbRecAttr * | getFirstRecAttr () const |
void * | getCustomData () const |
void | setCustomData (void *p) |
virtual int | interpretedUpdateTuple () |
virtual int | interpretedDeleteTuple () |
int | equal (const char *anAttrName, const char *aValue, Uint32 len) |
int | equal (const char *anAttrName, const char *aValue) |
int | equal (const char *anAttrName, Int32 aValue) |
int | equal (const char *anAttrName, Uint32 aValue) |
int | equal (const char *anAttrName, Int64 aValue) |
int | equal (const char *anAttrName, Uint64 aValue) |
int | equal (Uint32 anAttrId, const char *aValue, Uint32 len) |
int | equal (Uint32 anAttrId, const char *aValue) |
int | equal (Uint32 anAttrId, Int32 aValue) |
int | equal (Uint32 anAttrId, Uint32 aValue) |
int | equal (Uint32 anAttrId, Int64 aValue) |
int | equal (Uint32 anAttrId, Uint64 aValue) |
NdbRecAttr * | getValue (const char *anAttrName, char *aValue=0) |
NdbRecAttr * | getValue (Uint32 anAttrId, char *aValue=0) |
NdbRecAttr * | getValue (const NdbDictionary::Column *, char *val=0) |
int | setValue (const char *anAttrName, const char *aValue, Uint32 len) |
int | setValue (const char *anAttrName, const char *aValue) |
int | setValue (const char *anAttrName, Int32 aValue) |
int | setValue (const char *anAttrName, Uint32 aValue) |
int | setValue (const char *anAttrName, Int64 aValue) |
int | setValue (const char *anAttrName, Uint64 aValue) |
int | setValue (const char *anAttrName, float aValue) |
int | setValue (const char *anAttrName, double aValue) |
int | setAnyValue (Uint32 aValue) |
int | setOptimize (Uint32 options) |
int | setValue (Uint32 anAttrId, const char *aValue, Uint32 len) |
int | setValue (Uint32 anAttrId, const char *aValue) |
int | setValue (Uint32 anAttrId, Int32 aValue) |
int | setValue (Uint32 anAttrId, Uint32 aValue) |
int | setValue (Uint32 anAttrId, Int64 aValue) |
int | setValue (Uint32 anAttrId, Uint64 aValue) |
int | setValue (Uint32 anAttrId, float aValue) |
int | setValue (Uint32 anAttrId, double aValue) |
virtual NdbBlob * | getBlobHandle (const char *anAttrName) const |
virtual NdbBlob * | getBlobHandle (Uint32 anAttrId) const |
int | incValue (const char *anAttrName, Uint32 aValue) |
int | incValue (const char *anAttrName, Uint64 aValue) |
int | incValue (Uint32 anAttrId, Uint32 aValue) |
int | incValue (Uint32 anAttrId, Uint64 aValue) |
int | subValue (const char *anAttrName, Uint32 aValue) |
int | subValue (const char *anAttrName, Uint64 aValue) |
int | subValue (Uint32 anAttrId, Uint32 aValue) |
int | subValue (Uint32 anAttrId, Uint64 aValue) |
int | def_label (int labelNumber) |
int | add_reg (Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) |
int | sub_reg (Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest) |
int | load_const_u32 (Uint32 RegDest, Uint32 Constant) |
int | load_const_u64 (Uint32 RegDest, Uint64 Constant) |
int | load_const_null (Uint32 RegDest) |
int | read_attr (const char *anAttrName, Uint32 RegDest) |
int | write_attr (const char *anAttrName, Uint32 RegSource) |
int | read_attr (Uint32 anAttrId, Uint32 RegDest) |
int | write_attr (Uint32 anAttrId, Uint32 RegSource) |
int | branch_ge (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_gt (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_le (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_lt (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_eq (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_ne (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label) |
int | branch_ne_null (Uint32 RegLvalue, Uint32 Label) |
int | branch_eq_null (Uint32 RegLvalue, Uint32 Label) |
int | branch_label (Uint32 Label) |
int | branch_col_eq_null (Uint32 ColId, Uint32 Label) |
int | branch_col_ne_null (Uint32 ColId, Uint32 Label) |
int | branch_col_eq (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_ne (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_lt (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_le (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_gt (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_ge (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_like (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_notlike (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_and_mask_eq_mask (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_and_mask_ne_mask (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_and_mask_eq_zero (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | branch_col_and_mask_ne_zero (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label) |
int | interpret_exit_ok () |
int | interpret_exit_nok (Uint32 ErrorCode) |
int | interpret_exit_nok () |
int | interpret_exit_last_row () |
int | def_subroutine (int SubroutineNumber) |
int | call_sub (Uint32 Subroutine) |
int | ret_sub () |
const NdbError & | getNdbError () const |
int | getNdbErrorLine () |
int | getNdbErrorLine () const |
const char * | getTableName () const |
const NdbDictionary::Table * | getTable () const |
Type | getType () const |
virtual int | insertTuple () |
virtual int | updateTuple () |
virtual int | writeTuple () |
virtual int | deleteTuple () |
virtual int | readTuple (LockMode) |
virtual int | readTuple () |
virtual int | readTupleExclusive () |
virtual int | simpleRead () |
virtual int | dirtyRead () |
virtual int | committedRead () |
virtual int | dirtyUpdate () |
virtual int | dirtyWrite () |
Friends | |
class | Ndb |
class | NdbTransaction |
class | NdbResultSet |
class | NdbOperation |
class | NdbScanOperation |
class | NdbIndexStat |
struct | Ndb_free_list_t< NdbIndexScanOperation > |
Additional Inherited Members | |
Protected Types inherited from NdbScanOperation | |
enum | ScanPruningState { SPS_UNKNOWN, SPS_FIXED, SPS_ONE_PARTITION, SPS_MULTI_PARTITION } |
Protected Member Functions inherited from NdbScanOperation | |
NdbScanOperation (Ndb *aNdb, NdbOperation::Type aType=NdbOperation::TableScan) | |
virtual NdbRecAttr * | getValue_impl (const NdbColumnImpl *, char *aValue=0) |
NdbRecAttr * | getValue_NdbRecord_scan (const NdbColumnImpl *, char *aValue) |
NdbRecAttr * | getValue_NdbRecAttr_scan (const NdbColumnImpl *, char *aValue) |
int | handleScanGetValuesOldApi () |
int | addInterpretedCode () |
int | handleScanOptionsVersion (const ScanOptions *&optionsPtr, Uint32 sizeOfOptions, ScanOptions &currOptions) |
int | handleScanOptions (const ScanOptions *options) |
int | validatePartInfoPtr (const Ndb::PartitionSpec *&partInfo, Uint32 sizeOfPartInfo, Ndb::PartitionSpec &partValue) |
int | getPartValueFromInfo (const Ndb::PartitionSpec *partInfo, const NdbTableImpl *table, Uint32 *partValue) |
int | generatePackedReadAIs (const NdbRecord *reseult_record, bool &haveBlob, const Uint32 *readMask) |
int | scanImpl (const NdbScanOperation::ScanOptions *options, const Uint32 *readMask) |
int | scanTableImpl (const NdbRecord *result_record, NdbOperation::LockMode lock_mode, const unsigned char *result_mask, const NdbScanOperation::ScanOptions *options, Uint32 sizeOfOptions) |
int | nextResultNdbRecord (const char *&out_row, bool fetchAllowed, bool forceSend) |
virtual void | release () |
int | close_impl (bool forceSend, PollGuard *poll_guard) |
NdbInterpretedCode * | allocInterpretedCodeOldApi () |
void | freeInterpretedCodeOldApi () |
int | doSendSetAISectionSizes () |
int | executeCursor (int ProcessorId) |
int | init (const NdbTableImpl *tab, NdbTransaction *) |
int | prepareSend (Uint32 TC_ConnectPtr, Uint64 TransactionId, NdbOperation::AbortOption) |
int | doSend (int ProcessorId) |
virtual void | setReadLockMode (LockMode lockMode) |
virtual void | setErrorCode (int aErrorCode) const |
virtual void | setErrorCodeAbort (int aErrorCode) const |
int | getFirstATTRINFOScan () |
int | doSendScan (int ProcessorId) |
int | finaliseScanOldApi () |
int | prepareSendScan (Uint32 TC_ConnectPtr, Uint64 TransactionId) |
int | fix_receivers (Uint32 parallel) |
void | reset_receivers (Uint32 parallel, Uint32 ordered) |
int | send_next_scan (Uint32 cnt, bool close) |
void | receiver_delivered (NdbReceiver *) |
void | receiver_completed (NdbReceiver *) |
void | execCLOSE_SCAN_REP () |
int | getKeyFromKEYINFO20 (Uint32 *data, Uint32 &size) |
NdbOperation * | takeOverScanOp (OperationType opType, NdbTransaction *) |
NdbOperation * | takeOverScanOpNdbRecord (OperationType opType, NdbTransaction *pTrans, const NdbRecord *record, char *row, const unsigned char *mask, const NdbOperation::OperationOptions *opts, Uint32 sizeOfOptions) |
virtual int | processTableScanDefs (LockMode lock_mode, Uint32 scan_flags, Uint32 parallel, Uint32 batch) |
Static Protected Member Functions inherited from NdbOperation | |
static int | handleOperationOptions (const OperationType type, const OperationOptions *opts, const Uint32 sizeOfOptions, NdbOperation *op) |
Protected Attributes inherited from NdbScanOperation | |
NdbTransaction * | m_transConnection |
Uint32 | theParallelism |
Uint32 | m_keyInfo |
Uint32 * | m_array |
Uint32 | m_allocated_receivers |
NdbReceiver ** | m_receivers |
Uint32 * | m_prepared_receivers |
Uint32 | m_current_api_receiver |
Uint32 | m_api_receivers_count |
NdbReceiver ** | m_api_receivers |
Uint32 | m_conf_receivers_count |
NdbReceiver ** | m_conf_receivers |
Uint32 | m_sent_receivers_count |
NdbReceiver ** | m_sent_receivers |
bool | m_ordered |
bool | m_descending |
Uint32 | m_read_range_no |
NdbRecAttr * | m_curr_row |
bool | m_multi_range |
bool | m_executed |
char * | m_scan_buffer |
bool | m_scanUsingOldApi |
bool | m_readTuplesCalled |
LockMode | m_savedLockModeOldApi |
Uint32 | m_savedScanFlagsOldApi |
Uint32 | m_savedParallelOldApi |
Uint32 | m_savedBatchOldApi |
NdbInterpretedCode * | m_interpretedCodeOldApi |
ScanPruningState | m_pruneState |
Uint32 | m_pruningKey |
Class of scan operations for use to scan ordered index.
Definition at line 28 of file NdbIndexScanOperation.hpp.
Type of ordered index key bound. The values (0-4) will not change and can be used explicitly (e.g. they could be computed).
BoundLE |
lower bound |
BoundLT |
lower bound, strict |
BoundGE |
upper bound |
BoundGT |
upper bound, strict |
BoundEQ |
equality |
Definition at line 89 of file NdbIndexScanOperation.hpp.
int NdbIndexScanOperation::end_of_bound | ( | Uint32 | range_no = 0 | ) |
This method is called to separate sets of bounds (ranges) when defining an Index Scan with multiple ranges It can only be used with scans defined using the SF_MultiRange scan flag. For NdbRecord, ranges are specified using the IndexBound structure and the setBound() API. If an index scan has more than one range then end_of_bound must be called after every range, including the last. If the SF_ReadRangeNo flag is set then the range_no supplied when the range is defined will be associated with each row returned from that range. This can be obtained by calling get_range_no(). If SF_ReadRangeNo and SF_OrderBy flags are provided then range_no values must be strictly increasing (i.e. starting at zero and getting larger by 1 for each range specified). This is to ensure that rows are returned in order.
Definition at line 3978 of file NdbScanOperation.cpp.
int NdbIndexScanOperation::get_range_no | ( | ) |
Return range number for current row, as defined in the IndexBound structure used when the scan was defined. Only available if the SF_ReadRangeNo and SF_MultiRange flags were set in the ScanOptions::scan_flags structure passed to scanIndex().
Definition at line 4028 of file NdbScanOperation.cpp.
|
inline |
Is current scan sorted descending?
Definition at line 245 of file NdbIndexScanOperation.hpp.
|
inline |
Is current scan sorted?
Definition at line 240 of file NdbIndexScanOperation.hpp.
|
virtual |
readTuples using ordered index This method is used to specify details for an old Api Index Scan operation.
lock_mode | Lock mode |
scan_flags | see ScanFlag |
parallel | No of fragments to scan in parallel (0=max) |
Definition at line 3461 of file NdbScanOperation.cpp.
|
inline |
readTuples using ordered index
lock_mode | Lock mode |
batch | No of rows to fetch from each fragment at a time |
parallel | No of fragments to scan in parallel |
order_by | Order result set in index order |
order_desc | Order descending, ignored unless order_by |
read_range_no | Enable reading of range no using get_range_no |
Definition at line 66 of file NdbIndexScanOperation.hpp.
|
inline |
Define bound on index key in range scan - old Api.
Each index key can have lower and/or upper bound. Setting the key equal to a value defines both upper and lower bounds. The bounds can be defined in any order. Conflicting definitions is an error.
For equality, it is better to use BoundEQ instead of the equivalent pair of BoundLE and BoundGE. This is especially true when table partition key is an initial part of the index key.
The sets of lower and upper bounds must be on initial sequences of index keys. All but possibly the last bound must be non-strict. So "a >= 2 and b > 3" is ok but "a > 2 and b >= 3" is not.
The scan may currently return tuples for which the bounds are not satisfied. For example, "a <= 2 and b <= 3" scans the index up to (a=2, b=3) but also returns any (a=1, b=4).
NULL is treated like a normal value which is less than any not-NULL value and equal to another NULL value. To compare against NULL use setBound with null pointer (0).
An index stores also all-NULL keys. Doing index scan with empty bound set returns all table tuples.
attr | Attribute name, alternatively: |
type | Type of bound |
value | Pointer to bound value, 0 for NULL |
Definition at line 363 of file NdbIndexScanOperation.hpp.
|
inline |
Define bound on index key in range scan using index column id. See the other setBound() method for details.
Definition at line 372 of file NdbIndexScanOperation.hpp.
int NdbIndexScanOperation::setBound | ( | const NdbRecord * | key_record, |
const IndexBound & | bound | ||
) |
Add a range to an NdbRecord defined Index scan
This method is called to add a range to an IndexScan operation which has been defined with a call to NdbTransaction::scanIndex(). To add more than one range, the index scan operation must have been defined with the the SF_MultiRange flag set.
Where multiple numbered ranges are defined with multiple calls to setBound, and the scan is ordered, the range number for each range must be larger than the range number for the previously defined range.
When the application knows that rows in-range will only be found in a particular partition, a PartitionSpecification can be supplied. This may be used to limit the scan to a single partition, improving system efficiency The sizeOfPartInfo parameter should be set to the sizeof(PartitionSpec) to enable backwards compatibility.
key_record | NdbRecord structure for the key the index is defined on |
bound | The bound to add |
partInfo | Extra information to enable a reduced set of partitions to be scanned. |
sizeOfPartInfo |
Definition at line 872 of file NdbScanOperation.cpp.
int NdbIndexScanOperation::setBound | ( | const NdbRecord * | key_record, |
const IndexBound & | bound, | ||
const Ndb::PartitionSpec * | partInfo, | ||
Uint32 | sizeOfPartInfo = 0 |
||
) |
This method is called from scanIndex() and setBound(). It adds a bound to an Index Scan. It can be passed extra partitioning information.
Definition at line 886 of file NdbScanOperation.cpp.
|
friend |
Reciver(s)
Definition at line 30 of file NdbIndexScanOperation.hpp.
|
friend |
Sender(s)
Definition at line 33 of file NdbIndexScanOperation.hpp.