From 18932be5670cb5754fef3c21d4939dc7ce6c2ef4 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Fri, 17 Jan 2025 17:39:43 +0100 Subject: [PATCH] MDEV-34705: Binlog-in-engine: Buildbot fixes Signed-off-by: Kristian Nielsen --- .../suite/sys_vars/r/sysvars_server_embedded.result | 10 ++++++++++ sql/sql_repl.cc | 1 + storage/innobase/fsp/fsp_binlog.cc | 10 +++++----- storage/innobase/handler/innodb_binlog.cc | 10 ++++++---- storage/innobase/include/fsp_binlog.h | 4 +++- storage/innobase/include/small_vector.h | 1 + storage/innobase/ut/ut0compr_int.cc | 10 ++++++---- 7 files changed, 32 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index b511a77117d40..a17dbdd7fbba9 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -392,6 +392,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 diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 05376f7a4ab4b..4818a164f5491 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -3279,6 +3279,7 @@ static int send_one_binlog_file(binlog_send_info *info, { if (opt_binlog_engine_hton) { + info->dirlen= 0; if (send_engine_events(info)) return 1; } diff --git a/storage/innobase/fsp/fsp_binlog.cc b/storage/innobase/fsp/fsp_binlog.cc index 22ba16acd0952..085bd714a762d 100644 --- a/storage/innobase/fsp/fsp_binlog.cc +++ b/storage/innobase/fsp/fsp_binlog.cc @@ -121,7 +121,7 @@ fsp_binlog_tablespace_close(uint64_t file_no) mtr_t mtr; dberr_t res; - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(file_no & 1); mysql_mutex_lock(&fil_system.mutex); fil_space_t *space= fil_space_get_by_id(space_id); mysql_mutex_unlock(&fil_system.mutex); @@ -200,7 +200,7 @@ fsp_binlog_open(const char *file_name, pfs_os_file_t fh, return nullptr; } - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(file_no & 1); if (!open_empty) { page_t *page_buf= static_cast(aligned_malloc(page_size, page_size)); @@ -306,7 +306,7 @@ dberr_t fsp_binlog_tablespace_create(uint64_t file_no, fil_space_t **new_space) mysql_mutex_lock(&fil_system.mutex); /* ToDo: Need to ensure file (N-2) is no longer active before creating (N). */ - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(file_no & 1); if (!(*new_space= fil_space_t::create(space_id, ( FSP_FLAGS_FCRC32_MASK_MARKER | FSP_FLAGS_FCRC32_PAGE_SSIZE()), @@ -564,7 +564,7 @@ bool fsp_binlog_flush() { uint64_t file_no= active_binlog_file_no.load(std::memory_order_relaxed); - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(file_no & 1); uint32_t page_no= binlog_cur_page_no; fil_space_t *space= active_binlog_space; chunk_data_flush dummy_data; @@ -670,7 +670,7 @@ binlog_chunk_reader::fetch_current_page() case. */ buf_block_t *hint_block= nullptr; - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (s.file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(s.file_no & 1); dberr_t err= DB_SUCCESS; block= buf_page_get_gen(page_id_t{space_id, s.page_no}, 0, RW_S_LATCH, hint_block, BUF_GET_IF_IN_POOL, diff --git a/storage/innobase/handler/innodb_binlog.cc b/storage/innobase/handler/innodb_binlog.cc index 432d57e419f48..f1f17fe72f270 100644 --- a/storage/innobase/handler/innodb_binlog.cc +++ b/storage/innobase/handler/innodb_binlog.cc @@ -903,7 +903,7 @@ serialize_gtid_state(rpl_binlog_state_base *state, byte *buf, size_t buf_size, p + (buf_size - (2*COMPR_INT_MAX32 + COMPR_INT_MAX64)); if (state->iterate( - [buf, buf_size, pmax, &p] (const rpl_gtid *gtid) { + [pmax, &p] (const rpl_gtid *gtid) { if (UNIV_UNLIKELY(p > pmax)) return true; p= compr_int_write(p, gtid->domain_id); @@ -1498,7 +1498,8 @@ innodb_binlog_oob_reader::read_data(binlog_chunk_reader *chunk_rd, { case ST_initial: chunk_rd->seek(e->file_no, e->offset); - static_assert(sizeof(e->rd_buf) == 5*COMPR_INT_MAX64); + static_assert(sizeof(e->rd_buf) == 5*COMPR_INT_MAX64, + "rd_buf size must match code using it"); res= chunk_rd->read_data(e->rd_buf, 5*COMPR_INT_MAX64, true); if (res < 0) return -1; @@ -1665,7 +1666,8 @@ int ha_innodb_binlog_reader::read_data(uchar *buf, uint32_t len) switch (state) { case ST_read_next_event_group: - static_assert(sizeof(rd_buf) == 5*COMPR_INT_MAX64); + static_assert(sizeof(rd_buf) == 5*COMPR_INT_MAX64, + "rd_buf size must match code using it"); res= chunk_rd.read_data(rd_buf, 5*COMPR_INT_MAX64, true); if (res <= 0) return res; @@ -1849,7 +1851,7 @@ gtid_search::read_gtid_state_file_no(rpl_binlog_state_base *state, */ mtr.start(); mtr_started= true; - uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (file_no & 1); + uint32_t space_id= SRV_SPACE_ID_BINLOG0 + (uint32_t)(file_no & 1); dberr_t err= DB_SUCCESS; block= buf_page_get_gen(page_id_t{space_id, page_no}, 0, RW_S_LATCH, nullptr, BUF_GET_IF_IN_POOL, &mtr, &err); diff --git a/storage/innobase/include/fsp_binlog.h b/storage/innobase/include/fsp_binlog.h index c1e3566d2a36d..b6c4a393d7bf1 100644 --- a/storage/innobase/include/fsp_binlog.h +++ b/storage/innobase/include/fsp_binlog.h @@ -79,7 +79,9 @@ static constexpr uint64_t ALLOWED_NESTED_RECORDS= ((uint64_t)1 << FSP_BINLOG_TYPE_DUMMY) ; /* Ensure that all types fit in the ALLOWED_NESTED_RECORDS bitmask. */ -static_assert(FSP_BINLOG_TYPE_END <= 8*sizeof(ALLOWED_NESTED_RECORDS)); +static_assert(FSP_BINLOG_TYPE_END <= 8*sizeof(ALLOWED_NESTED_RECORDS), + "Binlog types must be <64 to fit " + "in ALLOWED_NESTED_RECORDS bitmask"); class binlog_chunk_reader { diff --git a/storage/innobase/include/small_vector.h b/storage/innobase/include/small_vector.h index a8fc7b672212b..203710cf4c8ee 100644 --- a/storage/innobase/include/small_vector.h +++ b/storage/innobase/include/small_vector.h @@ -22,6 +22,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include "my_valgrind.h" #include #include +#include class small_vector_base { diff --git a/storage/innobase/ut/ut0compr_int.cc b/storage/innobase/ut/ut0compr_int.cc index ce3d41003bf54..f183b353a5144 100644 --- a/storage/innobase/ut/ut0compr_int.cc +++ b/storage/innobase/ut/ut0compr_int.cc @@ -61,13 +61,14 @@ unsigned char *compr_int_write(unsigned char *p, uint64_t v) { ToDo: On big-endian can use more efficient little-endian conversion, since we know the pointer is 8-byte aligned. */ - int8store(p1, (uint8korr(p1) & ~mask1) | v1); + int8store((unsigned char *)p1, + (uint8korr((unsigned char *)p1) & ~mask1) | v1); #else *p1= (*p1 & ~mask1) | v1; #endif if (offset + bytes >= 8) { #ifdef WORDS_BIGENDIAN - int8store(p2, v2); + int8store((unsigned char *)p2, v2); #else *p2= v2; #endif @@ -91,7 +92,7 @@ compr_int_read(const unsigned char *p) ToDo: On big-endian can use more efficient little-endian conversion, since we know the pointer is 8-byte aligned. */ - uint64_t v1= uint8korr(p_align); + uint64_t v1= uint8korr((unsigned char *)p_align); #else uint64_t v1= p_align[0]; #endif @@ -103,7 +104,8 @@ compr_int_read(const unsigned char *p) uint64_t mask2= (~(uint64_t)0) >> ((16 - (offset + bytes)) << 3); #ifdef WORDS_BIGENDIAN v= (v1 >> (3 + offset_bits)) | - ((uint8korr(p_align + 1) & mask2) << (61 - offset_bits)); + ((uint8korr((unsigned char *)(p_align + 1)) & mask2) << + (61 - offset_bits)); #else v= (v1 >> (3 + offset_bits)) | ((p_align[1] & mask2) << (61 - offset_bits)); #endif