MySQL 8.0.31
Source Code Documentation
log0files_governor.h File Reference

Redo log management of log files. More...

#include "log0files_dict.h"
#include "log0files_finder.h"
#include "log0types.h"
#include "os0file.h"
#include "srv0srv.h"

Go to the source code of this file.

Macros

#define log_files_mutex_enter(log)   mutex_enter(&((log).m_files_mutex))
 
#define log_files_mutex_exit(log)   mutex_exit(&((log).m_files_mutex))
 
#define log_files_mutex_own(log)   mutex_own(&((log).m_files_mutex))
 

Functions

bool log_files_governor_is_active ()
 Checks if log file governor thread is active. More...
 
dberr_t log_files_create (log_t &log, lsn_t flushed_lsn, lsn_t &checkpoint_lsn)
 Creates a new set of redo log files. More...
 
void log_files_remove (log_t &log)
 Removes all log files. More...
 
dberr_t log_files_produce_file (log_t &log)
 Creates a next log file, ready for writes. More...
 
dberr_t log_files_persist_flags (log_t &log, Log_flags log_flags)
 Persists log flags to the newest log file. More...
 
dberr_t log_files_reset_creator_and_set_full (log_t &log)
 Resets creator name to the current creator and marks all files as full in their headers by setting LOG_HEADER_FLAG_FILE_FULL bit in the log_flags field. More...
 
void log_files_wait_for_next_file_available (log_t &log)
 Waits until a next log file is available and can be produced. More...
 
void log_files_governor (log_t *log_ptr)
 The log files governor thread routine. More...
 
dberr_t log_files_start (log_t &log)
 Starts the log file management. More...
 
void log_files_initialize_on_empty_redo (log_t &log)
 Computes initial capacity limits and size suggested for the next log file. More...
 
void log_files_initialize_on_existing_redo (log_t &log)
 Computes initial capacity limits and size suggested for the next log file. More...
 
void log_files_resize_requested (log_t &log)
 Updates capacity limitations after srv_redo_log_capacity_used has been changed. More...
 
void log_files_thread_concurrency_updated (log_t &log)
 Updates capacity limitations after srv_thread_concurrency has been changed. More...
 
void log_files_dummy_records_disable (log_t &log)
 Disallows to generate dummy redo records and waits until the log_files_governor thread promised not to generate them. More...
 
void log_files_dummy_records_request_disable (log_t &log)
 Disallows to generate dummy redo records but does not wait until the log_files_governor promised not to generate them anymore. More...
 
void log_files_update_encryption (log_t &log, const Encryption_metadata &encryption_metadata)
 Updates the encryption metadata stored in-memory for all redo log files. More...
 

Detailed Description

Redo log management of log files.

Macro Definition Documentation

◆ log_files_mutex_enter

#define log_files_mutex_enter (   log)    mutex_enter(&((log).m_files_mutex))

◆ log_files_mutex_exit

#define log_files_mutex_exit (   log)    mutex_exit(&((log).m_files_mutex))

◆ log_files_mutex_own

#define log_files_mutex_own (   log)    mutex_own(&((log).m_files_mutex))

Function Documentation

◆ log_files_create()

dberr_t log_files_create ( log_t log,
lsn_t  flushed_lsn,
lsn_t checkpoint_lsn 
)

Creates a new set of redo log files.

Remarks
Before creating the new log files, function asserts that there are no existing log files in the directory specified for the redo log. The new set of log files starts at the beginning of the first log block after the given lsn (block which start_lsn is greater than the given flushed_lsn). Checkpoint is written LOG_BLOCK_HDR_SIZE bytes after the beginning of that block. The set is marked as initialized if this call succeeded and information about the initial LSN is emitted to the error log. In such case, a new value is generated and assigned to the log.m_log_uuid (identifying the new log files).
Parameters
[in,out]logredo log
[in]flushed_lsnthe new set of log files should start with log block which first data byte is addressed by lsn greater or equal to this value
[out]checkpoint_lsnlsn of the first created checkpoint
Returns
DB_SUCCESS or error code

