MySQL 9.1.0
Source Code Documentation
Merge_chunk Struct Reference

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

#include <sql_sort.h>

Public Member Functions

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
 
const ucharvalid_buffer_end () const
 
void set_buffer (uchar *start, uchar *end)
 
void set_buffer_start (uchar *start)
 
void set_buffer_end (uchar *end)
 
void set_valid_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 = nullptr
 The current key for this chunk. More...
 
my_off_t m_file_position = 0
 Current position in the file to be sorted. More...
 
ucharm_buffer_start = nullptr
 Start of main-memory buffer for this chunk. More...
 
ucharm_buffer_end = nullptr
 End of main-memory buffer for this chunk. More...
 
ucharm_valid_buffer_end
 End of actual, valid data for this chunk. More...
 
ha_rows m_rowcount = 0
 Number of unread rows in this chunk. More...
 
ha_rows m_mem_count = 0
 Number of rows in the main-memory buffer. More...
 
ha_rows m_max_keys = 0
 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.

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

◆ set_valid_buffer_end()

void Merge_chunk::set_valid_buffer_end ( uchar end)
inline

◆ valid_buffer_end()

const uchar * Merge_chunk::valid_buffer_end ( ) const
inline

Member Data Documentation

◆ m_buffer_end

uchar* Merge_chunk::m_buffer_end = nullptr
private

End of main-memory buffer for this chunk.

◆ m_buffer_start

uchar* Merge_chunk::m_buffer_start = nullptr
private

Start of main-memory buffer for this chunk.

◆ m_current_key

uchar* Merge_chunk::m_current_key = nullptr
private

The current key for this chunk.

◆ m_file_position

my_off_t Merge_chunk::m_file_position = 0
private

Current position in the file to be sorted.

◆ m_max_keys

ha_rows Merge_chunk::m_max_keys = 0
private

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

◆ m_mem_count

ha_rows Merge_chunk::m_mem_count = 0
private

Number of rows in the main-memory buffer.

◆ m_rowcount

ha_rows Merge_chunk::m_rowcount = 0
private

Number of unread rows in this chunk.

◆ m_valid_buffer_end

uchar* Merge_chunk::m_valid_buffer_end
private

End of actual, valid data for this chunk.


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