MySQL 9.1.0
Source Code Documentation
ddl::Merge_cursor Struct Reference

Merge the sorted files. More...

#include <ddl0impl-builder.h>

Inheritance diagram for ddl::Merge_cursor:
[legend]

Classes

struct  Compare
 Comparator. More...
 

Public Types

using File_readers = std::vector< File_reader *, ut::allocator< File_reader * > >
 File cursors to use for the scan. More...
 

Public Member Functions

 Merge_cursor (Builder *builder, Dup *dup, Alter_stage *stage) noexcept
 Constructor. More...
 
 ~Merge_cursor () noexcept override
 Destructor. More...
 
dberr_t add_file (const ddl::file_t &file, size_t buffer_size) noexcept
 Add the cursor to use for merge load. More...
 
dberr_t add_file (const ddl::file_t &file, size_t buffer_size, const Range &range) noexcept
 Add the cursor to use for merge load. More...
 
dberr_t open () noexcept
 Open the cursor. More...
 
dberr_t fetch (dtuple_t *&dtuple) noexcept override
 Fetch the current row as a tuple. More...
 
dberr_t fetch (const mrec_t *&mrec, ulint *&offsets) noexcept
 Fetch the current row. More...
 
dberr_t next () noexcept override
 Move to the next record. More...
 
File_readers file_readers () noexcept
 
void clear_eof () noexcept
 Add the active cursors to the priority queue. More...
 
size_t size () const noexcept
 
uint64_t get_n_rows () const noexcept
 
size_t number_of_cursors () const noexcept
 
- Public Member Functions inherited from ddl::Load_cursor
 Load_cursor (Builder *builder, Dup *dup) noexcept
 Default constructor. More...
 
virtual ~Load_cursor () override=default
 Default destructor. More...
 
dberr_t get_err () const noexcept
 
bool duplicates_detected () const noexcept override
 
- Public Member Functions inherited from Btree_load::Cursor
 Cursor ()=default
 Constructor. More...
 
virtual ~Cursor ()=default
 Destructor. More...
 

Private Types

using File_cursors = std::vector< File_cursor *, ut::allocator< File_cursor * > >
 File cursors to use for the scan. More...
 
using Queue = std::priority_queue< File_cursor *, File_cursors, Compare >
 Priority queue for ordering the rows. More...
 

Private Member Functions

File_cursorpop () noexcept
 

Private Attributes

Queue m_pq {}
 Priority queue for merging the file cursors. More...
 
File_cursors m_cursors {}
 Cursors to use for parallel loading of the index. More...
 
File_cursorm_cursor {}
 Current cursor. More...
 
Alter_stagem_stage {}
 PFS stage monitoring. More...
 

Additional Inherited Members

- Public Attributes inherited from ddl::Load_cursor
Dupm_dup {}
 Duplicate checking and reporting. More...
 
dberr_t m_err {DB_SUCCESS}
 Operation error code. More...
 
Builderm_builder {}
 Index meta data. More...
 
Scoped_heap m_tuple_heap {}
 Heap for the raw row to dtuple_t conversion. More...
 

Detailed Description

Merge the sorted files.

Member Typedef Documentation

◆ File_cursors

File cursors to use for the scan.

◆ File_readers

File cursors to use for the scan.

◆ Queue

using ddl::Merge_cursor::Queue = std::priority_queue<File_cursor *, File_cursors, Compare>
private

Priority queue for ordering the rows.

Constructor & Destructor Documentation

◆ Merge_cursor()

ddl::Merge_cursor::Merge_cursor ( Builder builder,
Dup dup,
Alter_stage stage 
)
explicitnoexcept

Constructor.

Parameters
[in,out]builderIndex builder.
[in,out]dupIf not nullptr, then report duplicates.
[in,out]stagePFS stage monitoring.

◆ ~Merge_cursor()

ddl::Merge_cursor::~Merge_cursor ( )
overridenoexcept

Destructor.

Member Function Documentation

◆ add_file() [1/2]

dberr_t ddl::Merge_cursor::add_file ( const ddl::file_t file,
size_t  buffer_size 
)
noexcept

Add the cursor to use for merge load.

Parameters
[in]fileFile to merge from.
[in]buffer_sizeIO buffer size to use for reading.
Returns
DB_SUCCESS or error code.

◆ add_file() [2/2]

dberr_t ddl::Merge_cursor::add_file ( const ddl::file_t file,
size_t  buffer_size,
const Range range 
)
noexcept

Add the cursor to use for merge load.

Parameters
[in]fileFile file to read.
[in]buffer_sizeIO buffer size to use for reading.
[in]rangeRange to read from
Returns
DB_SUCCESS or error code.

◆ clear_eof()

void ddl::Merge_cursor::clear_eof ( )
noexcept

Add the active cursors to the priority queue.

◆ fetch() [1/2]

dberr_t ddl::Merge_cursor::fetch ( const mrec_t *&  mrec,
ulint *&  offsets 
)
noexcept

Fetch the current row.

Parameters
[out]mrecCurrent merge record.
[out]offsetsColumns offsets inside mrec.
Returns
DB_SUCCESS, DB_END_OF_INDEX or error code.

◆ fetch() [2/2]

dberr_t ddl::Merge_cursor::fetch ( dtuple_t *&  dtuple)
overridevirtualnoexcept

Fetch the current row as a tuple.

Note: Tuple columns are shallow copies.

Parameters
[out]dtupleRow represented as a tuple.
Returns
DB_SUCCESS, DB_END_OF_INDEX or error code.

Implements Btree_load::Cursor.

◆ file_readers()

Merge_cursor::File_readers ddl::Merge_cursor::file_readers ( )
noexcept
Returns
the file reader instances.

◆ get_n_rows()

uint64_t ddl::Merge_cursor::get_n_rows ( ) const
noexcept
Returns
the number of rows read from the files.

◆ next()

dberr_t ddl::Merge_cursor::next ( void  )
overridevirtualnoexcept

Move to the next record.

Returns
DB_SUCCESS, DB_END_OF_INDEX or error code.

Implements Btree_load::Cursor.

◆ number_of_cursors()

size_t ddl::Merge_cursor::number_of_cursors ( ) const
inlinenoexcept
Returns
the number of cursors being merged.

◆ open()

dberr_t ddl::Merge_cursor::open ( )
noexcept

Open the cursor.

Returns
DB_SUCCESS or error code.

◆ pop()

File_cursor * ddl::Merge_cursor::pop ( void  )
privatenoexcept
Returns
the current cursor at the head of the queue.

◆ size()

size_t ddl::Merge_cursor::size ( ) const
inlinenoexcept
Returns
the number of active readers.

Member Data Documentation

◆ m_cursor

File_cursor* ddl::Merge_cursor::m_cursor {}
private

Current cursor.

◆ m_cursors

File_cursors ddl::Merge_cursor::m_cursors {}
private

Cursors to use for parallel loading of the index.

◆ m_pq

Queue ddl::Merge_cursor::m_pq {}
private

Priority queue for merging the file cursors.

◆ m_stage

Alter_stage* ddl::Merge_cursor::m_stage {}
private

PFS stage monitoring.


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