-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-38144: update Optional_metadata_fields to use new aggregate per-column struct
#4720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EricHayter
wants to merge
27
commits into
MariaDB:main
Choose a base branch
from
EricHayter:mdev-38144
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+533
−322
Open
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 bbb5fff
Create new Column_metadata struct
EricHayter ba219db
Add signed flags to Column_metadata
EricHayter b866255
Implement string value vector for enums and sets in optional metadata
EricHayter 83e91ce
Add geometry type to the Column metadata type
EricHayter 410d250
Update Column_metadata to include primary key information
EricHayter d02f83e
Update logic for storing charset information in Optional_metadata_fields
EricHayter cd93c9c
Add type check during charset parsing
EricHayter 01fc048
Use 'using' for complex typename
EricHayter ce02670
use pointer to iterate over bitfields
EricHayter f8ba9b4
Use pointer-to-member in enum and set parsing function
EricHayter 044d356
Add comment to initalization loop of Optioanal_metadata_fields constr…
EricHayter 8723298
Remove fancy C++ and simplify PK printing
EricHayter 2aa16f2
Simplify default charset handling
EricHayter aaee8a1
Implement test cases for changes to parsing logic
EricHayter 01087a6
Fix whitespace changes
EricHayter 44d76a2
fix: Remove changes to whitespace
EricHayter d513774
Rename empty() function in vector class to is_empty()
EricHayter a97d951
Use full row binlog metadata in signedness parse test
EricHayter 83aeebd
Add bounds checking for binlog logic
EricHayter a5df076
Add deconstructor for optional metadata and error handling in parsing…
EricHayter d8cca72
Add YEAR test in parse signedness test cases
EricHayter 14c034c
Update testcase results to use FULL row metadata
EricHayter e3819fd
Remove unneeded headers
EricHayter f4c667d
fix: include header to fix compile error
EricHayter 9d72fca
Fix whitespace removal
EricHayter f79f402
Make testcase restore state of binlog state when done
EricHayter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
| # 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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.