MySQL 8.3.0
Source Code Documentation
log0meb.cc File Reference
#include "log0meb.h"
#include <ctype.h>
#include <limits.h>
#include <cstring>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
#include "m_string.h"
#include "mysql/components/services/dynamic_privilege.h"
#include "mysql/components/services/udf_registration.h"
#include "mysql/plugin.h"
#include "mysql/service_plugin_registry.h"
#include "sql/mysqld.h"
#include "sql/sql_class.h"
#include "string_with_len.h"
#include "db0err.h"
#include "dict0dd.h"
#include "ha_innodb.h"
#include "log0chkp.h"
#include "log0encryption.h"
#include "log0files_io.h"
#include "log0write.h"
#include "os0event.h"
#include "os0file.h"
#include "os0thread-create.h"
#include "sess0sess.h"
#include "srv0dynamic_procedures.h"
#include "srv0srv.h"
#include "sync0sync.h"
#include "ut0mutex.h"
#include "ut0new.h"

Classes

class  meb::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  meb::Queue< T >
 This template class implements a queue that,. More...
 
class  meb::Guardian
 
class  meb::Dynamic_procedures
 This component's UDFs.mysql. More...
 

Namespaces

namespace  meb
 

Macros

#define LOGMSGPFX   std::string(logmsgpfx)
 

Functions

static void meb::redo_log_archive_consumer ()
 Dequeue blocks of size QUEUE_BLOCK_SIZE, enqueued by the producer. More...
 
static bool meb::terminate_consumer (bool rapid)
 
static bool meb::consumer_is_running ()
 
static bool meb::consumer_not_running ()
 
static bool meb::consumer_not_flushed ()
 
static bool meb::timeout (bool(*wait_condition)())
 Timeout function. More...
 
bool meb::register_privilege (const char *priv_name)
 Register a privilege. More...
 
bool meb::innodb_redo_log_archive_start_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_archive_start. More...
 
void meb::innodb_redo_log_archive_start_deinit (UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_archive_start. More...
 
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. More...
 
bool meb::innodb_redo_log_archive_stop_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_archive_stop. More...
 
void meb::innodb_redo_log_archive_stop_deinit (UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_archive_stop. More...
 
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. More...
 
bool meb::innodb_redo_log_archive_flush_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_archive_flush. More...
 
void meb::innodb_redo_log_archive_flush_deinit (UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_archive_flush. More...
 
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. More...
 
bool meb::innodb_redo_log_sharp_checkpoint_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_sharp_checkpoint. More...
 
void meb::innodb_redo_log_sharp_checkpoint_deinit (UDF_INIT *initid)
 
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. More...
 
bool meb::innodb_redo_log_consumer_register_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_consumer_register. More...
 
void meb::innodb_redo_log_consumer_register_deinit ([[maybe_unused]] UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_consumer_register. More...
 
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. More...
 
bool meb::innodb_redo_log_consumer_unregister_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_consumer_unregister. More...
 
void meb::innodb_redo_log_consumer_unregister_deinit ([[maybe_unused]] UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_consumer_unregister. More...
 
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. More...
 
bool meb::innodb_redo_log_consumer_advance_init (UDF_INIT *initid, UDF_ARGS *args, char *message)
 Initialize UDF innodb_redo_log_consumer_advance. More...
 
void meb::innodb_redo_log_consumer_advance_deinit (UDF_INIT *initid)
 
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. More...
 
void meb::redo_log_archive_init ()
 Initialize redo log archiving. More...
 
static bool meb::drop_remnants (bool force)
 Drop potential left-over resources to avoid leaks. More...
 
void meb::redo_log_archive_deinit ()
 De-initialize redo log archiving. More...
 
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. More...
 
static bool meb::verify_privilege (THD *thd, const char *priv_name)
 Verify that thd has a certain privilege. More...
 
static bool meb::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 meb::verify_no_world_permissions (const Fil_path &path)
 Verify that a file system object does not grant permissions to everyone. More...
 
static std::string meb::trim_path_name (const std::string &path_name)
 Trim trailing directory delimiters from a path name. More...
 
static std::string meb::delimit_dir_name (const std::string &path_name)
 Append a trailing directory delimiter to a path name. More...
 
static void meb::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 meb::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 meb::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 meb::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 meb::redo_log_archive_start (THD *thd, const char *label, const char *subdir)
 
static bool meb::redo_log_archive_stop (THD *thd)
 
static bool meb::redo_log_archive_flush (THD *thd)
 
static bool meb::redo_log_consumer_register (innodb_session_t *session)
 
static bool meb::redo_log_consumer_unregister (innodb_session_t *session)
 
static bool meb::redo_log_consumer_advance (innodb_session_t *session, lsn_t lsn)
 
void meb::redo_log_archive_session_end (innodb_session_t *session)
 Security function to be called when the current session ends. More...
 
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. More...
 
bool meb::redo_log_archive_is_active ()
 
static void meb::handle_write_error (uint64_t file_offset)
 Handle a write error. More...
 
void meb::innodb_redo_log_sharp_checkpoint_deinit ([[maybe_unused]] UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_sharp_checkpoint. More...
 
void meb::innodb_redo_log_consumer_advance_deinit ([[maybe_unused]] UDF_INIT *initid)
 Deinitialize UDF innodb_redo_log_consumer_advance. More...
 

Variables

constexpr const char * meb::innodb_redo_log_archive_privilege
 
constexpr const char * meb::backup_admin_privilege {"BACKUP_ADMIN"}
 
constexpr const char * meb::logmsgpfx {"innodb_redo_log_archive: "}
 
constexpr size_t meb::QUEUE_BLOCK_SIZE = 4096
 
constexpr size_t meb::QUEUE_SIZE_MAX = 16384
 
static std::atomic< bool > meb::redo_log_archive_initialized {}
 
static ib_mutex_t meb::redo_log_archive_admin_mutex
 Mutex to synchronize start and stop of the redo log archiving. More...
 
static bool meb::redo_log_archive_active {false}
 Boolean indicating whether the redo log archiving is active. More...
 
static innodb_session_tmeb::redo_log_archive_session {}
 Session. More...
 
static THDmeb::redo_log_archive_thd {}
 
static bool meb::redo_log_archive_session_ending {false}
 
static std::string meb::redo_log_archive_recorded_error {}
 Error message recorded during redo log archiving. More...
 
static std::string meb::redo_log_archive_file_pathname {}
 String containing the redo log archive filename. More...
 
static pfs_os_file_t meb::redo_log_archive_file_handle {}
 The file handle to the redo log archive file. More...
 
static bool meb::redo_log_archive_consume_running {false}
 Whether the consumer thread is running. More...
 
static bool meb::redo_log_archive_consume_complete {true}
 Whether the consumer has completed. More...
 
static os_event_t meb::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 meb::redo_log_archive_consume_flushed {false}
 Whether the consumer has copied a flush block. More...
 
static bool meb::redo_log_archive_produce_blocks {false}
 Boolean indicating whether to produce queue blocks. More...
 
static Block meb::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 > meb::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 meb::s_dynamic_procedures
 
static std::unique_ptr< Log_user_consumermeb::log_meb_consumer
 
static innodb_session_tmeb::log_meb_consumer_session
 

Macro Definition Documentation

◆ LOGMSGPFX

#define LOGMSGPFX   std::string(logmsgpfx)