Skip to content
/ server Public
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
CREATE TABLE t1 (i1 int, i2 int, pk int);
CREATE TABLE t2 (i1 int, i2 int, pk int);
CREATE TABLE t3 LIKE t1;
RESET MASTER;
ALTER TABLE t3 ENGINE = MERGE UNION (t1,t2);
CREATE OR REPLACE SEQUENCE s1;
DROP SEQUENCE s1;
FLUSH LOGS;
FOUND 2 /GTID [0-9]+-[0-9]+-[0-9]+/ in mysqlbinlog.sql
DROP TABLE t3,t2,t1;
FOUND 3 /GTID [0-9]+-[0-9]+-[0-9]+/ in mysqlbinlog.sql
The same as above number of samples must be found:
FOUND 2 /GTID [0-9]+-[0-9]+-[0-9]+ ddl/ in mysqlbinlog.sql
FOUND 3 /GTID [0-9]+-[0-9]+-[0-9]+ ddl/ in mysqlbinlog.sql
End of the tests
10 changes: 10 additions & 0 deletions mysql-test/suite/binlog/t/binlog_parallel_replication_ddl.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
--source include/have_log_bin.inc
--source include/have_binlog_format_mixed.inc

CREATE TABLE t1 (i1 int, i2 int, pk int);
CREATE TABLE t2 (i1 int, i2 int, pk int);
CREATE TABLE t3 LIKE t1;

RESET MASTER;
# MDEV-38623 ALTER TABLE ... ENGINE = MERGE is binlogged w/o ddl tag.
# Prove the DDL tag is in place.
ALTER TABLE t3 ENGINE = MERGE UNION (t1,t2);

# MDEV-27365 CREATE-or-REPLACE SEQUENCE bilogged without DDL flag
# Prove it is logged with the DDL flag.
Expand All @@ -14,6 +21,9 @@ CREATE OR REPLACE SEQUENCE s1;
DROP SEQUENCE s1;
FLUSH LOGS;

# cleanup
DROP TABLE t3,t2,t1;

--let $MYSQLD_DATADIR= `select @@datadir`
--exec $MYSQL_BINLOG --base64-output=decode-rows $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql

Expand Down
31 changes: 31 additions & 0 deletions sql/misc_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright (c) 2026, MariaDB Corporation

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MISC_UTILS_INCLUDED
#define MISC_UTILS_INCLUDED

template <typename T>
class StateGuard {
public:
explicit StateGuard(T& var) : ref(var), value(var) {}
~StateGuard() { ref = value; }

StateGuard(const StateGuard&) = delete;
StateGuard& operator=(const StateGuard&) = delete;

private:
T& ref;
T value;
};
#endif /* MISC_UTILS_INCLUDED */
2 changes: 2 additions & 0 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Enable_wsrep_ctas_guard
#ifdef _WIN32
#include <io.h>
#endif
#include "misc_utils.h"

const LEX_CSTRING primary_key_name= { STRING_WITH_LEN("PRIMARY") };
static const LEX_CSTRING generated_by_server=
Expand Down Expand Up @@ -11022,6 +11023,7 @@ do_continue:;
THD_STAGE_INFO(thd, stage_manage_keys);
alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff);
StateGuard<unsigned int> g(thd->transaction->stmt.m_unsafe_rollback_flags);
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
goto err_new_table_cleanup;
}
Expand Down