MySQL  8.0.27
Source Code Documentation
Merge_chunk Struct Reference

Descriptor for a merge chunk to be sort-merged. More...

#include <sql_sort.h>

Public Member Functions

 Merge_chunk ()
 
my_off_t file_position () const
 
void set_file_position (my_off_t val)
 
void advance_file_position (my_off_t val)
 
ucharbuffer_start ()
 
const ucharbuffer_end () const
 
void set_buffer (uchar *start, uchar *end)
 
void set_buffer_start (uchar *start)
 
void set_buffer_end (uchar *end)
 
void init_current_key ()
 
ucharcurrent_key () const
 
void advance_current_key (uint val)
 
void decrement_rowcount (ha_rows val)
 
void set_rowcount (ha_rows val)
 
ha_rows rowcount () const
 
ha_rows mem_count () const
 
void set_mem_count (ha_rows val)
 
ha_rows decrement_mem_count ()
 
ha_rows max_keys () const
 
void set_max_keys (ha_rows val)
 
size_t buffer_size () const
 
bool merge_freed_buff (Merge_chunk *mc) const
 Tries to merge *this with *mc, returns true if successful. More...
 

Private Attributes

ucharm_current_key
 The current key for this chunk. More...
 
my_off_t m_file_position
 Current position in the file to be sorted. More...
 
ucharm_buffer_start
 Start of main-memory buffer for this chunk. More...
 
ucharm_buffer_end
 End of main-memory buffer for this chunk. More...
 
ha_rows m_rowcount
 Number of unread rows in this chunk. More...
 
ha_rows m_mem_count
 Number of rows in the main-memory buffer. More...
 
ha_rows m_max_keys
 If we have fixed-size rows: max number of rows in buffer. More...
 

Detailed Description

Descriptor for a merge chunk to be sort-merged.

A merge chunk is a sequence of pre-sorted records, written to a temporary file. A Merge_chunk instance describes where this chunk is stored in the file, and where it is located when it is in memory.

It is a POD because we read/write them from/to files (but note, only m_file_position and m_rowcount are actually used in that situation).

We have accessors (getters/setters) for all struct members.

Constructor & Destructor Documentation

◆ Merge_chunk()

Merge_chunk::Merge_chunk ( )
inline

Member Function Documentation

◆ advance_current_key()

void Merge_chunk::advance_current_key ( uint  val)
inline

◆ advance_file_position()

void Merge_chunk::advance_file_position ( my_off_t  val)
inline

◆ buffer_end()

const uchar* Merge_chunk::buffer_end ( ) const
inline

◆ buffer_size()

size_t Merge_chunk::buffer_size ( ) const
inline

◆ buffer_start()

uchar* Merge_chunk::buffer_start ( )
inline

◆ current_key()

uchar* Merge_chunk::current_key ( ) const
inline

◆ decrement_mem_count()

ha_rows Merge_chunk::decrement_mem_count ( )
inline

◆ decrement_rowcount()

void Merge_chunk::decrement_rowcount ( ha_rows  val)
inline

◆ file_position()

my_off_t Merge_chunk::file_position ( ) const
inline

◆ init_current_key()

void Merge_chunk::init_current_key ( )
inline

◆ max_keys()

ha_rows Merge_chunk::max_keys ( ) const
inline

◆ mem_count()

ha_rows Merge_chunk::mem_count ( ) const
inline

◆ merge_freed_buff()

bool Merge_chunk::merge_freed_buff ( Merge_chunk mc) const
inline

Tries to merge *this with *mc, returns true if successful.

The assumption is that *this is no longer in use, and the space it has been allocated can be handed over to a buffer which is adjacent to it.

◆ rowcount()

ha_rows Merge_chunk::rowcount ( ) const
inline

◆ set_buffer()

void Merge_chunk::set_buffer ( uchar start,
uchar end 
)
inline

◆ set_buffer_end()

void Merge_chunk::set_buffer_end ( uchar end)
inline

◆ set_buffer_start()

void Merge_chunk::set_buffer_start ( uchar start)
inline

◆ set_file_position()

void Merge_chunk::set_file_position ( my_off_t  val)
inline

◆ set_max_keys()

void Merge_chunk::set_max_keys ( ha_rows  val)
inline

◆ set_mem_count()

void Merge_chunk::set_mem_count ( ha_rows  val)
inline

◆ set_rowcount()

void Merge_chunk::set_rowcount ( ha_rows  val)
inline

Member Data Documentation

◆ m_buffer_end

uchar* Merge_chunk::m_buffer_end
private

End of main-memory buffer for this chunk.

◆ m_buffer_start

uchar* Merge_chunk::m_buffer_start
private

Start of main-memory buffer for this chunk.

◆ m_current_key

uchar* Merge_chunk::m_current_key
private

The current key for this chunk.

◆ m_file_position

my_off_t Merge_chunk::m_file_position
private

Current position in the file to be sorted.

◆ m_max_keys

ha_rows Merge_chunk::m_max_keys
private

If we have fixed-size rows: max number of rows in buffer.

◆ m_mem_count

ha_rows Merge_chunk::m_mem_count
private

Number of rows in the main-memory buffer.

◆ m_rowcount

ha_rows Merge_chunk::m_rowcount
private

Number of unread rows in this chunk.


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