◆ log_files_dummy_records_disable()

void log_files_dummy_records_disable ( log_t log)

Disallows to generate dummy redo records and waits until the log_files_governor thread promised not to generate them.

Parameters
[in,out]logredo log

◆ log_files_dummy_records_request_disable()

void log_files_dummy_records_request_disable ( log_t log)

Disallows to generate dummy redo records but does not wait until the log_files_governor promised not to generate them anymore.

Parameters
[in,out]logredo log

◆ log_files_governor()

void log_files_governor ( log_t log_ptr)

The log files governor thread routine.

Parameters
[in,out]log_ptrpointer to redo log

◆ log_files_governor_is_active()

bool log_files_governor_is_active ( )
inline

Checks if log file governor thread is active.

Returns
true if and only if the log checkpointer thread is active

◆ log_files_initialize_on_empty_redo()

void log_files_initialize_on_empty_redo ( log_t log)

Computes initial capacity limits and size suggested for the next log file.

Called when logically empty redo log is being initialized.

Parameters
[in,out]logredo log

◆ log_files_initialize_on_existing_redo()

void log_files_initialize_on_existing_redo ( log_t log)

Computes initial capacity limits and size suggested for the next log file.

Called after existing redo log files have been discovered (log.m_files).

Parameters
[in,out]logredo log

◆ log_files_persist_flags()

dberr_t log_files_persist_flags ( log_t log,
Log_flags  log_flags 
)

Persists log flags to the newest log file.

Flushes header of the log file and updates log.m_log_flags if succeeded.

Parameters
[in,out]logredo log
[in]log_flagslog_flags to persist
Returns
DB_SUCCESS or error

◆ log_files_produce_file()

dberr_t log_files_produce_file ( log_t log)

Creates a next log file, ready for writes.

Updates log.m_current_file.

Parameters
[in,out]logredo log
Return values
DB_SUCCESSif created successfully
DB_OUT_OF_DISK_SPACEif there was no free space to create next file, according to limitations we have for redo files, or according to space physically available on the disk
othererrors are possible

◆ log_files_remove()

void log_files_remove ( log_t log)

Removes all log files.

Parameters
[in,out]logredo log

◆ log_files_reset_creator_and_set_full()

dberr_t log_files_reset_creator_and_set_full ( log_t log)

Resets creator name to the current creator and marks all files as full in their headers by setting LOG_HEADER_FLAG_FILE_FULL bit in the log_flags field.

Flushes headers of all log files and updates log.m_creator_name and log.m_files accordingly if succeeded (if fails, then some files might remain updated and some not; metadata stored in log.m_files should reflect that).

Parameters
[in,out]logredo log
Returns
DB_SUCCESS or error

◆ log_files_resize_requested()

void log_files_resize_requested ( log_t log)

Updates capacity limitations after srv_redo_log_capacity_used has been changed.

It is called when user requests to change innodb_redo_log_capacity in runtime.

Parameters
[in,out]logredo log

◆ log_files_start()

dberr_t log_files_start ( log_t log)

Starts the log file management.

Parameters
[in]logredo log
Returns
DB_SUCCESS or error

Existing log files are marked as not consumed.

◆ log_files_thread_concurrency_updated()

void log_files_thread_concurrency_updated ( log_t log)

Updates capacity limitations after srv_thread_concurrency has been changed.

It is called when user requests to change innodb_thread_concurrency in runtime.

Parameters
[in,out]logredo log

◆ log_files_update_encryption()

void log_files_update_encryption ( log_t log,
const Encryption_metadata encryption_metadata 
)

Updates the encryption metadata stored in-memory for all redo log files.

Caller needs to have the log.m_files_mutex acquired before calling this.

Parameters
[in,out]logredo log
[in]encryption_metadataencryption metadata

◆ log_files_wait_for_next_file_available()

void log_files_wait_for_next_file_available ( log_t log)

Waits until a next log file is available and can be produced.

Parameters
[in]logredo log