-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-29804 Fix SHOW BINLOG EVENTS displaying incorrect session variable values #4766
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
Merged
bnestere
merged 1 commit into
MariaDB:10.11
from
tarunw07:MDEV-29804-fix-show-binlog-events
Apr 27, 2026
Merged
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions
24
mysql-test/suite/binlog/r/binlog_check_constraint_checks_flag.result
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,24 @@ | ||
| include/master-slave.inc | ||
| [connection master] | ||
| connection master; | ||
| create table t10( | ||
| pk int primary key, | ||
| a int, | ||
| constraint a_big check (a>10) | ||
| ); | ||
| insert into t10 values (1, 20); | ||
| set check_constraint_checks=off; | ||
| update t10 set a=a-15 where pk=1; | ||
| update t10 set a=a+100 where pk=1; | ||
| set check_constraint_checks=on ; | ||
| select * from t10; | ||
| pk a | ||
| 1 105 | ||
| connection slave; | ||
| select * from t10; | ||
| pk a | ||
| 1 105 | ||
| connection master; | ||
| drop table t10; | ||
| connection slave; | ||
| include/rpl_end.inc |
9 changes: 9 additions & 0 deletions
9
mysql-test/suite/binlog/r/binlog_show_binlog_events_session_variables.result
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,9 @@ | ||
| reset master; | ||
| set foreign_key_checks= 0, sql_auto_is_null=1, check_constraint_checks=0, unique_checks=0; | ||
| create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a; | ||
| include/show_binlog_events.inc | ||
| Log_name Pos Event_type Server_id End_log_pos Info | ||
| master-bin.000001 # Gtid # # GTID #-#-# | ||
| master-bin.000001 # Query # # use `test`; set foreign_key_checks=0, sql_auto_is_null=1, unique_checks=0, check_constraint_checks=0; create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a | ||
| drop table t; | ||
| reset master; |
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
36 changes: 36 additions & 0 deletions
36
mysql-test/suite/binlog/t/binlog_check_constraint_checks_flag.test
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,36 @@ | ||
| --source include/master-slave.inc | ||
|
|
||
| # References: | ||
| # | ||
| # MDEV-32447 Using check_constraint_checks=OFF can break replication | ||
| # | ||
| # check_constraint_checks was added in MDEV-7563 but its addition | ||
| # to OPTIONS_WRITTEN_TO_BINLOG was missed and therefore it was breaking | ||
| # replication in binlog formats other than ROW. | ||
|
|
||
|
|
||
| --connection master | ||
|
|
||
| create table t10( | ||
| pk int primary key, | ||
| a int, | ||
| constraint a_big check (a>10) | ||
| ); | ||
|
|
||
| insert into t10 values (1, 20); | ||
| set check_constraint_checks=off; | ||
| update t10 set a=a-15 where pk=1; | ||
| update t10 set a=a+100 where pk=1; | ||
| set check_constraint_checks=on ; | ||
| select * from t10; | ||
|
|
||
| --sync_slave_with_master | ||
|
|
||
| # Here we are on the slave | ||
| select * from t10; | ||
| --connection master | ||
|
|
||
| drop table t10; | ||
| --sync_slave_with_master | ||
|
|
||
| --source include/rpl_end.inc |
25 changes: 25 additions & 0 deletions
25
mysql-test/suite/binlog/t/binlog_show_binlog_events_session_variables.test
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,25 @@ | ||
| # ==== Purpose ==== | ||
| # | ||
| # Test verifies that reading binary log by using "SHOW BINLOG EVENTS" command | ||
| # from should correctly print the values of session variables such as | ||
| # foreign_key_checks, sql_auto_is_null, unique_checks etc | ||
| # | ||
| # ==== References ==== | ||
| # | ||
| # MDEV-29804 SHOW BINLOG EVENTS produces semantically/syntactically incorrect statements | ||
|
|
||
|
|
||
| --source include/have_log_bin.inc | ||
| --source include/have_innodb.inc | ||
| --source include/have_binlog_format_statement.inc | ||
|
|
||
| reset master; | ||
|
|
||
| set foreign_key_checks= 0, sql_auto_is_null=1, check_constraint_checks=0, unique_checks=0; | ||
| create table t (a int, check(a>1), foreign key(a) references x (x)) engine=InnoDB as select 1 as a; | ||
|
|
||
| source include/show_binlog_events.inc; | ||
|
|
||
| # Cleanup | ||
| drop table t; | ||
| reset master; | ||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like
check_constraint_checkswas added as a part of MDEV-7563, but its addition to#define OPTIONS_WRITTEN_TO_BIN_LOGinlog_event.hwas missed. The option is missing from your added .result file. Can you fix that and add the option there, as well asvoid Format_description_log_event::deduct_options_written_to_bin_log()inlog_event.cc?This will also fix MDEV-32447 :) Please consider adding the test case from MDEV-32447 as well, to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. I will make these changes and update the PR.