MySQL  8.0.19
Source Code Documentation
SortBufferIndirectIterator Class Referencefinal

Fetch the record IDs from a memory buffer, but the records themselves from the table on disk. More...

#include <basic_row_iterators.h>

Inheritance diagram for SortBufferIndirectIterator:
TableRowIterator RowIterator

Public Member Functions

 SortBufferIndirectIterator (THD *thd, TABLE *table, Sort_result *sort_result, bool ignore_not_found_rows, ha_rows *examined_rows)
 
 ~SortBufferIndirectIterator () override
 
bool Init () override
 Initialize or reinitialize the iterator. More...
 
int Read () override
 Read a single row. More...
 
std::vector< std::string > DebugString () const override
 Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterator. More...
 
- Public Member Functions inherited from TableRowIterator
 TableRowIterator (THD *thd, TABLE *table)
 
void UnlockRow () override
 The default implementation of unlock-row method of RowIterator, used in all access methods except EQRefIterator. More...
 
void SetNullRowFlag (bool is_null_row) override
 Mark the current row buffer as containing a NULL row or not, so that if you read from it and the flag is true, you'll get only NULLs no matter what is actually in the buffer (typically some old leftover row). More...
 
void StartPSIBatchMode () override
 Start performance schema batch mode, if supported (otherwise ignored). More...
 
void EndPSIBatchModeIfStarted () override
 Ends performance schema batch mode, if started. More...
 
- Public Member Functions inherited from RowIterator
 RowIterator (THD *thd)
 
virtual ~RowIterator ()
 
virtual std::vector< Childchildren () const
 List of zero or more iterators which are direct children of this one. More...
 
virtual std::string TimingString () const
 
JOINjoin_for_explain () const
 
void set_join_for_explain (JOIN *join)
 
void set_estimated_cost (double estimated_cost)
 
double estimated_cost () const
 
void set_expected_rows (double expected_rows)
 
double expected_rows () const
 
virtual RowIteratorreal_iterator ()
 If this iterator is wrapping a different iterator (e.g. More...
 
virtual const RowIteratorreal_iterator () const
 

Private Attributes

Sort_result *const m_sort_result
 
const uint m_ref_length
 
ha_rows *const m_examined_rows
 
ucharm_record = nullptr
 
ucharm_cache_pos = nullptr
 
ucharm_cache_end = nullptr
 
bool m_ignore_not_found_rows
 

Additional Inherited Members

- Protected Member Functions inherited from TableRowIterator
int HandleError (int error)
 
void PrintError (int error)
 
TABLEtable () const
 
- Protected Member Functions inherited from RowIterator
THDthd () const
 

Detailed Description

Fetch the record IDs from a memory buffer, but the records themselves from the table on disk.

Used when the above (comment on SortBufferIterator) is not true, UPDATE, DELETE and so forth and SELECT's involving BLOB's. It is also used when the addon_field buffer is not allocated due to that its size was bigger than the session variable max_length_for_sort_data. Finally, it is used for the result of Unique, which returns row IDs in the same format as filesort. In this case the record data is fetched from the handler using the saved reference using the rnd_pos handler call.

Constructor & Destructor Documentation

◆ SortBufferIndirectIterator()

SortBufferIndirectIterator::SortBufferIndirectIterator ( THD thd,
TABLE table,
Sort_result sort_result,
bool  ignore_not_found_rows,
ha_rows examined_rows 
)

◆ ~SortBufferIndirectIterator()

SortBufferIndirectIterator::~SortBufferIndirectIterator ( )
override

Member Function Documentation

◆ DebugString()

vector< string > SortBufferIndirectIterator::DebugString ( ) const
overridevirtual

Returns a short string (used for EXPLAIN FORMAT=tree) with user-readable information for this iterator.

When implementing these, try to avoid internal jargon (e.g. “eq_ref”); prefer things that read like normal, technical English (e.g. “single-row index lookup”).

For certain complex operations, such as MaterializeIterator, there can be multiple strings. If so, they are interpreted as nested operations, with the outermost, last-done operation first and the other ones indented as if they were child iterators.

Callers should use FullDebugString() below, which adds costs (see set_estimated_cost() etc.) if present.

Implements RowIterator.

◆ Init()

bool SortBufferIndirectIterator::Init ( )
overridevirtual

Initialize or reinitialize the iterator.

You must always call Init() before trying a Read() (but Init() does not imply Read()).

You can call Init() multiple times; subsequent calls will rewind the iterator (or reposition it, depending on whether the iterator takes in e.g. a TABLE_REF) and allow you to read the records anew.

Implements RowIterator.

◆ Read()

int SortBufferIndirectIterator::Read ( )
overridevirtual

Read a single row.

The row data is not actually returned from the function; it is put in the table's (or tables', in case of a join) record buffer, ie., table->records[0].

Return values
0OK
-1End of records
1Error

Implements RowIterator.

Member Data Documentation

◆ m_cache_end

uchar * SortBufferIndirectIterator::m_cache_end = nullptr
private

◆ m_cache_pos

uchar* SortBufferIndirectIterator::m_cache_pos = nullptr
private

◆ m_examined_rows

ha_rows* const SortBufferIndirectIterator::m_examined_rows
private

◆ m_ignore_not_found_rows

bool SortBufferIndirectIterator::m_ignore_not_found_rows
private

◆ m_record

uchar* SortBufferIndirectIterator::m_record = nullptr
private

◆ m_ref_length

const uint SortBufferIndirectIterator::m_ref_length
private

◆ m_sort_result

Sort_result* const SortBufferIndirectIterator::m_sort_result
private

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