Commit c768ac62 authored by Jan Lindström's avatar Jan Lindström Committed by Julius Goryavsky

MDEV-25731 : Assertion `mode_ == m_local' failed in wsrep::client_state::streaming_params()

Problem was that if wsrep_load_data_splitting was used
streaming replication (SR) parameters were set
for MyISAM table. Galera does not currently support SR for
MyISAM.

Fix is to ignore wsrep_load_data_splitting setting (with
warning) if table is not InnoDB table.

This is 10.4-10.5 case of fix.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent daaa16a4
connection node_2;
connection node_1;
connection node_1;
SET GLOBAL wsrep_load_data_splitting=ON;
Warnings:
Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
SET GLOBAL wsrep_replicate_myisam=ON;
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n';
Warnings:
Warning 1235 wsrep_load_data_splitting for other than InnoDB tables
SELECT COUNT(*) AS EXPECT_6 FROM t1;
EXPECT_6
6
connection node_2;
SELECT COUNT(*) AS EXPECT_6 FROM t1;
EXPECT_6
6
connection node_1;
ALTER TABLE t1 ENGINE=InnoDB;
LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n';
SELECT COUNT(*) AS EXPECT_12 FROM t1;
EXPECT_12
12
connection node_2;
SELECT COUNT(*) AS EXPECT_12 FROM t1;
EXPECT_12
12
connection node_1;
DROP TABLE t1;
SET GLOBAL wsrep_load_data_splitting=OFF;
Warnings:
Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
SET GLOBAL wsrep_replicate_myisam=OFF;
--source include/galera_cluster.inc
--source include/have_aria.inc
--connection node_1
SET GLOBAL wsrep_load_data_splitting=ON;
SET GLOBAL wsrep_replicate_myisam=ON;
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n';
SELECT COUNT(*) AS EXPECT_6 FROM t1;
--connection node_2
SELECT COUNT(*) AS EXPECT_6 FROM t1;
--connection node_1
ALTER TABLE t1 ENGINE=InnoDB;
LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n';
SELECT COUNT(*) AS EXPECT_12 FROM t1;
--connection node_2
SELECT COUNT(*) AS EXPECT_12 FROM t1;
--connection node_1
DROP TABLE t1;
SET GLOBAL wsrep_load_data_splitting=OFF;
SET GLOBAL wsrep_replicate_myisam=OFF;
......@@ -105,23 +105,41 @@ class Term_string
class Wsrep_load_data_split
{
public:
Wsrep_load_data_split(THD *thd)
Wsrep_load_data_split(THD *thd, TABLE *table)
: m_thd(thd)
, m_load_data_splitting(wsrep_load_data_splitting)
, m_load_data_splitting(false)
, m_fragment_unit(thd->wsrep_trx().streaming_context().fragment_unit())
, m_fragment_size(thd->wsrep_trx().streaming_context().fragment_size())
{
if (WSREP(m_thd) && m_load_data_splitting)
/*
We support load data splitting for InnoDB only as it will use
streaming replication (SR).
*/
if (WSREP(thd) && wsrep_load_data_splitting)
{
/* Override streaming settings with backward compatible values for
load data splitting */
m_thd->wsrep_cs().streaming_params(wsrep::streaming_context::row, 10000);
handlerton *ht= table->s->db_type();
// For partitioned tables find underlying hton
if (table->file->partition_ht())
ht= table->file->partition_ht();
if (ht->db_type != DB_TYPE_INNODB)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_NOT_SUPPORTED_YET,
"wsrep_load_data_splitting for other than InnoDB tables");
}
else
{
/* Override streaming settings with backward compatible values for
load data splitting */
m_thd->wsrep_cs().streaming_params(wsrep::streaming_context::row, 10000);
m_load_data_splitting= true;
}
}
}
~Wsrep_load_data_split()
{
if (WSREP(m_thd) && m_load_data_splitting)
if (m_load_data_splitting)
{
/* Restore original settings */
m_thd->wsrep_cs().streaming_params(m_fragment_unit, m_fragment_size);
......@@ -346,6 +364,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
bool is_concurrent;
#endif
const char *db= table_list->db.str; // This is never null
/*
If path for file is not defined, we will use the current database.
If this is not set, we will use the directory where the table to be
......@@ -356,9 +375,6 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
bool transactional_table __attribute__((unused));
DBUG_ENTER("mysql_load");
#ifdef WITH_WSREP
Wsrep_load_data_split wsrep_load_data_split(thd);
#endif /* WITH_WSREP */
/*
Bug #34283
mysqlbinlog leaves tmpfile after termination if binlog contains
......@@ -422,6 +438,11 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
{
DBUG_RETURN(TRUE);
}
#ifdef WITH_WSREP
Wsrep_load_data_split wsrep_load_data_split(thd, table_list->table);
#endif /* WITH_WSREP */
thd_proc_info(thd, "Executing");
/*
Let us emit an error if we are loading data to table which is used
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment