Skip to content

Commit 0784dd3

Browse files
janlindstromsysprg
authored andcommitted
MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
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: Julius Goryavsky <julius.goryavsky@mariadb.com>
1 parent 53c693e commit 0784dd3

File tree

3 files changed

+135
-28
lines changed

3 files changed

+135
-28
lines changed
Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
connection node_2;
22
connection node_1;
3-
SET GLOBAL wsrep_replicate_myisam=ON;
3+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
44
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
55
INSERT INTO t VALUES();
66
SELECT * FROM t;
@@ -12,7 +12,7 @@ f0
1212
NULL
1313
DROP TABLE t;
1414
connection node_1;
15-
SET GLOBAL wsrep_replicate_myisam=ON;
15+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
1616
SET GLOBAL wsrep_forced_binlog_format=ROW;
1717
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
1818
INSERT INTO t VALUES();
@@ -25,20 +25,60 @@ f0
2525
NULL
2626
DROP TABLE t;
2727
connection node_1;
28+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
29+
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
30+
INSERT INTO t VALUES();
31+
SELECT * FROM t;
32+
f0
33+
NULL
34+
connection node_2;
35+
SELECT * FROM t;
36+
f0
37+
NULL
38+
DROP TABLE t;
39+
connection node_1;
40+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
41+
SET GLOBAL wsrep_forced_binlog_format=ROW;
42+
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
43+
INSERT INTO t VALUES();
44+
SELECT * FROM t;
45+
f0
46+
NULL
47+
connection node_2;
48+
SELECT * FROM t;
49+
f0
50+
NULL
51+
DROP TABLE t;
52+
connection node_1;
53+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
54+
SET GLOBAL wsrep_forced_binlog_format=MIXED;
55+
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
56+
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
57+
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
58+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
59+
SET GLOBAL wsrep_forced_binlog_format=MIXED;
60+
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
61+
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
62+
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
63+
SET GLOBAL wsrep_mode=DEFAULT;
64+
SET GLOBAL wsrep_forced_binlog_format=MIXED;
65+
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
66+
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
67+
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
68+
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
69+
SET GLOBAL wsrep_mode=DEFAULT;
70+
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
71+
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
72+
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
73+
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
74+
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
2875
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
29-
SET GLOBAL wsrep_replicate_myisam=OFF;
76+
SET GLOBAL wsrep_mode=DEFAULT;
3077
SET GLOBAL wsrep_forced_binlog_format=MIXED;
3178
SET GLOBAL wsrep_replicate_myisam=ON;
32-
ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW]
79+
ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW]
3380
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
3481
SET GLOBAL wsrep_replicate_myisam=ON;
35-
ERROR HY000: wsrep_replicate_myisam=ON can't be enabled if wsrep_forced_binlog != [NONE|ROW]
36-
SET GLOBAL wsrep_forced_binlog_format=NONE;
37-
SET GLOBAL wsrep_replicate_myisam=OFF;
38-
SET GLOBAL wsrep_replicate_myisam=ON;
39-
SET GLOBAL wsrep_forced_binlog_format=MIXED;
40-
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON
41-
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
42-
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_replicate_myisam=ON
43-
SET GLOBAL wsrep_forced_binlog_format=NONE;
44-
SET GLOBAL wsrep_replicate_myisam=OFF;
82+
ERROR HY000: wsrep_mode=REPLICATE_MYISAM can't be enabled if wsrep_forced_binlog != [NONE|ROW]
83+
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
84+
SET GLOBAL wsrep_mode=DEFAULT;
Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
--source include/galera_cluster.inc
2+
--source include/have_aria.inc
23

34
#
45
# MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
56
#
6-
SET GLOBAL wsrep_replicate_myisam=ON;
7+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
78
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
89
INSERT INTO t VALUES();
910
SELECT * FROM t;
@@ -12,7 +13,7 @@ SELECT * FROM t;
1213
DROP TABLE t;
1314

1415
--connection node_1
15-
SET GLOBAL wsrep_replicate_myisam=ON;
16+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
1617
SET GLOBAL wsrep_forced_binlog_format=ROW;
1718
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
1819
INSERT INTO t VALUES();
@@ -22,24 +23,59 @@ SELECT * FROM t;
2223
DROP TABLE t;
2324

2425
--connection node_1
25-
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
26-
SET GLOBAL wsrep_replicate_myisam=OFF;
26+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
27+
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
28+
INSERT INTO t VALUES();
29+
SELECT * FROM t;
30+
--connection node_2
31+
SELECT * FROM t;
32+
DROP TABLE t;
33+
34+
--connection node_1
35+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
36+
SET GLOBAL wsrep_forced_binlog_format=ROW;
37+
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
38+
INSERT INTO t VALUES();
39+
SELECT * FROM t;
40+
--connection node_2
41+
SELECT * FROM t;
42+
DROP TABLE t;
2743

