MySQL 8.0.39
Source Code Documentation
log0files_dict.h File Reference

In-memory dictionary of log files (keeps their meta data). More...

#include <algorithm>
#include <iterator>
#include "log0types.h"
#include "os0file.h"
#include "ut0ut.h"

Go to the source code of this file.

Classes

class  Log_files_dict
 In-memory dictionary of meta data of existing log files. More...
 
class  Log_files_dict::Const_iterator
 

Functions

template<typename F >
void log_files_for_each (const Log_files_dict &files, F functor)
 
template<typename F >
void log_files_for_each (const Log_files_dict &files, lsn_t start_lsn, lsn_t end_lsn, F functor)
 Calls the given functor for each of existing log files on path from a file containing start_lsn to a file containing end_lsn - 1. More...
 
bool log_file_compute_logical_capacity (os_offset_t file_size_in_bytes, lsn_t &lsn_capacity)
 Computes logical capacity for the given physical size of the redo log file. More...
 
bool log_file_compute_end_lsn (lsn_t start_lsn, os_offset_t file_size_in_bytes, lsn_t &end_lsn)
 Computes end_lsn for the given: start_lsn and size of the redo log file. More...
 
size_t log_files_number_of_existing_files (const Log_files_dict &files)
 Counts the total number of existing log files. More...
 
size_t log_files_number_of_consumed_files (const Log_files_dict &files)
 Counts the total number of existing and marked as consumed log files. More...
 
os_offset_t log_files_size_of_existing_files (const Log_files_dict &files)
 Computes the total size of the existing log files (sum of sizes). More...
 
lsn_t log_files_capacity_of_existing_files (const Log_files_dict &files)
 Computes the total capacity of the existing log files (sum of capacities). More...
 
Log_files_dict::Const_iterator log_files_find_largest (const Log_files_dict &files)
 Finds the largest existing log file (with the largest m_size_in_bytes). More...
 

Detailed Description

In-memory dictionary of log files (keeps their meta data).

The dictionary is built by the

See also
log_files_find_and_analyze().

Function Documentation

◆ log_file_compute_end_lsn()

bool log_file_compute_end_lsn ( lsn_t  start_lsn,
os_offset_t  file_size_in_bytes,
lsn_t end_lsn 
)

Computes end_lsn for the given: start_lsn and size of the redo log file.

Parameters
[in]start_lsnLSN of the first data byte within the file
[in]file_size_in_bytestotal size of file, expressed in bytes
[out]end_lsnLSN after the last data byte within the file
Return values
truesucceeded to compute end_lsn
falseparams were invalid

◆ log_file_compute_logical_capacity()

bool log_file_compute_logical_capacity ( os_offset_t  file_size_in_bytes,
lsn_t lsn_capacity 
)

Computes logical capacity for the given physical size of the redo log file.

Parameters
[in]file_size_in_bytestotal size of file, expressed in bytes
[out]lsn_capacitylogical capacity of the file
Return values
truesucceeded to compute the logical capacity
falseparams were invalid (file size was too small or too big)

◆ log_files_capacity_of_existing_files()

lsn_t log_files_capacity_of_existing_files ( const Log_files_dict files)

Computes the total capacity of the existing log files (sum of capacities).

Note
Capacity of a file is smaller than size of the file by LOG_FILE_HDR_SIZE.
Parameters
[in]filesin-memory dictionary of log files
Returns
computed total capacity of existing log files

◆ log_files_find_largest()

Log_files_dict::Const_iterator log_files_find_largest ( const Log_files_dict files)

Finds the largest existing log file (with the largest m_size_in_bytes).

Parameters
[in]filesin-memory dictionary of log files
Returns
the largest file or files.end() if there is no file at all

◆ log_files_for_each() [1/2]

template<typename F >
void log_files_for_each ( const Log_files_dict files,
functor 
)

◆ log_files_for_each() [2/2]

template<typename F >
void log_files_for_each ( const Log_files_dict files,
lsn_t  start_lsn,
lsn_t  end_lsn,
functor 
)

Calls the given functor for each of existing log files on path from a file containing start_lsn to a file containing end_lsn - 1.

Asserts that such a path exists (going through existing log files). When the range is empty (start_lsn >= end_lsn), no file is visited.

Parameters
[in]filesin-memory dictionary of log files
[in]start_lsnpath starts at file reported by find(start_lsn)
[in]end_lsnpath ends in file with m_end_lsn >= end_lsn
[in]functorfunctor receiving a reference to Log_file

◆ log_files_number_of_consumed_files()

size_t log_files_number_of_consumed_files ( const Log_files_dict files)

Counts the total number of existing and marked as consumed log files.

Parameters
[in]filesin-memory dictionary of log files
Returns
number of existing and marked as consumed log files.

◆ log_files_number_of_existing_files()

size_t log_files_number_of_existing_files ( const Log_files_dict files)

Counts the total number of existing log files.

Parameters
[in]filesin-memory dictionary of log files
Returns
number of existing log files.

◆ log_files_size_of_existing_files()

os_offset_t log_files_size_of_existing_files ( const Log_files_dict files)

Computes the total size of the existing log files (sum of sizes).

Note
Each file starts with LOG_FILE_HDR_SIZE bytes of headers.
Parameters
[in]filesin-memory dictionary of log files
Returns
computed total size of existing log files