Skip to content

Commit 4baab86

Browse files
temeoJan Lindström
authored andcommitted
MDEV-18587 Don't reject DDLs if streaming replication is on
The check for streaming replication logging format in THD::decide_logging_format() did the check also for DDLs running in TOI mode. This caused DROP DATABASE to fail if streaming replication was enabled. Added check for THD wsrep execution mode and perform the check only if the THD is in local processing mode (i.e. not TOI). Added galera_sr_create_drop test to verify that CREATE/DROP statements pass even if streaming replication is on.
1 parent 75c6fce commit 4baab86

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
connection node_2;
2+
connection node_1;
3+
SET SESSION wsrep_trx_fragment_size=1;
4+
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
5+
connection node_2;
6+
SHOW CREATE TABLE t1;
7+
Table Create Table
8+
t1 CREATE TABLE `t1` (
9+
`f1` int(11) NOT NULL,
10+
PRIMARY KEY (`f1`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
12+
connection node_1;
13+
DROP TABLE t1;
14+
connection node_2;
15+
SHOW CREATE TABLE t1;
16+
ERROR 42S02: Table 'test.t1' doesn't exist
17+
CREATE DATABASE mdev_18587;
18+
connection node_2;
19+
SHOW DATABASES LIKE 'mdev_18587';
20+
Database (mdev_18587)
21+
mdev_18587
22+
connection node_1;
23+
DROP DATABASE mdev_18587;
24+
connection node_2;
25+
SHOW DATABASES LIKE 'mdev_18587';
26+
Database (mdev_18587)
27+
connection node_1;
28+
SET SESSION wsrep_trx_fragment_size=DEFAULT;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Verify that CREATE/DROP DDLs work when streaming replication is on.
3+
#
4+
5+
--source include/galera_cluster.inc
6+
7+
SET SESSION wsrep_trx_fragment_size=1;
8+
9+
#
10+
# CREATE/DROP TABLE succeeds and the change is propagated to node_2.
11+
#
12+
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
13+
--connection node_2
14+
SHOW CREATE TABLE t1;
15+
--connection node_1
16+
DROP TABLE t1;
17+
--connection node_2
18+
--error ER_NO_SUCH_TABLE
19+
SHOW CREATE TABLE t1;
20+
21+
#
22+
# CREATE/DROP DATABASE succeeds and the change is propagated to node_2.
23+
#
24+
CREATE DATABASE mdev_18587;
25+
--connection node_2
26+
SHOW DATABASES LIKE 'mdev_18587';
27+
--connection node_1
28+
DROP DATABASE mdev_18587;
29+
--connection node_2
30+
SHOW DATABASES LIKE 'mdev_18587';
31+
--connection node_1
32+
33+
SET SESSION wsrep_trx_fragment_size=DEFAULT;

sql/sql_class.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5987,7 +5987,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
59875987
binlog by filtering rules.
59885988
*/
59895989
#ifdef WITH_WSREP
5990-
if (WSREP_CLIENT_NNULL(this) && variables.wsrep_trx_fragment_size > 0)
5990+
if (WSREP_CLIENT_NNULL(this) && wsrep_thd_is_local(this) &&
5991+
variables.wsrep_trx_fragment_size > 0)
59915992
{
59925993
if (!is_current_stmt_binlog_format_row())
59935994
{

0 commit comments

Comments
 (0)