MySQL 8.0.39
Source Code Documentation
|
Classes | |
class | Block |
Encapsulates a log block of size QUEUE_BLOCK_SIZE, enqueued by the producer, dequeued by the consumer and written into the redo log archive file. More... | |
class | Dynamic_procedures |
This component's UDFs.mysql. More... | |
class | Guardian |
class | Queue |
This template class implements a queue that,. More... | |
Functions | |
int | validate_redo_log_archive_dirs (THD *thd, SYS_VAR *var, void *save, st_mysql_value *value) |
Check whether a valid value is given to innodb_redo_log_archive_dirs. More... | |
void | redo_log_archive_init () |
Initialize redo log archiving. More... | |
void | redo_log_archive_deinit () |
De-initialize redo log archiving. More... | |
void | redo_log_archive_session_end (innodb_session_t *session) |
Security function to be called when the current session ends. More... | |
void | redo_log_archive_produce (const byte *write_buf, const size_t write_size) |
The producer produces full QUEUE_BLOCK_SIZE redo log blocks. More... | |
bool | redo_log_archive_is_active () |
bool | register_privilege (const char *priv_name) |
Register a privilege. More... | |
static void | redo_log_archive_consumer () |
Dequeue blocks of size QUEUE_BLOCK_SIZE, enqueued by the producer. More... | |
static bool | terminate_consumer (bool rapid) |
static bool | consumer_is_running () |
static bool | consumer_not_running () |
static bool | consumer_not_flushed () |
static bool | timeout (bool(*wait_condition)()) |
Timeout function. More... | |
bool | innodb_redo_log_archive_start_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_archive_start. More... | |
void | innodb_redo_log_archive_start_deinit (UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_archive_start. More... | |
long long | innodb_redo_log_archive_start (UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_archive_start. More... | |
bool | innodb_redo_log_archive_stop_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_archive_stop. More... | |
void | innodb_redo_log_archive_stop_deinit (UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_archive_stop. More... | |
long long | innodb_redo_log_archive_stop (UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_archive_stop. More... | |
bool | innodb_redo_log_archive_flush_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_archive_flush. More... | |
void | innodb_redo_log_archive_flush_deinit (UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_archive_flush. More... | |
long long | innodb_redo_log_archive_flush (UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_archive_flush. More... | |
bool | innodb_redo_log_sharp_checkpoint_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_sharp_checkpoint. More... | |
void | innodb_redo_log_sharp_checkpoint_deinit (UDF_INIT *initid) |
long long | innodb_redo_log_sharp_checkpoint ( UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_sharp_checkpoint. More... | |
bool | innodb_redo_log_consumer_register_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_consumer_register. More... | |
void | innodb_redo_log_consumer_register_deinit ([[maybe_unused]] UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_consumer_register. More... | |
long long | innodb_redo_log_consumer_register ( UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_consumer_register. More... | |
bool | innodb_redo_log_consumer_unregister_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_consumer_unregister. More... | |
void | innodb_redo_log_consumer_unregister_deinit ([[maybe_unused]] UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_consumer_unregister. More... | |
long long | innodb_redo_log_consumer_unregister ( UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_consumer_unregister. More... | |
bool | innodb_redo_log_consumer_advance_init (UDF_INIT *initid, UDF_ARGS *args, char *message) |
Initialize UDF innodb_redo_log_consumer_advance. More... | |
void | innodb_redo_log_consumer_advance_deinit (UDF_INIT *initid) |
long long | innodb_redo_log_consumer_advance ( UDF_INIT *initid, UDF_ARGS *args, unsigned char *null_value, unsigned char *error) |
UDF innodb_redo_log_consumer_advance. More... | |
static bool | drop_remnants (bool force) |
Drop potential left-over resources to avoid leaks. More... | |
static bool | verify_privilege (THD *thd, const char *priv_name) |
Verify that thd has a certain privilege. More... | |
static bool | get_labeled_directory (const char *label, std::string *dir) |
Get the directory behind the label in a semi-colon separated list of labeled directories. More... | |
static bool | verify_no_world_permissions (const Fil_path &path) |
Verify that a file system object does not grant permissions to everyone. More... | |
static std::string | trim_path_name (const std::string &path_name) |
Trim trailing directory delimiters from a path name. More... | |
static std::string | delimit_dir_name (const std::string &path_name) |
Append a trailing directory delimiter to a path name. More... | |
static void | append_path (const char *variable_name, const char *path_name, std::vector< std::string > *variables, std::vector< Fil_path > *directories) |
Append a path to a vector of directory paths. More... | |
static bool | verify_no_server_directory (const Fil_path &path) |
Verify that a path name is not in, under, or above a server directory. More... | |
static void | construct_file_pathname (const Fil_path &path, std::string *file_pathname) |
Construct the file path name as directory/archive.serverUUID.000001.log. More... | |
static bool | construct_secure_file_path_name (const char *label, const char *subdir, std::string *file_pathname) |
Execute security checks and construct a file path name. More... | |
static bool | redo_log_archive_start (THD *thd, const char *label, const char *subdir) |
static bool | redo_log_archive_stop (THD *thd) |
static bool | redo_log_archive_flush (THD *thd) |
static bool | redo_log_consumer_register (innodb_session_t *session) |
static bool | redo_log_consumer_unregister (innodb_session_t *session) |
static bool | redo_log_consumer_advance (innodb_session_t *session, lsn_t lsn) |
static void | handle_write_error (uint64_t file_offset) |
Handle a write error. More... | |
void | innodb_redo_log_sharp_checkpoint_deinit ([[maybe_unused]] UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_sharp_checkpoint. More... | |
void | innodb_redo_log_consumer_advance_deinit ([[maybe_unused]] UDF_INIT *initid) |
Deinitialize UDF innodb_redo_log_consumer_advance. More... | |
Variables | |
mysql_pfs_key_t | redo_log_archive_consumer_thread_key |
Performance schema key for the log consumer thread. More... | |
mysql_pfs_key_t | redo_log_archive_file_key |
Performance schema key for the redo log archive file. More... | |
char * | redo_log_archive_dirs {} |
constexpr const char * | innodb_redo_log_archive_privilege |
constexpr const char * | backup_admin_privilege {"BACKUP_ADMIN"} |
constexpr const char * | logmsgpfx {"innodb_redo_log_archive: "} |
constexpr size_t | QUEUE_BLOCK_SIZE = 4096 |
constexpr size_t | QUEUE_SIZE_MAX = 16384 |
static std::atomic< bool > | redo_log_archive_initialized {} |
static ib_mutex_t | redo_log_archive_admin_mutex |
Mutex to synchronize start and stop of the redo log archiving. More... | |
static bool | redo_log_archive_active {false} |
Boolean indicating whether the redo log archiving is active. More... | |
static innodb_session_t * | redo_log_archive_session {} |
Session. More... | |
static THD * | redo_log_archive_thd {} |
static bool | redo_log_archive_session_ending {false} |
static std::string | redo_log_archive_recorded_error {} |
Error message recorded during redo log archiving. More... | |
static std::string | redo_log_archive_file_pathname {} |
String containing the redo log archive filename. More... | |
static pfs_os_file_t | redo_log_archive_file_handle {} |
The file handle to the redo log archive file. More... | |
static bool | redo_log_archive_consume_running {false} |
Whether the consumer thread is running. More... | |
static bool | redo_log_archive_consume_complete {true} |
Whether the consumer has completed. More... | |
static os_event_t | redo_log_archive_consume_event {} |
Event to inform that the consumer has exited after purging all the queue elements or that it got a flush block. More... | |
static bool | redo_log_archive_consume_flushed {false} |
Whether the consumer has copied a flush block. More... | |
static bool | redo_log_archive_produce_blocks {false} |
Boolean indicating whether to produce queue blocks. More... | |
static Block | redo_log_archive_tmp_block {} |
Temporary block used to build complete redo log blocks of size QUEUE_BLOCK_SIZE by the producer. More... | |
static Queue< Block > | redo_log_archive_queue {} |
Queue into which the producer enqueues redo log blocks of size QUEUE_BLOCK_SIZE, and from which the consumer reads redo log blocks of size QUEUE_BLOCK_SIZE. More... | |
Dynamic_procedures | s_dynamic_procedures |
static std::unique_ptr< Log_user_consumer > | log_meb_consumer |
static innodb_session_t * | log_meb_consumer_session |
|
static |
Append a path to a vector of directory paths.
Append a variable name to a vector of variable names. The variable names belong to the server variables, from which the directory paths have been taken. The matching pair shares the same vector index. Only non-NULL, non-empty path names and their corresponding variable names are appended. The appended paths are normalized absolute real path names.
[in] | variable_name | variable name from which the path comes |
[in] | path_name | path name, may be NULL or empty |
[out] | variables | vector of variable names |
[out] | directories | vector of directory paths |
|
static |
Construct the file path name as directory/archive.serverUUID.000001.log.
[in] | path | normalized absolute real path name |
[out] | file_pathname | file path name |
|
static |
Execute security checks and construct a file path name.
[in] | label | a label from innodb_redo_log_archive_dirs |
[in] | subdir | a plain directory name, on Unix/Linux/Mac no slash ('/') is allowed, on Windows no slash ('/'), backslash ('\'), nor colon (':') is allowed in the argument. Can be NULL or empty |
[out] | file_pathname | the secure file path name |
false | success |
true | failure |
|
static |
|
static |
|
static |
|
static |
Append a trailing directory delimiter to a path name.
This is done to support regression tests, which may want to replace path names based on server variable values, that could contain a trailing directory delimiter.
[in] | path_name | path name |
|
static |
Drop potential left-over resources to avoid leaks.
NOTE: This function must be called under the redo_log_archive_admin_mutex!
[in] | force | whether to drop resources even if consumer cannot be stopped |
false | success |
true | failure |
|
static |
Get the directory behind the label in a semi-colon separated list of labeled directories.
[in] | label | label for the selected directory; can be empty |
[out] | dir | directory path name |
false | success |
true | failure |
|
static |
Handle a write error.
Record an error message. Stop redo log archiving.
[in] | file_offset | write offset |
long long meb::innodb_redo_log_archive_flush | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_archive_flush.
The UDF is of type Udf_func_longlong returning INT_RESULT
See include/mysql/udf_registration_types.h
The UDF expects one argument:
Returns zero on success, one otherwise.
void meb::innodb_redo_log_archive_flush_deinit | ( | UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_archive_flush.
See include/mysql/udf_registration_types.h
Initialize UDF innodb_redo_log_archive_flush.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_archive_start | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_archive_start.
The UDF is of type Udf_func_longlong returning INT_RESULT
See include/mysql/udf_registration_types.h
The UDF expects two or three arguments:
Returns zero on success, one otherwise.
void meb::innodb_redo_log_archive_start_deinit | ( | UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_archive_start.
See include/mysql/udf_registration_types.h
Initialize UDF innodb_redo_log_archive_start.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_archive_stop | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_archive_stop.
The UDF is of type Udf_func_longlong returning INT_RESULT
See include/mysql/udf_registration_types.h
The UDF expects one argument:
Returns zero on success, one otherwise.
void meb::innodb_redo_log_archive_stop_deinit | ( | UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_archive_stop.
See include/mysql/udf_registration_types.h
Initialize UDF innodb_redo_log_archive_stop.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_consumer_advance | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_consumer_advance.
The UDF is of type Udf_func_longlong returning INT_RESULT and expects LSN argument which is the LSN up to which all redo log data has been consumed by the registered consumer.
Before calling this function the consumer must be registered by the innodb_redo_log_consumer_register UDF.
See include/mysql/udf_registration_types.h
Returns zero on success, one otherwise.
void meb::innodb_redo_log_consumer_advance_deinit | ( | [ [maybe_unused] ] UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_consumer_advance.
See include/mysql/udf_registration_types.h
void meb::innodb_redo_log_consumer_advance_deinit | ( | UDF_INIT * | initid | ) |
bool meb::innodb_redo_log_consumer_advance_init | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | message | ||
) |
Initialize UDF innodb_redo_log_consumer_advance.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_consumer_register | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_consumer_register.
The UDF is of type Udf_func_longlong returning INT_RESULT and expects no arguments.
See include/mysql/udf_registration_types.h
Returns zero on success, one otherwise.
void meb::innodb_redo_log_consumer_register_deinit | ( | [[maybe_unused] ] UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_consumer_register.
See include/mysql/udf_registration_types.h
bool meb::innodb_redo_log_consumer_register_init | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | message | ||
) |
Initialize UDF innodb_redo_log_consumer_register.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_consumer_unregister | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_consumer_unregister.
The UDF is of type Udf_func_longlong returning INT_RESULT and expects no arguments.
See include/mysql/udf_registration_types.h
Returns zero on success, one otherwise.
void meb::innodb_redo_log_consumer_unregister_deinit | ( | [[maybe_unused] ] UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_consumer_unregister.
See include/mysql/udf_registration_types.h
bool meb::innodb_redo_log_consumer_unregister_init | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | message | ||
) |
Initialize UDF innodb_redo_log_consumer_unregister.
See include/mysql/udf_registration_types.h
long long meb::innodb_redo_log_sharp_checkpoint | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
unsigned char * | null_value, | ||
unsigned char * | error | ||
) |
UDF innodb_redo_log_sharp_checkpoint.
The UDF is of type Udf_func_longlong returning INT_RESULT
See include/mysql/udf_registration_types.h
The UDF expects one argument:
Returns zero on success, one otherwise.
void meb::innodb_redo_log_sharp_checkpoint_deinit | ( | [ [maybe_unused] ] UDF_INIT * | initid | ) |
Deinitialize UDF innodb_redo_log_sharp_checkpoint.
See include/mysql/udf_registration_types.h
void meb::innodb_redo_log_sharp_checkpoint_deinit | ( | UDF_INIT * | initid | ) |
bool meb::innodb_redo_log_sharp_checkpoint_init | ( | UDF_INIT * | initid, |
UDF_ARGS * | args, | ||
char * | message | ||
) |
Initialize UDF innodb_redo_log_sharp_checkpoint.
See include/mysql/udf_registration_types.h
|
static |
Dequeue blocks of size QUEUE_BLOCK_SIZE, enqueued by the producer.
Write the blocks to the redo log archive file sequentially.
void meb::redo_log_archive_deinit | ( | ) |
De-initialize redo log archiving.
To be called when the InnoDB handlerton is de-initialized.
|
static |
void meb::redo_log_archive_init | ( | ) |
Initialize redo log archiving.
To be called when the InnoDB handlerton is initialized.
bool meb::redo_log_archive_is_active | ( | ) |
void meb::redo_log_archive_produce | ( | const byte * | write_buf, |
const size_t | write_size | ||
) |
The producer produces full QUEUE_BLOCK_SIZE redo log blocks.
Produce redo log blocks for the queue.
These log blocks are enqueued, and are later fetched by the consumer thread.
This function does nothing, if redo log archiving is not active.
In order to produce full QUEUE_BLOCK_SIZE redo log blocks, the producer scans each OS_FILE_LOG_BLOCK_SIZE log block (written by the server) to check if they are,
The producer skips empty and incomplete log blocks, unless they belong to the last flush, when the contents of its buffer are completely enqueued for flushing.
[in] | write_buf | The write buffer that is being written to the redo log archive file. |
[in] | write_size | The size of the data being written. |
This function is called for every log write. So it must be as efficient as possible.
NOTE: This function must be called under the 'log_sys.writer_mutex'!
void meb::redo_log_archive_session_end | ( | innodb_session_t * | session | ) |
Security function to be called when the current session ends.
This function invokes the stop implementation if this session has started the redo log archiving. It is a safe-guard against an infinitely active redo log archiving if the client goes away without deactivating the logging explicitly.
[in] | session | the current ending session |
|
static |
|
static |
|
static |
|
static |
|
static |
bool meb::register_privilege | ( | const char * | priv_name | ) |
Register a privilege.
We should move this function and other UDF registration functions to some common utility file later.
[in] | priv_name | privilege name |
false | success |
true | failure |
|
static |
|
static |
Timeout function.
Checks one of the conditions above.
[in] | wait_condition | function to return true for continued waiting |
|
static |
Trim trailing directory delimiters from a path name.
[in] | path_name | path name |
int meb::validate_redo_log_archive_dirs | ( | THD * | thd, |
SYS_VAR * | var, | ||
void * | save, | ||
st_mysql_value * | value | ||
) |
Check whether a valid value is given to innodb_redo_log_archive_dirs.
This function is registered as a callback with MySQL.
[in] | thd | thread handle |
[in] | var | pointer to system variable |
[out] | save | immediate result for update function |
[in] | value | incoming string |
|
static |
Verify that a path name is not in, under, or above a server directory.
[in] | path | normalized absolute real path name |
false | success |
true | failure |
|
static |
Verify that a file system object does not grant permissions to everyone.
[in] | path | path name of the file system object |
false | success |
true | failure |
|
static |
Verify that thd has a certain privilege.
[in,out] | thd | current THD instance, current session |
[in] | priv_name | name of the required privilege |
false | privilege is granted |
true | privilege is denied |
|
constexpr |
|
constexpr |
|
static |
|
static |
|
constexpr |
|
constexpr |
|
constexpr |
|
static |
Boolean indicating whether the redo log archiving is active.
|
static |
Mutex to synchronize start and stop of the redo log archiving.
|
static |
Whether the consumer has completed.
|
static |
Event to inform that the consumer has exited after purging all the queue elements or that it got a flush block.
|
static |
Whether the consumer has copied a flush block.
|
static |
Whether the consumer thread is running.
|
extern |
Performance schema key for the log consumer thread.
char * meb::redo_log_archive_dirs {} |
|
static |
The file handle to the redo log archive file.
|
extern |
Performance schema key for the redo log archive file.
|
static |
String containing the redo log archive filename.
|
static |
|
static |
Boolean indicating whether to produce queue blocks.
WARNING: To avoid races, this variable must be read/written under the 'log_sys.writer_mutex' only.
Queue into which the producer enqueues redo log blocks of size QUEUE_BLOCK_SIZE, and from which the consumer reads redo log blocks of size QUEUE_BLOCK_SIZE.
|
static |
Error message recorded during redo log archiving.
|
static |
Session.
|
static |
|
static |
|
static |
Temporary block used to build complete redo log blocks of size QUEUE_BLOCK_SIZE by the producer.
WARNING: To avoid races, this variable must be read/written under the 'log_sys.writer_mutex' only.
Dynamic_procedures meb::s_dynamic_procedures |