1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-34705: Binlog-in-engine: Misc. small fixes to make normal test suite mostly pass

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2025-01-17 14:09:04 +01:00
parent c67b014c9c
commit dd8ffe952d
6 changed files with 70 additions and 26 deletions

View File

@@ -78,6 +78,10 @@ The following specify which files/extra groups are read (specified before remain
tables such as in the statement INSERT INTO t_myisam
SELECT * FROM t_innodb; otherwise, slaves may diverge
from the master.
--binlog-directory=name
Directory path (absolute or relative to datadir) where
binlog files are stored. If this is used, must not
specify a directory path for --log-bin
--binlog-do-db=name Tells the master it should log updates for the specified
database, and exclude all others not explicitly
mentioned.
@@ -158,6 +162,10 @@ The following specify which files/extra groups are read (specified before remain
non-transactional engines for the binary log. If you
often use statements updating a great number of rows, you
can increase this to get more performance.
--binlog-storage-engine=name
Store the binlog transactionally in a supporting storage
engine instead of as separate files. Currently only
InnoDB is supported.
--block-encryption-mode=name
Default block encryption mode for AES_ENCRYPT() and
AES_DECRYPT() functions. One of: aes-128-ecb, aes-192-ecb,
@@ -1629,6 +1637,7 @@ binlog-checksum CRC32
binlog-commit-wait-count 0
binlog-commit-wait-usec 100000
binlog-direct-non-transactional-updates FALSE
binlog-directory (No default value)
binlog-expire-logs-seconds 0
binlog-file-cache-size 16384
binlog-format MIXED
@@ -1642,6 +1651,7 @@ binlog-row-image FULL
binlog-row-metadata NO_LOG
binlog-space-limit 0
binlog-stmt-cache-size 32768
binlog-storage-engine
block-encryption-mode aes-128-ecb
bulk-insert-buffer-size 8388608
character-set-client-handshake TRUE

View File

@@ -91,6 +91,18 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_BINLOG_STATE_INTERVAL
SESSION_VALUE NULL
DEFAULT_VALUE 2097152
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Interval (in bytes) at which to write the GTID binlog state to binlog files to speed up GTID lookups. Must be a multiple of innodb_page_size
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_BUFFER_POOL_CHUNK_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 0

View File

@@ -402,6 +402,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_DIRECTORY
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Directory path (absolute or relative to datadir) where binlog files are stored. If this is used, must not specify a directory path for --log-bin
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME BINLOG_DIRECT_NON_TRANSACTIONAL_UPDATES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN

View File

@@ -402,14 +402,18 @@ public:
last_commit_pos_file[0]= 0;
last_commit_pos_offset= 0;
}
/*
Use a custom write_function to spill to the engine-implemented binlog.
And re-use the IO_CACHE::append_read_pos as a handle for our
write_function; it is unused when the cache is not SEQ_READ_APPEND.
*/
trx_cache.cache_log.write_function= binlog_spill_to_engine;
trx_cache.cache_log.append_read_pos= (uchar *)this;
engine_binlog_info= {0, 0, 0};
if (likely(opt_binlog_engine_hton) &&
likely(opt_binlog_engine_hton->binlog_oob_data))
{
/*
Use a custom write_function to spill to the engine-implemented binlog.
And re-use the IO_CACHE::append_read_pos as a handle for our
write_function; it is unused when the cache is not SEQ_READ_APPEND.
*/
trx_cache.cache_log.write_function= binlog_spill_to_engine;
trx_cache.cache_log.append_read_pos= (uchar *)this;
engine_binlog_info= {0, 0, 0};
}
}
binlog_cache_data* get_binlog_cache_data(bool is_transactional)

View File

@@ -5558,13 +5558,12 @@ static int init_server_components()
if (opt_bin_log)
{
mysql_mutex_t *log_lock= mysql_bin_log.get_log_lock();
int error;
bool error;
if (opt_binlog_engine_hton)
{
mysql_mutex_lock(log_lock);
if ((*opt_binlog_engine_hton->binlog_init)((size_t)max_binlog_size,
opt_binlog_directory))
error= 1;
error= (*opt_binlog_engine_hton->binlog_init)((size_t)max_binlog_size,
opt_binlog_directory);
mysql_mutex_unlock(log_lock);
if (unlikely(error))
unireg_abort(1);

View File

@@ -32,6 +32,8 @@ InnoDB implementation of binlog.
#include "log.h"
static int innodb_binlog_inited= 0;
uint32_t innodb_binlog_size_in_pages;
const char *innodb_binlog_directory;
@@ -426,6 +428,7 @@ innodb_binlog_startup_init()
{
fsp_binlog_init();
binlog_diff_state.init();
innodb_binlog_inited= 1;
}
@@ -493,6 +496,7 @@ innodb_binlog_init(size_t binlog_size, const char *directory)
innodb_binlog_directory= directory;
innodb_binlog_init_state();
innodb_binlog_inited= 2;
/* Find any existing binlog files and continue writing in them. */
int res= innodb_binlog_discover();
@@ -780,24 +784,28 @@ innodb_binlog_discover()
void innodb_binlog_close(bool shutdown)
{
if (binlog_prealloc_thr_obj.joinable()) {
mysql_mutex_lock(&active_binlog_mutex);
prealloc_thread_end= true;
pthread_cond_signal(&active_binlog_cond);
mysql_mutex_unlock(&active_binlog_mutex);
binlog_prealloc_thr_obj.join();
}
if (innodb_binlog_inited >= 2)
{
if (binlog_prealloc_thr_obj.joinable()) {
mysql_mutex_lock(&active_binlog_mutex);
prealloc_thread_end= true;
pthread_cond_signal(&active_binlog_cond);
mysql_mutex_unlock(&active_binlog_mutex);
binlog_prealloc_thr_obj.join();
}
uint64_t file_no= first_open_binlog_file_no;
if (file_no != ~(uint64_t)0) {
if (file_no <= last_created_binlog_file_no) {
fsp_binlog_tablespace_close(file_no);
if (file_no + 1 <= last_created_binlog_file_no) {
fsp_binlog_tablespace_close(file_no + 1);
uint64_t file_no= first_open_binlog_file_no;
if (file_no != ~(uint64_t)0) {
if (file_no <= last_created_binlog_file_no) {
fsp_binlog_tablespace_close(file_no);
if (file_no + 1 <= last_created_binlog_file_no) {
fsp_binlog_tablespace_close(file_no + 1);
}
}
}
}
if (shutdown)
if (shutdown && innodb_binlog_inited >= 1)
{
binlog_diff_state.free();
fsp_binlog_shutdown();
@@ -2192,6 +2200,7 @@ innodb_reset_binlogs()
{
bool err= false;
ut_a(innodb_binlog_inited >= 2);
/* Close existing binlog tablespaces and stop the pre-alloc thread. */
innodb_binlog_close(false);