44+
--connection node_1
45+
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
46+
--error ER_WRONG_ARGUMENTS
2847
SET GLOBAL wsrep_forced_binlog_format=MIXED;
2948
--error ER_WRONG_ARGUMENTS
30-
SET GLOBAL wsrep_replicate_myisam=ON;
3149
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
50+
51+
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
3252
--error ER_WRONG_ARGUMENTS
33-
SET GLOBAL wsrep_replicate_myisam=ON;
53+
SET GLOBAL wsrep_forced_binlog_format=MIXED;
54+
--error ER_WRONG_ARGUMENTS
55+
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
3456

35-
SET GLOBAL wsrep_forced_binlog_format=NONE;
36-
SET GLOBAL wsrep_replicate_myisam=OFF;
57+
SET GLOBAL wsrep_mode=DEFAULT;
58+
SET GLOBAL wsrep_forced_binlog_format=MIXED;
59+
--error ER_WRONG_ARGUMENTS
60+
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
61+
--error ER_WRONG_ARGUMENTS
62+
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
3763

38-
SET GLOBAL wsrep_replicate_myisam=ON;
64+
SET GLOBAL wsrep_mode=DEFAULT;
65+
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
66+
--error ER_WRONG_ARGUMENTS
67+
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
3968
--error ER_WRONG_ARGUMENTS
69+
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
70+
71+
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
72+
SET GLOBAL wsrep_mode=DEFAULT;
4073
SET GLOBAL wsrep_forced_binlog_format=MIXED;
4174
--error ER_WRONG_ARGUMENTS
75+
SET GLOBAL wsrep_replicate_myisam=ON;
4276
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
77+
--error ER_WRONG_ARGUMENTS
78+
SET GLOBAL wsrep_replicate_myisam=ON;
4379

44-
SET GLOBAL wsrep_forced_binlog_format=NONE;
45-
SET GLOBAL wsrep_replicate_myisam=OFF;
80+
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
81+
SET GLOBAL wsrep_mode=DEFAULT;

sql/wsrep_var.cc

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,28 @@ bool wsrep_max_ws_size_update(sys_var *self, THD *thd, enum_var_type)
984984

985985
bool wsrep_mode_check(sys_var *self, THD* thd, set_var* var)
986986
{
987+
ulonglong new_wsrep_mode= var->save_result.ulonglong_value;
988+
if (new_wsrep_mode && !WSREP_ON)
989+
{
990+
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode can't be set "
991+
"if wsrep_on=OFF", MYF(0));
992+
return true;
993+
}
994+
ulonglong old_wsrep_mode= wsrep_mode;
995+
wsrep_mode= new_wsrep_mode;
996+
if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) ||
997+
wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))
998+
{
999+
if (!(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
1000+
wsrep_forced_binlog_format == BINLOG_FORMAT_ROW))
1001+
{
1002+
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] "
1003+
"can't be enabled if wsrep_forced_binlog != [NONE|ROW]", MYF(0));
1004+
wsrep_mode= old_wsrep_mode;
1005+
return true;
1006+
}
1007+
}
1008+
wsrep_mode= old_wsrep_mode;
9871009
return false;
9881010
}
9891011

@@ -1157,7 +1179,7 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var)
11571179
!(wsrep_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
11581180
wsrep_forced_binlog_format == BINLOG_FORMAT_ROW))
11591181
{
1160-
my_message(ER_WRONG_ARGUMENTS, "wsrep_replicate_myisam=ON can't be enabled "
1182+
my_message(ER_WRONG_ARGUMENTS, "wsrep_mode=REPLICATE_MYISAM can't be enabled "
11611183
"if wsrep_forced_binlog != [NONE|ROW]", MYF(0));
11621184
return true;
11631185
}
@@ -1167,13 +1189,22 @@ bool wsrep_replicate_myisam_check(sys_var *self, THD* thd, set_var* var)
11671189
bool wsrep_forced_binlog_format_check(sys_var *self, THD* thd, set_var* var)
11681190
{
11691191
ulonglong new_forced_binlog_format= var->save_result.ulonglong_value;
1192+
11701193
if (!(new_forced_binlog_format == BINLOG_FORMAT_UNSPEC ||
11711194
new_forced_binlog_format == BINLOG_FORMAT_ROW))
11721195
{
1173-
if (wsrep_replicate_myisam)
1196+
if (wsrep_check_mode(WSREP_MODE_BINLOG_ROW_FORMAT_ONLY))
1197+
{
1198+
my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set "
1199+
"if wsrep_mode=BINLOG_ROW_FORMAT_ONLY", MYF(0));
1200+
return true;
1201+
}
1202+
1203+
if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM) ||
1204+
wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))
11741205
{
11751206
my_message(ER_WRONG_ARGUMENTS, "wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set "
1176-
"if wsrep_replicate_myisam=ON", MYF(0));
1207+
"if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]", MYF(0));
11771208
return true;
11781209
}
11791210
}

0 commit comments

Comments
 (0)