MySQL 8.0.39
Source Code Documentation
Binlog_cache_compressor Class Reference

Controls the execution flow when we compress the transaction cache into memory and write back the compressed data to the transaction cache. More...

Public Member Functions

 Binlog_cache_compressor (THD &thd, binlog_cache_data &cache)
 Construct a new Binlog_cache_compressor capable of compressing the given binlog_cache_data object. More...
 
 Binlog_cache_compressor (const Binlog_cache_compressor &)=delete
 
 Binlog_cache_compressor (Binlog_cache_compressor &&)=delete
 
Binlog_cache_compressoroperator= (const Binlog_cache_compressor &)=delete
 
Binlog_cache_compressoroperator= (Binlog_cache_compressor &&)=delete
 
 ~Binlog_cache_compressor ()
 
bool compress ()
 Attempt to compress the transaction cache. More...
 

Private Member Functions

bool shall_compress ()
 Determine if compression should be attempted for the current transaction. More...
 
bool setup_compressor ()
 Get and configure the compressor; update m_compressor. More...
 
bool setup_buffer_sequence ()
 Get and configure the Managed_buffer_sequence; update m_managed_buffer_sequence. More...
 
bool compress_to_buffer_sequence ()
 Compress the transaction cache using the compressor, and and store the output in the Managed_buffer_sequence. More...
 
bool get_payload_event_from_buffer_sequence (Transaction_payload_log_event &tple)
 Populate the given Transaction_payload_log_event with compressed data. More...
 
bool overwrite_cache_with_payload_event (Transaction_payload_log_event &tple)
 Truncate the transaction cache and write the Transaction_payload_log_event there instead. More...
 

Private Attributes

THDm_thd
 Session context. More...
 
binlog_cache_datam_cache
 Transaction cache. More...
 
Binlog_cache_storagem_cache_storage
 Storage for the transaction cache. More...
 
Transaction_compression_ctxm_context
 Session compression context. More...
 
Transaction_compression_ctx::Compressor_ptr_t m_compressor
 Compressor. More...
 
Transaction_compression_ctx::Managed_buffer_sequence_tm_managed_buffer_sequence
 Output buffer. More...
 
size_t m_uncompressed_size
 Size before compression. More...
 
size_t m_compressed_size
 Size after compression, if compression succeeded. More...
 
binary_log::transaction::compression::type m_compression_type
 Compression algorithm, if compression succeded; otherwise NONE. More...
 

Detailed Description

Controls the execution flow when we compress the transaction cache into memory and write back the compressed data to the transaction cache.

This is meant to be constructed once per transaction, and used once to compress an existing transaction cache. It relies on RAII to perform final actions in the destructor, so it should normally be constructed on the stack.

Constructor & Destructor Documentation

◆ Binlog_cache_compressor() [1/3]

Binlog_cache_compressor::Binlog_cache_compressor ( THD thd,
binlog_cache_data cache 
)
inline

Construct a new Binlog_cache_compressor capable of compressing the given binlog_cache_data object.

◆ Binlog_cache_compressor() [2/3]

Binlog_cache_compressor::Binlog_cache_compressor ( const Binlog_cache_compressor )
delete

◆ Binlog_cache_compressor() [3/3]

Binlog_cache_compressor::Binlog_cache_compressor ( Binlog_cache_compressor &&  )
delete

◆ ~Binlog_cache_compressor()

Binlog_cache_compressor::~Binlog_cache_compressor ( )
inline

Member Function Documentation

◆ compress()

bool Binlog_cache_compressor::compress ( )
inline

Attempt to compress the transaction cache.

Return values
falseThe transaction cache is either unchanged, or has been successfully replaced by the compressed transaction.
trueThe transaction cache has been corrupted, e.g. because an IO error occurred while replacing it, so the transaction has to abort.

◆ compress_to_buffer_sequence()

bool Binlog_cache_compressor::compress_to_buffer_sequence ( )
inlineprivate

Compress the transaction cache using the compressor, and and store the output in the Managed_buffer_sequence.

Returns
true on error, false on success.

◆ get_payload_event_from_buffer_sequence()

bool Binlog_cache_compressor::get_payload_event_from_buffer_sequence ( Transaction_payload_log_event tple)
inlineprivate

Populate the given Transaction_payload_log_event with compressed data.

Returns
true on error, false on success.

◆ operator=() [1/2]

Binlog_cache_compressor & Binlog_cache_compressor::operator= ( Binlog_cache_compressor &&  )
delete

◆ operator=() [2/2]

Binlog_cache_compressor & Binlog_cache_compressor::operator= ( const Binlog_cache_compressor )
delete

◆ overwrite_cache_with_payload_event()

bool Binlog_cache_compressor::overwrite_cache_with_payload_event ( Transaction_payload_log_event tple)
inlineprivate

Truncate the transaction cache and write the Transaction_payload_log_event there instead.

Returns
true on error, false on success.

◆ setup_buffer_sequence()

bool Binlog_cache_compressor::setup_buffer_sequence ( )
inlineprivate

Get and configure the Managed_buffer_sequence; update m_managed_buffer_sequence.

Returns
true on error, false on success.

◆ setup_compressor()

bool Binlog_cache_compressor::setup_compressor ( )
inlineprivate

Get and configure the compressor; update m_compressor.

Returns
true on error, false on success.

◆ shall_compress()

bool Binlog_cache_compressor::shall_compress ( )
inlineprivate

Determine if compression should be attempted for the current transaction.

Return values
truecompression should be attempted
falsecompression should not be attempted

Member Data Documentation

◆ m_cache

binlog_cache_data& Binlog_cache_compressor::m_cache
private

Transaction cache.

◆ m_cache_storage

Binlog_cache_storage& Binlog_cache_compressor::m_cache_storage
private

Storage for the transaction cache.

◆ m_compressed_size

size_t Binlog_cache_compressor::m_compressed_size
private

Size after compression, if compression succeeded.

Otherwise, size before compression.

◆ m_compression_type

binary_log::transaction::compression::type Binlog_cache_compressor::m_compression_type
private

Compression algorithm, if compression succeded; otherwise NONE.

◆ m_compressor

Transaction_compression_ctx::Compressor_ptr_t Binlog_cache_compressor::m_compressor
private

Compressor.

◆ m_context

Transaction_compression_ctx& Binlog_cache_compressor::m_context
private

Session compression context.

◆ m_managed_buffer_sequence

Transaction_compression_ctx::Managed_buffer_sequence_t& Binlog_cache_compressor::m_managed_buffer_sequence
private

Output buffer.

◆ m_thd

THD& Binlog_cache_compressor::m_thd
private

Session context.

◆ m_uncompressed_size

size_t Binlog_cache_compressor::m_uncompressed_size
private

Size before compression.


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