MySQL 9.0.0
Source Code Documentation
DsMrr_impl Class Reference

#include <handler.h>

Public Member Functions

 DsMrr_impl (handler *owner)
 
 ~DsMrr_impl ()
 
void init (TABLE *table_arg)
 Initialize the DsMrr_impl object. More...
 
int dsmrr_init (RANGE_SEQ_IF *seq_funcs, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf)
 DS-MRR: Initialize and start MRR scan. More...
 
void dsmrr_close ()
 
void reset ()
 Resets the DS-MRR object to the state it had after being initialized. More...
 
int dsmrr_fill_buffer ()
 DS-MRR: Fill the buffer with rowids and sort it by rowid. More...
 
int dsmrr_next (char **range_info)
 
ha_rows dsmrr_info (uint keyno, uint n_ranges, uint keys, uint *bufsz, uint *flags, Cost_estimate *cost)
 
ha_rows dsmrr_info_const (uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, Cost_estimate *cost)
 

Private Member Functions

bool choose_mrr_impl (uint keyno, ha_rows rows, uint *flags, uint *bufsz, Cost_estimate *cost)
 DS-MRR Internals: Choose between Default MRR implementation and DS-MRR. More...
 
bool get_disk_sweep_mrr_cost (uint keynr, ha_rows rows, uint flags, uint *buffer_size, Cost_estimate *cost)
 Get cost of DS-MRR scan. More...
 

Private Attributes

handler *const h
 
TABLEtable
 
handlerh2
 
ucharrowids_buf
 
ucharrowids_buf_cur
 
ucharrowids_buf_last
 
ucharrowids_buf_end
 
bool dsmrr_eof
 
bool is_mrr_assoc
 
bool use_default_impl
 

Constructor & Destructor Documentation

◆ DsMrr_impl()

DsMrr_impl::DsMrr_impl ( handler owner)
inline

◆ ~DsMrr_impl()

DsMrr_impl::~DsMrr_impl ( )
inline

Member Function Documentation

◆ choose_mrr_impl()

bool DsMrr_impl::choose_mrr_impl ( uint  keyno,
ha_rows  rows,
uint *  flags,
uint *  bufsz,
Cost_estimate cost 
)
private

DS-MRR Internals: Choose between Default MRR implementation and DS-MRR.

Make the choice between using Default MRR implementation and DS-MRR. This function contains common functionality factored out of dsmrr_info() and dsmrr_info_const(). The function assumes that the default MRR implementation's applicability requirements are satisfied.

Parameters
keynoIndex number
rowsE(full rows to be retrieved)
flagsIN MRR flags provided by the MRR user OUT If DS-MRR is chosen, flags of DS-MRR implementation else the value is not modified
bufszIN If DS-MRR is chosen, buffer use of DS-MRR implementation else the value is not modified
costIN Cost of default MRR implementation OUT If DS-MRR is chosen, cost of DS-MRR scan else the value is not modified
Return values
trueDefault MRR implementation should be used
falseDS-MRR implementation should be used

◆ dsmrr_close()

void DsMrr_impl::dsmrr_close ( )

◆ dsmrr_fill_buffer()

int DsMrr_impl::dsmrr_fill_buffer ( )

DS-MRR: Fill the buffer with rowids and sort it by rowid.

{This is an internal function of DiskSweep MRR implementation} Scan the MRR ranges and collect ROWIDs (or {ROWID, range_id} pairs) into buffer. When the buffer is full or scan is completed, sort the buffer by rowid and return.

The function assumes that rowids buffer is empty when it is invoked.

Return values
0OK, the next portion of rowids is in the buffer, properly ordered
otherError

◆ dsmrr_info()

ha_rows DsMrr_impl::dsmrr_info ( uint  keyno,
uint  n_ranges,
uint  keys,
uint *  bufsz,
uint *  flags,
Cost_estimate cost 
)

◆ dsmrr_info_const()

ha_rows DsMrr_impl::dsmrr_info_const ( uint  keyno,
RANGE_SEQ_IF seq,
void *  seq_init_param,
uint  n_ranges,
uint *  bufsz,
uint *  flags,
Cost_estimate cost 
)

◆ dsmrr_init()

int DsMrr_impl::dsmrr_init ( RANGE_SEQ_IF seq_funcs,
void *  seq_init_param,
uint  n_ranges,
uint  mode,
HANDLER_BUFFER buf 
)

DS-MRR: Initialize and start MRR scan.

Initialize and start the MRR scan. Depending on the mode parameter, this may use default or DS-MRR implementation.

The DS-MRR implementation will use a second handler object (h2) for doing scan on the index:

  • on the first call to this function the h2 handler will be created and h2 will be opened using the same index as the main handler is set to use. The index scan on the main index will be closed and it will be re-opened to read records from the table using either no key or the primary key. The h2 handler will be deleted when reset() is called (which should happen on the end of the statement).
  • when dsmrr_close() is called the index scan on h2 is closed.
  • on following calls to this function one of the following must be valid: a. if dsmrr_close has been called: the main handler (h) must be open on an index, h2 will be opened using this index, and the index on h will be closed and h will be re-opened to read reads from the table using either no key or the primary key. b. dsmrr_close has not been called: h2 will already be open, the main handler h must be set up to read records from the table (handler->inited is RND) either using the primary index or using no index at all.
Parameters
seq_funcsInterval sequence enumeration functions
seq_init_paramInterval sequence enumeration parameter
n_rangesNumber of ranges in the sequence.
modeHA_MRR_* modes to use
[in,out]bufBuffer to use
Return values
0Ok, Scan started.
otherError

◆ dsmrr_next()

int DsMrr_impl::dsmrr_next ( char **  range_info)

◆ get_disk_sweep_mrr_cost()

bool DsMrr_impl::get_disk_sweep_mrr_cost ( uint  keynr,
ha_rows  rows,
uint  flags,
uint *  buffer_size,
Cost_estimate cost 
)
private

Get cost of DS-MRR scan.

Parameters
keynrIndex to be used
rowsE(Number of rows to be scanned)
flagsScan parameters (HA_MRR_* flags)
buffer_sizeINOUT Buffer size
costOUT The cost
Return values
falseOK
trueError, DS-MRR cannot be used (the buffer is too small for even 1 rowid)

◆ init()

void DsMrr_impl::init ( TABLE table_arg)
inline

Initialize the DsMrr_impl object.

This object is used for both doing default MRR scans and DS-MRR scans. This function just initializes the object. To do a DS-MRR scan, this must also be initialized by calling dsmrr_init().

Parameters
table_argpointer to the TABLE that owns the handler

◆ reset()

void DsMrr_impl::reset ( void  )

Resets the DS-MRR object to the state it had after being initialized.

If there is an open scan then it will be closed.

This function should be called by handler::ha_reset() which is called when a statement is completed in order to make the handler object ready for re-use by a different statement.

Member Data Documentation

◆ dsmrr_eof

bool DsMrr_impl::dsmrr_eof
private

◆ h

handler* const DsMrr_impl::h
private

◆ h2

handler* DsMrr_impl::h2
private

◆ is_mrr_assoc

bool DsMrr_impl::is_mrr_assoc
private

◆ rowids_buf

uchar* DsMrr_impl::rowids_buf
private

◆ rowids_buf_cur

uchar* DsMrr_impl::rowids_buf_cur
private

◆ rowids_buf_end

uchar* DsMrr_impl::rowids_buf_end
private

◆ rowids_buf_last

uchar* DsMrr_impl::rowids_buf_last
private

◆ table

TABLE* DsMrr_impl::table
private

◆ use_default_impl

bool DsMrr_impl::use_default_impl
private

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