Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
eee533c
MDEV-38144: update Optional_metadata_fields to use MariaDB types
EricHayter Mar 2, 2026
bbb5fff
Create new Column_metadata struct
EricHayter Mar 8, 2026
ba219db
Add signed flags to Column_metadata
EricHayter Mar 8, 2026
b866255
Implement string value vector for enums and sets in optional metadata
EricHayter Mar 11, 2026
83e91ce
Add geometry type to the Column metadata type
EricHayter Mar 12, 2026
410d250
Update Column_metadata to include primary key information
EricHayter Mar 13, 2026
d02f83e
Update logic for storing charset information in Optional_metadata_fields
EricHayter Mar 14, 2026
cd93c9c
Add type check during charset parsing
EricHayter Mar 14, 2026
01fc048
Use 'using' for complex typename
EricHayter May 11, 2026
ce02670
use pointer to iterate over bitfields
EricHayter May 11, 2026
f8ba9b4
Use pointer-to-member in enum and set parsing function
EricHayter May 11, 2026
044d356
Add comment to initalization loop of Optioanal_metadata_fields constr…
EricHayter May 11, 2026
8723298
Remove fancy C++ and simplify PK printing
EricHayter May 12, 2026
2aa16f2
Simplify default charset handling
EricHayter May 13, 2026
aaee8a1
Implement test cases for changes to parsing logic
EricHayter May 15, 2026
01087a6
Fix whitespace changes
EricHayter May 15, 2026
44d76a2
fix: Remove changes to whitespace
EricHayter May 27, 2026
d513774
Rename empty() function in vector class to is_empty()
EricHayter Jun 12, 2026
a97d951
Use full row binlog metadata in signedness parse test
EricHayter Jun 12, 2026
83aeebd
Add bounds checking for binlog logic
EricHayter Jun 12, 2026
a5df076
Add deconstructor for optional metadata and error handling in parsing…
EricHayter Jun 13, 2026
d8cca72
Add YEAR test in parse signedness test cases
EricHayter Jun 13, 2026
14c034c
Update testcase results to use FULL row metadata
EricHayter Jun 13, 2026
e3819fd
Remove unneeded headers
EricHayter Jun 13, 2026
f4c667d
fix: include header to fix compile error
EricHayter Jun 15, 2026
9d72fca
Fix whitespace removal
EricHayter Jun 29, 2026
f79f402
Make testcase restore state of binlog state when done
EricHayter Jun 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions mysql-test/suite/binlog/r/binlog_signedness_parse.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
ALTER DATABASE test CHARACTER SET latin1 COLLATE latin1_swedish_ci;
RESET MASTER;
SET GLOBAL binlog_row_metadata = FULL;
#
# Test 1: Non-numeric column between two numeric columns does not
# consume a signedness bit (signed INT, CHAR, unsigned INT)
#
CREATE TABLE t1(c_signed INT, c_char CHAR(10), c_unsigned INT UNSIGNED);
INSERT INTO t1 VALUES(-1, 'x', 1);
# Columns(`c_signed` INT,
# `c_char` CHAR(10) CHARSET latin1 COLLATE latin1_swedish_ci,
# `c_unsigned` INT UNSIGNED)
DROP TABLE t1;
RESET MASTER;
#
# Test 2: Byte boundary — 8 signed numerics then a non-numeric then an
# unsigned numeric. The non-numeric must not shift the bit
# cursor into the second byte prematurely.
#
CREATE TABLE t1(
c1 TINYINT, c2 TINYINT, c3 TINYINT, c4 TINYINT,
c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT,
c_text TEXT,
c9 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
# Columns(`c1` TINYINT,
# `c2` TINYINT,
# `c3` TINYINT,
# `c4` TINYINT,
# `c5` TINYINT,
# `c6` TINYINT,
# `c7` TINYINT,
# `c8` TINYINT,
# `c_text` TEXT CHARSET latin1 COLLATE latin1_swedish_ci,
# `c9` TINYINT UNSIGNED)
DROP TABLE t1;
RESET MASTER;
#
# Test 3: Multiple non-numeric columns between numeric columns across
# a byte boundary
#
CREATE TABLE t1(
c1 TINYINT UNSIGNED, c2 TINYINT UNSIGNED,
c3 TINYINT UNSIGNED, c4 TINYINT UNSIGNED,
c5 TINYINT UNSIGNED, c6 TINYINT UNSIGNED,
c7 TINYINT UNSIGNED, c8 TINYINT UNSIGNED,
c_blob BLOB, c_varchar VARCHAR(100),
c9 TINYINT, c10 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
# Columns(`c1` TINYINT UNSIGNED,
# `c2` TINYINT UNSIGNED,
# `c3` TINYINT UNSIGNED,
# `c4` TINYINT UNSIGNED,
# `c5` TINYINT UNSIGNED,
# `c6` TINYINT UNSIGNED,
# `c7` TINYINT UNSIGNED,
# `c8` TINYINT UNSIGNED,
# `c_blob` BLOB,
# `c_varchar` VARCHAR(100) CHARSET latin1 COLLATE latin1_swedish_ci,
# `c9` TINYINT,
# `c10` TINYINT UNSIGNED)
DROP TABLE t1;
RESET MASTER;
#
# Test 4: YEAR is treated as a numeric type: it always reads as UNSIGNED
# and consumes a signedness bit, so a numeric column following it
# still reads the correct bit (signed INT, YEAR, unsigned INT).
#
CREATE TABLE t1(c_signed INT, c_year YEAR, c_unsigned INT UNSIGNED);
INSERT INTO t1(c_signed) VALUES(-1);
# Columns(`c_signed` INT,
# `c_year` YEAR UNSIGNED,
# `c_unsigned` INT UNSIGNED)
DROP TABLE t1;
RESET MASTER;
SET GLOBAL binlog_row_metadata = NO_LOG;
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ c_datetime DATETIME, c_datetime_f DATETIME(3),
c_timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
c_timestamp_f TIMESTAMP(3) DEFAULT "2017-1-1 10:10:10");
INSERT INTO t1(c_year) VALUES(2017);
# Columns(YEAR,
# Columns(YEAR UNSIGNED,
# DATE,
# TIME,
# TIME(3),
Expand Down
83 changes: 83 additions & 0 deletions mysql-test/suite/binlog/t/binlog_signedness_parse.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
################################################################################
# Regression tests for parse_signedness() in log_event.cc.
#
# The old implementation (upstream) pushed all bits from every byte into a flat
# vector without regard to column type. The new implementation iterates over
# column metadata and only consumes a bit for columns where is_numeric_type()
# returns true, skipping non-numeric columns.
#
# Tests focus on:
# 1. YEAR is treated as a numeric type and always shown UNSIGNED.
Comment thread
EricHayter marked this conversation as resolved.
# 2. Non-numeric columns interspersed between numeric columns do not consume
# a signedness bit, so the second numeric column reads the correct bit.
# 3. Correct behavior at byte boundaries when non-numeric columns appear
# between the 8th and 9th numeric column.
################################################################################
--source include/have_binlog_format_row.inc
--source include/test_db_charset_latin1.inc

RESET MASTER;
SET @old_metadata= @@GLOBAL.binlog_row_metadata;
SET GLOBAL binlog_row_metadata = FULL;

--let $MYSQLD_DATADIR= `select @@datadir`
--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001

--echo #
--echo # Test 1: Non-numeric column between two numeric columns does not
--echo # consume a signedness bit (signed INT, CHAR, unsigned INT)
--echo #
CREATE TABLE t1(c_signed INT, c_char CHAR(10), c_unsigned INT UNSIGNED);
INSERT INTO t1 VALUES(-1, 'x', 1);
--source suite/binlog/include/print_optional_metadata.inc

DROP TABLE t1;
RESET MASTER;

--echo #
--echo # Test 2: Byte boundary — 8 signed numerics then a non-numeric then an
--echo # unsigned numeric. The non-numeric must not shift the bit
--echo # cursor into the second byte prematurely.
--echo #
CREATE TABLE t1(
c1 TINYINT, c2 TINYINT, c3 TINYINT, c4 TINYINT,
c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT,
c_text TEXT,
c9 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
--source suite/binlog/include/print_optional_metadata.inc

DROP TABLE t1;
RESET MASTER;

--echo #
--echo # Test 3: Multiple non-numeric columns between numeric columns across
--echo # a byte boundary
--echo #
CREATE TABLE t1(
c1 TINYINT UNSIGNED, c2 TINYINT UNSIGNED,
c3 TINYINT UNSIGNED, c4 TINYINT UNSIGNED,
c5 TINYINT UNSIGNED, c6 TINYINT UNSIGNED,
c7 TINYINT UNSIGNED, c8 TINYINT UNSIGNED,
c_blob BLOB, c_varchar VARCHAR(100),
c9 TINYINT, c10 TINYINT UNSIGNED);
INSERT INTO t1(c1) VALUES(1);
--source suite/binlog/include/print_optional_metadata.inc

DROP TABLE t1;
RESET MASTER;

--echo #
--echo # Test 4: YEAR is treated as a numeric type: it always reads as UNSIGNED
--echo # and consumes a signedness bit, so a numeric column following it
--echo # still reads the correct bit (signed INT, YEAR, unsigned INT).
--echo #
CREATE TABLE t1(c_signed INT, c_year YEAR, c_unsigned INT UNSIGNED);
INSERT INTO t1(c_signed) VALUES(-1);
--source suite/binlog/include/print_optional_metadata.inc

DROP TABLE t1;
RESET MASTER;

SET GLOBAL binlog_row_metadata = @old_metadata;
--source include/test_db_charset_restore.inc
Loading