MySQL 8.3.0
Source Code Documentation
ddl::Merge_file_sort::Output_file Struct Reference

For writing out the merged rows. More...

Inheritance diagram for ddl::Merge_file_sort::Output_file:
[legend]

Public Member Functions

 Output_file (ddl::Context &ctx, const Unique_os_file_descriptor &file, IO_buffer io_buffer) noexcept
 Constructor. More...
 
 ~Output_file ()=default
 Destructor. More...
 
void init (const dict_index_t *index) noexcept
 Initialize the duplicate check infrastructure. More...
 
dberr_t write (const mrec_t *mrec, const ulint *offsets, Dup *dup) noexcept
 Write the row to the buffer. More...
 
dberr_t flush () noexcept
 Write end of block marker and flush buffer to disk. More...
 
os_offset_t get_size () const
 
uint64_t get_n_rows () const noexcept
 

Static Public Attributes

static constexpr uint64_t TRX_INTERRUPTED_CHECK = 64
 The transaction interrupted check is expensive, we check after this many page writes. More...
 

Private Types

using Offsets = std::vector< ulint, ut::allocator< ulint > >
 Limit is [start, end]. More...
 

Private Member Functions

size_t copied () const noexcept
 
void duplicate_check (const mrec_t *mrec, const ulint *offsets, Dup *dup) noexcept
 Do a duplicate check against the incoming record. More...
 
- Private Member Functions inherited from ut::Non_copyable
 Non_copyable (const Non_copyable &)=delete
 
Non_copyableoperator= (const Non_copyable &)=delete
 
 Non_copyable ()=default
 
 ~Non_copyable ()=default
 

Private Attributes

ddl::Contextm_ctx
 DDL context. More...
 
const Unique_os_file_descriptorm_file
 File to write to. More...
 
IO_buffer m_buffer
 Buffer to write to (output buffer). More...
 
bytem_ptr {}
 Start writing new bytes at this offset. More...
 
os_offset_t m_offset {}
 Total number of bytes written. More...
 
Offsets m_offsets {}
 Offsets of the last inserted row. More...
 
mrec_tm_last_mrec {}
 Pointer to last record in the output buffer. More...
 
uint64_t m_n_rows {}
 Number of rows read/written. More...
 
uint64_t m_interrupt_check {}
 Counter for checking trx_is_interrupted. More...
 

Detailed Description

For writing out the merged rows.

Member Typedef Documentation

◆ Offsets

Limit is [start, end].

Constructor & Destructor Documentation

◆ Output_file()

ddl::Merge_file_sort::Output_file::Output_file ( ddl::Context ctx,
const Unique_os_file_descriptor file,
IO_buffer  io_buffer 
)
inlinenoexcept

Constructor.

Parameters
[in,out]ctxDDL context.
[in]fileFile to write to.
[in]io_bufferBuffer to store records and write to file.

◆ ~Output_file()

ddl::Merge_file_sort::Output_file::~Output_file ( )
default

Destructor.

Member Function Documentation

◆ copied()

size_t ddl::Merge_file_sort::Output_file::copied ( ) const
inlineprivatenoexcept
Returns
the number of bytes copied so far.

◆ duplicate_check()

void ddl::Merge_file_sort::Output_file::duplicate_check ( const mrec_t mrec,
const ulint offsets,
Dup dup 
)
privatenoexcept

Do a duplicate check against the incoming record.

Parameters
[in]mrecRow to write.
[in]offsetsColumn offsets in row.
[in,out]dupFor duplicate checks.

◆ flush()

dberr_t ddl::Merge_file_sort::Output_file::flush ( )
noexcept

Write end of block marker and flush buffer to disk.

Returns
DB_SUCCESS or error code.

◆ get_n_rows()

uint64_t ddl::Merge_file_sort::Output_file::get_n_rows ( ) const
inlinenoexcept
Returns
number of rows in the output file.

◆ get_size()

os_offset_t ddl::Merge_file_sort::Output_file::get_size ( ) const
inline
Returns
the current size of the output file in bytes.

◆ init()

void ddl::Merge_file_sort::Output_file::init ( const dict_index_t index)
inlinenoexcept

Initialize the duplicate check infrastructure.

Parameters
[in]indexDDL index.

◆ write()

dberr_t ddl::Merge_file_sort::Output_file::write ( const mrec_t mrec,
const ulint offsets,
Dup dup 
)
noexcept

Write the row to the buffer.

If the buffer fills up write the buffer to the output file.

Parameters
[in]mrecRow to write.
[in]offsetsColumn offsets in row.
[in,out]dupFor duplicate checks.
Returns
DB_SUCCESS or error code.

Member Data Documentation

◆ m_buffer

IO_buffer ddl::Merge_file_sort::Output_file::m_buffer
private

Buffer to write to (output buffer).

◆ m_ctx

ddl::Context& ddl::Merge_file_sort::Output_file::m_ctx
private

DDL context.

◆ m_file

const Unique_os_file_descriptor& ddl::Merge_file_sort::Output_file::m_file
private

File to write to.

◆ m_interrupt_check

uint64_t ddl::Merge_file_sort::Output_file::m_interrupt_check {}
private

Counter for checking trx_is_interrupted.

◆ m_last_mrec

mrec_t* ddl::Merge_file_sort::Output_file::m_last_mrec {}
private

Pointer to last record in the output buffer.

◆ m_n_rows

uint64_t ddl::Merge_file_sort::Output_file::m_n_rows {}
private

Number of rows read/written.

◆ m_offset

os_offset_t ddl::Merge_file_sort::Output_file::m_offset {}
private

Total number of bytes written.

◆ m_offsets

Offsets ddl::Merge_file_sort::Output_file::m_offsets {}
private

Offsets of the last inserted row.

◆ m_ptr

byte* ddl::Merge_file_sort::Output_file::m_ptr {}
private

Start writing new bytes at this offset.

◆ TRX_INTERRUPTED_CHECK

constexpr uint64_t ddl::Merge_file_sort::Output_file::TRX_INTERRUPTED_CHECK = 64
staticconstexpr

The transaction interrupted check is expensive, we check after this many page writes.


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