Skip to content

Commit 66aa250

Browse files
committed
MDEV-37935 : Assertion `0' failed in int wsrep::transaction::before_rollback()
Problem was executable comment in REPLACE that caused consistency check that is not supported for RSU and !InnoDB tables. Fix is to check is Online Schema Upgrade (OSU) method something else than TOI and if it is then table storage engine must be InnoDB or error is produced and execution returns and no consistency check is done.
1 parent 808851d commit 66aa250

File tree

3 files changed

+83
-8
lines changed

3 files changed

+83
-8
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
connection node_2;
2+
connection node_1;
3+
SET sql_mode='';
4+
SET SESSION autocommit=0;
5+
SET SESSION enforce_storage_engine=Aria;
6+
SET WSREP_OSU_METHOD = RSU;
7+
CREATE TABLE t1 (a TEXT) ;
8+
Warnings:
9+
Note 1266 Using storage engine Aria for table 't1'
10+
Note 1266 Using storage engine Aria for table 't1'
11+
CREATE TABLE t2 (a TEXT) ;
12+
Warnings:
13+
Note 1266 Using storage engine Aria for table 't2'
14+
Note 1266 Using storage engine Aria for table 't2'
15+
SET SESSION autocommit=1;
16+
REPLACE INTO t2 (a) SELECT a from t1;
17+
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
18+
REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1;
19+
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
20+
SET WSREP_OSU_METHOD = TOI;
21+
DROP TABLE t1,t2;
22+
SET sql_mode='';
23+
SET SESSION autocommit=0;
24+
SET SESSION enforce_storage_engine=MyISAM;
25+
SET WSREP_OSU_METHOD = RSU;
26+
CREATE TABLE t1 (a TEXT) ;
27+
Warnings:
28+
Note 1266 Using storage engine MyISAM for table 't1'
29+
Note 1266 Using storage engine MyISAM for table 't1'
30+
CREATE TABLE t2 (a TEXT) ;
31+
Warnings:
32+
Note 1266 Using storage engine MyISAM for table 't2'
33+
Note 1266 Using storage engine MyISAM for table 't2'
34+
SET SESSION autocommit=1;
35+
REPLACE INTO t2 (a) SELECT a from t1;
36+
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
37+
REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1;
38+
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
39+
SET WSREP_OSU_METHOD = TOI;
40+
DROP TABLE t1,t2;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--source include/galera_cluster.inc
2+
--source include/have_aria.inc
3+
4+
SET sql_mode='';
5+
SET SESSION autocommit=0;
6+
SET SESSION enforce_storage_engine=Aria;
7+
SET WSREP_OSU_METHOD = RSU;
8+
CREATE TABLE t1 (a TEXT) ;
9+
CREATE TABLE t2 (a TEXT) ;
10+
SET SESSION autocommit=1;
11+
--error ER_NOT_SUPPORTED_YET
12+
REPLACE INTO t2 (a) SELECT a from t1;
13+
--error ER_NOT_SUPPORTED_YET
14+
REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1;
15+
SET WSREP_OSU_METHOD = TOI;
16+
DROP TABLE t1,t2;
17+
18+
SET sql_mode='';
19+
SET SESSION autocommit=0;
20+
SET SESSION enforce_storage_engine=MyISAM;
21+
SET WSREP_OSU_METHOD = RSU;
22+
CREATE TABLE t1 (a TEXT) ;
23+
CREATE TABLE t2 (a TEXT) ;
24+
SET SESSION autocommit=1;
25+
--error ER_NOT_SUPPORTED_YET
26+
REPLACE INTO t2 (a) SELECT a from t1;
27+
--error ER_NOT_SUPPORTED_YET
28+
REPLACE INTO t2 (a) SELECT /*!99997 */ a from t1;
29+
SET WSREP_OSU_METHOD = TOI;
30+
DROP TABLE t1,t2;

sql/sql_parse.cc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,10 +4724,21 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
47244724
#ifdef WITH_WSREP
47254725
if (wsrep && !first_table->view)
47264726
{
4727-
const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type;
4727+
const handlerton *hton= first_table->table->file->partition_ht() ?
4728+
first_table->table->file->partition_ht() :
4729+
first_table->table->file->ht;
4730+
4731+
const legacy_db_type db_type= hton->db_type;
47284732
// For InnoDB we don't need to worry about anything here:
47294733
if (db_type != DB_TYPE_INNODB)
47304734
{
4735+
/* Only TOI allowed to !InnoDB tables */
4736+
if (thd->variables.wsrep_OSU_method != WSREP_OSU_TOI)
4737+
{
4738+
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine");
4739+
break;
4740+
}
4741+
47314742
// For consistency check inserted table needs to be InnoDB
47324743
if (thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK)
47334744
{
@@ -4737,16 +4748,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
47374748
" for InnoDB tables.");
47384749
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
47394750
}
4740-
/* Only TOI allowed to !InnoDB tables */
4741-
if (wsrep_OSU_method_get(thd) != WSREP_OSU_TOI)
4742-
{
4743-
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine");
4744-
break;
4745-
}
47464751
// For !InnoDB we start TOI if it is not yet started and hope for the best
47474752
if (!wsrep_toi)
47484753
{
4749-
/* Currently we support TOI for MyISAM only. */
4754+
/* Currently we support TOI for MyISAM && Aria only. */
47504755
if ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) ||
47514756
(db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)))
47524757
{

0 commit comments

Comments
 (0)