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

MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when...

MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam

Firstly, variables wsrep_mode, wsrep_forced_binlog_format, wsrep_replicate_myisam
should not be able to set if wsrep_on=OFF.

Secondly, if wsrep_mode=BINLOG_ROW_FORMAT_ONLY wsrep_forced_binlog_format
can be DEFAULT (UNSPECIFIED) or ROW.

Finally, if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] or
wsrep_replicate_myisam=ON we allow wsrep_forced_binlog_format
to be [DEFAULT|ROW].
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 231900e5
connection node_2;
connection node_1;
SET GLOBAL wsrep_mode=replicate_myisam;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=replicate_myisam;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=replicate_aria;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
SET GLOBAL wsrep_replicate_myisam=ON;
ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_replicate_myisam=ON;
ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
--source include/galera_cluster.inc
--source include/have_aria.inc
#
# MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
#
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_replicate_myisam=ON;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_replicate_myisam=ON;
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
wsrep-cluster-address=gcomm://
wsrep-provider=@ENV.WSREP_PROVIDER
binlog-format=ROW
--source include/have_wsrep.inc
--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # wsrep_forced_binlog_format
......
......@@ -6110,7 +6110,9 @@ static const char *wsrep_binlog_format_names[]=
static Sys_var_enum Sys_wsrep_forced_binlog_format(
"wsrep_forced_binlog_format", "binlog format to take effect over user's choice",
GLOBAL_VAR(wsrep_forced_binlog_format), CMD_LINE(REQUIRED_ARG),
wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC));
wsrep_binlog_format_names, DEFAULT(BINLOG_FORMAT_UNSPEC),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_forced_binlog_format_check));
static Sys_var_mybool Sys_wsrep_recover_datadir(
"wsrep_recover", "Recover database state after crash and exit",
......@@ -6120,7 +6122,8 @@ static Sys_var_mybool Sys_wsrep_recover_datadir(
static Sys_var_mybool Sys_wsrep_replicate_myisam(
"wsrep_replicate_myisam", "To enable myisam replication",
GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_replicate_myisam_check),
ON_UPDATE(wsrep_replicate_myisam_update),
DEPRECATED("'@@wsrep_mode=REPLICATE_MYISAM'")); // since 10.6.0
......
/* Copyright 2008-2022 Codership Oy <http://www.codership.com>
/* Copyright 2008-2023 Codership Oy <http://www.codership.com>
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
......@@ -986,6 +986,28 @@ bool wsrep_max_ws_size_update(sys_var *self, THD *thd, enum_var_type)
bool wsrep_mode_check(sys_var *self, THD* thd, set_var* var)
{
ulonglong new_wsrep_mode= var->save_result.ulonglong_value;
if (new_wsrep_mode && !WSREP_ON)
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode can't be set "
"if wsrep_on=OFF", MYF(0));
return true;
}
ulonglong old_wsrep_mode= wsrep_mode;
wsrep_mode= new_wsrep_mode;
if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) ||
wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))
{
if (!(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
wsrep_forced_binlog_format == BINLOG_FORMAT_ROW))
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] "
"can't be enabled if wsrep_forced_binlog != [NONE|ROW]", MYF(0));
wsrep_mode= old_wsrep_mode;
return true;
}
}
wsrep_mode= old_wsrep_mode;
return false;
}
......@@ -1150,3 +1172,55 @@ bool wsrep_replicate_myisam_update(sys_var *self, THD* thd, enum_var_type var_ty
wsrep_mode&= (~WSREP_MODE_REPLICATE_MYISAM);
return false;
}
bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var)
{
bool new_replicate_myisam= (bool)var->save_result.ulonglong_value;
if (new_replicate_myisam && !WSREP_ON_)
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=REPLICATE_MYISAM can't be enabled "
"if wsrep_on=OFF", MYF(0));
return true;
}
if (new_replicate_myisam &&
!(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
wsrep_forced_binlog_format == BINLOG_FORMAT_ROW))
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=REPLICATE_MYISAM can't be enabled "
"if wsrep_forced_binlog != [NONE|ROW]", MYF(0));
return true;
}
return false;
}
bool wsrep_forced_binlog_format_check(sys_var *self, THD* thd, set_var* var)
{
ulonglong new_forced_binlog_format= var->save_result.ulonglong_value;
if (new_forced_binlog_format != BINLOG_FORMAT_UNSPEC && !WSREP_ON)
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format can't be set "
"if wsrep_on=OFF", MYF(0));
return true;
}
if (!(new_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
new_forced_binlog_format == BINLOG_FORMAT_ROW))
{
if (wsrep_check_mode(WSREP_MODE_BINLOG_ROW_FORMAT_ONLY))
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set "
"if wsrep_mode=BINLOG_ROW_FORMAT_ONLY", MYF(0));
return true;
}
if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) ||
wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))
{
my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set "
"if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]", MYF(0));
return true;
}
}
return false;
}
/* Copyright (C) 2013 Codership Oy <info@codership.com>
/* Copyright (C) 2013-2023 Codership Oy <info@codership.com>
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
......@@ -112,6 +112,8 @@ extern bool wsrep_gtid_domain_id_update UPDATE_ARGS;
extern bool wsrep_mode_check CHECK_ARGS;
extern bool wsrep_strict_ddl_update UPDATE_ARGS;
extern bool wsrep_replicate_myisam_update UPDATE_ARGS;
extern bool wsrep_replicate_myisam_check CHECK_ARGS;
extern bool wsrep_forced_binlog_format_check CHECK_ARGS;
#else /* WITH_WSREP */
#define wsrep_provider_init(X)
......
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