MySQL  8.0.20
Source Code Documentation
SortFileIndirectIterator Class Referencefinal

Fetch the record IDs from a temporary file, then the records themselves from the table on disk. More...

#include <basic_row_iterators.h>

Inheritance diagram for SortFileIndirectIterator:
TableRowIterator RowIterator

Public Member Functions

 SortFileIndirectIterator (THD *thd, TABLE *table, IO_CACHE *tempfile, bool request_cache, bool ignore_not_found_rows, ha_rows *examined_rows)
 ~SortFileIndirectIterator () 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 Member Functions

bool InitCache ()
 Initialize caching of records from temporary file. More...
int CachedRead ()
int UncachedRead ()

Private Attributes

IO_CACHEm_io_cache = nullptr
ha_rows *const m_examined_rows
ucharm_record = nullptr
ucharm_ref_pos = nullptr
bool m_ignore_not_found_rows
bool m_using_cache
uint m_cache_records
uint m_ref_length
uint m_struct_length
uint m_reclength
uint m_rec_cache_size
uint m_error_offset
unique_ptr_my_free< uchar[]> m_cache
ucharm_cache_pos = nullptr
ucharm_cache_end = nullptr
ucharm_read_positions = nullptr

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 temporary file, then the records themselves from the table on disk.

Same as SortBufferIndirectIterator except that references are fetched from temporary file instead of from a memory buffer. So first the record IDs are read from file, then those record IDs are used to look up rows in the table.

Constructor & Destructor Documentation

◆ SortFileIndirectIterator()

SortFileIndirectIterator::SortFileIndirectIterator ( THD thd,
TABLE table,
IO_CACHE tempfile,
bool  request_cache,
bool  ignore_not_found_rows,
ha_rows examined_rows 

◆ ~SortFileIndirectIterator()

SortFileIndirectIterator::~SortFileIndirectIterator ( )

Member Function Documentation

◆ CachedRead()

int SortFileIndirectIterator::CachedRead ( )

◆ DebugString()

vector< string > SortFileIndirectIterator::DebugString ( ) const

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 SortFileIndirectIterator::Init ( )

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.

◆ InitCache()

bool SortFileIndirectIterator::InitCache ( )

Initialize caching of records from temporary file.

Return values
falseOK, use caching. true Buffer is too small, or cannot be allocated. Skip caching, and read records directly from temporary file.

◆ Read()

int SortFileIndirectIterator::Read ( )

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
-1End of records

Implements RowIterator.

◆ UncachedRead()

int SortFileIndirectIterator::UncachedRead ( )

Member Data Documentation

◆ m_cache

unique_ptr_my_free<uchar[]> SortFileIndirectIterator::m_cache

◆ m_cache_end

uchar * SortFileIndirectIterator::m_cache_end = nullptr

◆ m_cache_pos

uchar* SortFileIndirectIterator::m_cache_pos = nullptr

◆ m_cache_records

uint SortFileIndirectIterator::m_cache_records

◆ m_error_offset

uint SortFileIndirectIterator::m_error_offset

◆ m_examined_rows

ha_rows* const SortFileIndirectIterator::m_examined_rows

◆ m_ignore_not_found_rows

bool SortFileIndirectIterator::m_ignore_not_found_rows

◆ m_io_cache

IO_CACHE* SortFileIndirectIterator::m_io_cache = nullptr

◆ m_read_positions

uchar * SortFileIndirectIterator::m_read_positions = nullptr

◆ m_rec_cache_size

uint SortFileIndirectIterator::m_rec_cache_size

◆ m_reclength

uint SortFileIndirectIterator::m_reclength

◆ m_record

uchar* SortFileIndirectIterator::m_record = nullptr

◆ m_ref_length

uint SortFileIndirectIterator::m_ref_length

◆ m_ref_pos

uchar* SortFileIndirectIterator::m_ref_pos = nullptr

◆ m_struct_length

uint SortFileIndirectIterator::m_struct_length

◆ m_using_cache

bool SortFileIndirectIterator::m_using_cache

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