Skip to content
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

MDEV-36265: Unique error for changing Domain ID with open temporary tables #3895

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
SET SESSION gtid_domain_id= 0;
SET SESSION gtid_domain_id= 204;
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction
ERROR HY000: Cannot modify @@session.gtid_domain_id while there are open temporary tables being binlogged
SET SESSION binlog_format=statement;
INSERT INTO t2 VALUES (2);
SET SESSION gtid_domain_id= 205;
ERROR HY000: Cannot modify @@session.gtid_domain_id or @@session.gtid_seq_no inside a transaction
ERROR HY000: Cannot modify @@session.gtid_domain_id while there are open temporary tables being binlogged
DROP TEMPORARY TABLE t2;
SET SESSION gtid_domain_id= @old_domain;
SET SESSION binlog_format= @old_mode;
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ SET SESSION gtid_domain_id= 0;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
SET SESSION gtid_domain_id= 0;
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO
--error ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID
SET SESSION gtid_domain_id= 204;
SET SESSION binlog_format=statement;
INSERT INTO t2 VALUES (2);
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO
--error ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID
SET SESSION gtid_domain_id= 205;
DROP TEMPORARY TABLE t2;
SET SESSION gtid_domain_id= @old_domain;
Expand Down
4 changes: 3 additions & 1 deletion sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12296,4 +12296,6 @@ WARN_INDEX_HINTS_IGNORED
eng "Index hints are ignored because they are incompatible with RETURNING clause"
ukr "Підказки по використанню индексів ігноруются тому що вони несумісні з RETURNING"
ER_SIGNAL_SKIP_ROW_FROM_TRIGGER
eng "The row is skipped by a trigger implementation"
eng "The row is skipped by a trigger implementation"
ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID
eng "Cannot modify @@session.gtid_domain_id while there are open temporary tables being binlogged"
7 changes: 1 addition & 6 deletions sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1978,17 +1978,12 @@ check_gtid_domain_id(sys_var *self, THD *thd, set_var *var)
domains, temporary table must be exclusive to a single thread.
In row-based binlogging, temporary tables do not end up in the binlog,
so there is no such issue.

ToDo: When merging to next (non-GA) release, introduce a more specific
error that describes that the problem is changing gtid_domain_id with
open temporary tables in statement/mixed binlogging mode; it is not
really due to doing it inside a "transaction".
*/
if (thd->has_thd_temporary_tables() &&
!thd->is_current_stmt_binlog_format_row() &&
var->save_result.ulonglong_value != thd->variables.gtid_domain_id)
{
my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_GTID_DOMAIN_ID_SEQ_NO,
my_error(ER_TEMPORARY_TABLES_PREVENT_SWITCH_GTID_DOMAIN_ID,
MYF(0));
return true;
}
Expand Down