1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-18 21:44:20 +03:00

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

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen 2025-03-18 10:27:40 +01:00
parent ab468e33af
commit 3b3c512feb
4 changed files with 8 additions and 11 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -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;
}