MDEV-33997 : Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*)

Problem was that we did not found that table was partitioned
and then we should find what is actual underlaying storage
engine.

We should not use RSU for !InnoDB tables.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Jan Lindström 2024-04-29 10:13:03 +03:00 committed by Julius Goryavsky
parent 5a61fd5819
commit b1d74b7e72
6 changed files with 115 additions and 6 deletions

View file

@ -0,0 +1,38 @@
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
c
1
1
DROP TABLE t;
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
c
1
DROP TABLE t;
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
SELECT * FROM t;
c
DROP TABLE t;
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
COMMIT;
SELECT * FROM t;
c
1
DROP TABLE t;

View file

@ -0,0 +1,9 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
binlog-format=ROW
innodb-flush-log-at-trx-commit=1
wsrep-cluster-address=gcomm://
wsrep-provider=@ENV.WSREP_PROVIDER
innodb-autoinc-lock-mode=2

View file

@ -0,0 +1,4 @@
[binlogon]
log-bin
[binlogoff]

View file

@ -0,0 +1,49 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_partition.inc
#
# MDEV-33997: Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*)
#
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
DROP TABLE t;
#
# MDEV-27296 : Assertion `((thd && (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on)) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed
# Second test case
#
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
DROP TABLE t;
#
# We should not allow RSU for MyISAM
#
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
--error ER_NOT_SUPPORTED_YET
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
DROP TABLE t;
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
--error ER_NOT_SUPPORTED_YET
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
DROP TABLE t;

View file

@ -5519,13 +5519,15 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
#ifdef WITH_WSREP
if (WSREP(thd))
{
WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
WSREP_WARN("BF applier thread=%lu failed to open_and_lock_tables for "
"%s, fatal: %d "
"wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
thd->get_stmt_da()->sql_errno(),
thd->is_fatal_error,
thd->wsrep_cs().mode(),
thd->wsrep_trx().state(),
(long long) wsrep_thd_trx_seqno(thd));
thd_get_thread_id(thd),
thd->get_stmt_da()->message(),
thd->is_fatal_error,
thd->wsrep_cs().mode(),
thd->wsrep_trx().state(),
wsrep_thd_trx_seqno(thd));
}
#endif /* WITH_WSREP */
if (thd->is_error() &&

View file

@ -4759,6 +4759,13 @@ mysql_execute_command(THD *thd)
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
}
/* Only TOI allowed to !InnoDB tables */
if (!is_innodb && wsrep_OSU_method_get(thd) != WSREP_OSU_TOI)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine");
break;
}
// For !InnoDB we start TOI if it is not yet started and hope for the best
if (!is_innodb && !wsrep_toi)
{