Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2021-01-25 12:44:24 +02:00
commit 961c7938bb
62 changed files with 1128 additions and 283 deletions

@ -1 +1 @@
Subproject commit e38244220646a7e95c9be22576460aa7a4eb715f Subproject commit 018663324bf9cbe11b0b2191c6fb6c10564bb4e5

View File

@ -17034,6 +17034,78 @@ id
2 2
3 3
DROP TABLE t; DROP TABLE t;
#
# MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "v1.a = 3",
"materialized": {
"query_block": {
"union_result": {
"table_name": "<union2,3>",
"access_type": "ALL",
"r_loops": 1,
"r_rows": 2,
"query_specifications": [
{
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "t1.a = 3"
}
}
},
{
"query_block": {
"select_id": 3,
"operation": "UNION",
"table": {
"message": "No tables used"
}
}
}
]
}
}
}
}
}
}
SELECT * from v1 WHERE a=3;
a
3
DROP VIEW v1;
DROP TABLE t1;
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-18679: materialized view with SELECT S containing materialized # MDEV-18679: materialized view with SELECT S containing materialized

View File

@ -3466,6 +3466,19 @@ eval set statement optimizer_switch='split_materialized=on' for $q;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-23804: Server crashes in st_select_lex::collect_grouping_fields_for_derived
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
--source include/analyze-format.inc
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
SELECT * from v1 WHERE a=3;
DROP VIEW v1;
DROP TABLE t1;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -179,3 +179,32 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select NULL AS `NULL` Note 1003 select NULL AS `NULL`
#
# MDEV-20763 Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode
#
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= default;
flush tables;
update t1 set a = 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` binary(1) GENERATED ALWAYS AS (NULL) VIRTUAL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= 'empty_string_is_null';
flush tables;
update t1 set a = 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` binary(1) GENERATED ALWAYS AS ('') VIRTUAL,
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;

View File

@ -6,3 +6,22 @@ USE test;
set @mode='EMPTY_STRING_IS_NULL'; set @mode='EMPTY_STRING_IS_NULL';
--source include/empty_string_literal.inc --source include/empty_string_literal.inc
--echo #
--echo # MDEV-20763 Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode
--echo #
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= default;
flush tables;
update t1 set a = 2;
show create table t1;
drop table t1;
create table t1 (a int, b binary(1) generated always as (''), key(a,b));
insert into t1 (a) values (1);
set sql_mode= 'empty_string_is_null';
flush tables;
update t1 set a = 2;
show create table t1;
drop table t1;

View File

@ -2304,5 +2304,14 @@ create table t2 (n int);
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2'); insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
drop table t1, t2; drop table t1, t2;
# #
# MDEV-24593 Signal 11 when group by primary key of table joined to information_schema.columns
#
create table t1 (f varchar(64) primary key);
select f from information_schema.columns i
inner join t1 on f=i.column_name
group by f;
f
drop table t1;
#
# End of 10.3 tests # End of 10.3 tests
# #

View File

@ -2005,6 +2005,16 @@ create table t2 (n int);
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2'); insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-24593 Signal 11 when group by primary key of table joined to information_schema.columns
--echo #
create table t1 (f varchar(64) primary key);
select f from information_schema.columns i
inner join t1 on f=i.column_name
group by f;
drop table t1;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -1825,6 +1825,15 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1
EXECUTE IMMEDIATE 'if(`systeminfo'; EXECUTE IMMEDIATE 'if(`systeminfo';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1
#
# MDEV-23666 Assertion failed in Lex_input_stream::body_utf8_append
#
SET @@sql_mode='ANSI_QUOTES';
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"' at line 1
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"abc' at line 1
SET @@sql_mode=@save_sql_mode;
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-19540: 10.4 allow lock options with SELECT in brackets # MDEV-19540: 10.4 allow lock options with SELECT in brackets

View File

@ -1566,6 +1566,21 @@ EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'if(`systeminfo'; EXECUTE IMMEDIATE 'if(`systeminfo';
--echo #
--echo # MDEV-23666 Assertion failed in Lex_input_stream::body_utf8_append
--echo #
SET @@sql_mode='ANSI_QUOTES';
# Without a patch execution of the following statements results in assertion
# in Lex_input_stream::body_utf8_append on parsing the statement
--error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"';
--error ER_PARSE_ERROR
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
SET @@sql_mode=@save_sql_mode;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -1,7 +1,7 @@
# #
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
# #
connect con1,localhost,root,,; connect con1,localhost,root;
connection con1; connection con1;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go'; SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
connection default; connection default;
@ -13,17 +13,21 @@ User
disconnect con1; disconnect con1;
connection default; connection default;
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
End of 5.5 tests #
# End of 5.5 tests
#
# #
# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
# #
connect con1,localhost,root,,; connect con1,localhost,root;
select sleep(100000);; select sleep(100000);
connection default; connection default;
SHOW EXPLAIN FOR con_id; SHOW EXPLAIN FOR $con_id;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select sleep(100000) Note 1003 select sleep(100000)
KILL QUERY con_id; KILL QUERY $con_id;
#
# End of 10.2 tests # End of 10.2 tests
#

View File

@ -7,7 +7,7 @@ source include/count_sessions.inc;
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes --echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
--echo # --echo #
connect (con1,localhost,root,,); connect con1,localhost,root;
connection con1; connection con1;
@ -39,22 +39,22 @@ SET DEBUG_SYNC = 'RESET';
source include/wait_until_count_sessions.inc; source include/wait_until_count_sessions.inc;
--echo End of 5.5 tests --echo #
--echo # End of 5.5 tests
--echo #
--echo # --echo #
--echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep --echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
--echo # --echo #
--connect (con1,localhost,root,,) --connect con1,localhost,root
--let $con_id = `SELECT CONNECTION_ID()` --let $con_id = `SELECT CONNECTION_ID()`
--send select sleep(100000); --send select sleep(100000)
--connection default --connection default
evalp SHOW EXPLAIN FOR $con_id;
evalp KILL QUERY $con_id;
--replace_result $con_id con_id --echo #
eval SHOW EXPLAIN FOR $con_id;
--replace_result $con_id con_id
eval KILL QUERY $con_id;
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo #

View File

@ -115,7 +115,6 @@ RETURN 'str';
END| END|
ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
SET NAMES utf8; SET NAMES utf8;
DROP FUNCTION IF EXISTS bug48766;
CREATE FUNCTION bug48766 () CREATE FUNCTION bug48766 ()
RETURNS ENUM( 'w' ) CHARACTER SET ucs2 RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0; RETURN 0;
@ -140,3 +139,13 @@ WHERE ROUTINE_NAME='bug48766';
DTD_IDENTIFIER DTD_IDENTIFIER
enum('а','б','в','г') enum('а','б','в','г')
DROP FUNCTION bug48766; DROP FUNCTION bug48766;
call mtr.add_suppression('invalid value in column mysql.proc.');
set collation_connection=ucs2_general_ci;
insert into mysql.proc (db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, sql_mode, comment, character_set_client, collation_connection, db_collation, body_utf8 ) values ( 'a', 'a', 'function', 'bug14233_1', 'sql', 'reads_sql_data', 'no', 'definer', '', 'int(10)', 'select * from mysql.user', 'root@localhost', now(), '0000-00-00 00:00:00', '', '', '', '', '', 'select * from mysql.user' );
select routine_name from information_schema.routines where routine_name='a';
routine_name
a
Warnings:
Warning 1601 Creation context of stored routine `a`.`a` is invalid
set collation_connection=default;
delete from mysql.proc where name='a';

View File

@ -151,9 +151,6 @@ delimiter ;|
# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause # Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause
# #
SET NAMES utf8; SET NAMES utf8;
--disable_warnings
DROP FUNCTION IF EXISTS bug48766;
--enable_warnings
# #
# Test that Latin letters are not prepended with extra '\0'. # Test that Latin letters are not prepended with extra '\0'.
# #
@ -175,3 +172,13 @@ SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME='bug48766'; WHERE ROUTINE_NAME='bug48766';
DROP FUNCTION bug48766; DROP FUNCTION bug48766;
#
#
#
call mtr.add_suppression('invalid value in column mysql.proc.');
set collation_connection=ucs2_general_ci;
insert into mysql.proc (db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, sql_mode, comment, character_set_client, collation_connection, db_collation, body_utf8 ) values ( 'a', 'a', 'function', 'bug14233_1', 'sql', 'reads_sql_data', 'no', 'definer', '', 'int(10)', 'select * from mysql.user', 'root@localhost', now(), '0000-00-00 00:00:00', '', '', '', '', '', 'select * from mysql.user' );
select routine_name from information_schema.routines where routine_name='a';
set collation_connection=default;
delete from mysql.proc where name='a';

View File

@ -2616,5 +2616,39 @@ Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 except /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 except /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4
drop table t1,t2,t3; drop table t1,t2,t3;
# #
# MDEV-24387: Wrong number of decimal digits in certain UNION/Subqery
# constellation
#
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT * from (SELECT NULL) t;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def CAST(1 AS UNSIGNED) 246 2 1 Y 32896 0 63
CAST(1 AS UNSIGNED)
1
NULL
SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT NULL) t;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def CAST(1 AS SIGNED) 3 2 1 Y 32896 0 63
CAST(1 AS SIGNED)
1
NULL
SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT CAST(1 AS UNSIGNED)) t;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def CAST(1 AS SIGNED) 246 11 1 N 32897 0 63
CAST(1 AS SIGNED)
1
1
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT NULL;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def CAST(1 AS UNSIGNED) 246 2 1 Y 32896 0 63
CAST(1 AS UNSIGNED)
1
NULL
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT CAST(1 AS SIGNED);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def CAST(1 AS UNSIGNED) 246 2 1 N 32897 0 63
CAST(1 AS UNSIGNED)
1
1
#
# End of 10.3 tests # End of 10.3 tests
# #

View File

@ -1865,6 +1865,24 @@ select * from t1 where a > 4;
drop table t1,t2,t3; drop table t1,t2,t3;
--echo #
--echo # MDEV-24387: Wrong number of decimal digits in certain UNION/Subqery
--echo # constellation
--echo #
--disable_ps_protocol
--enable_metadata
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT * from (SELECT NULL) t;
SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT NULL) t;
SELECT CAST(1 AS SIGNED) UNION ALL SELECT * from (SELECT CAST(1 AS UNSIGNED)) t;
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT NULL;
SELECT CAST(1 AS UNSIGNED) UNION ALL SELECT CAST(1 AS SIGNED);
--disable_metadata
--enable_ps_protocol
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View File

@ -13,8 +13,7 @@ CREATE TABLE t1 (
`name` varchar(32) default 'name') `name` varchar(32) default 'name')
DEFAULT CHARSET=latin1; DEFAULT CHARSET=latin1;
connection master; connection master;
CREATE TABLE t1 ENGINE=FEDERATED CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -38,6 +37,9 @@ id group a\\b a\\ name
1 1 2 NULL foo 1 1 2 NULL foo
2 1 2 NULL fee 2 1 2 NULL fee
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-11311 Create federated table does not work as expected
#
create table t1 ( create table t1 (
a bigint(20) not null auto_increment, a bigint(20) not null auto_increment,
b bigint(20) not null, b bigint(20) not null,
@ -57,8 +59,7 @@ t1 CREATE TABLE `t1` (
KEY `b` (`b`,`c`,`d`(255)) KEY `b` (`b`,`c`,`d`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection master; connection master;
create table t1 engine=federated create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -72,6 +73,12 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
connection slave; connection slave;
drop table t1; drop table t1;
#
# MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon table discovery with non-existent database
#
connection master;
create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
ERROR HY000: Unable to connect to foreign data source: Table 'test.t1' doesn't exist
connection master; connection master;
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated; DROP DATABASE IF EXISTS federated;

View File

@ -13,9 +13,7 @@ CREATE TABLE t1 (
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT evalp CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
eval CREATE TABLE t1 ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
@ -30,9 +28,9 @@ connection slave;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# --echo #
# --echo # MDEV-11311 Create federated table does not work as expected
# --echo #
create table t1 ( create table t1 (
a bigint(20) not null auto_increment, a bigint(20) not null auto_increment,
b bigint(20) not null, b bigint(20) not null,
@ -44,9 +42,7 @@ create table t1 (
show create table t1; show create table t1;
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT evalp create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
eval create table t1 engine=federated
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
show create table t1; show create table t1;
drop table t1; drop table t1;
@ -54,5 +50,12 @@ drop table t1;
connection slave; connection slave;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon table discovery with non-existent database
--echo #
connection master;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
evalp create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
source include/federated_cleanup.inc; source include/federated_cleanup.inc;

View File

@ -6,12 +6,21 @@ connection node_2;
ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED; ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (2, 2); INSERT INTO t1 VALUES (2, 2);
SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) AS EXPECT_2 FROM t1;
COUNT(*) = 2 EXPECT_2
1 2
SELECT * FROM t1;
id f2
1 NULL
2 2
connection node_2; connection node_2;
INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (3, 3);
SELECT COUNT(*) = 3 FROM t1; SELECT COUNT(*) AS EXPECT_3 FROM t1;
COUNT(*) = 3 EXPECT_3
1 3
SELECT * FROM t1;
id f2
1 NULL
2 2
3 3
DROP TABLE t1; DROP TABLE t1;

View File

@ -1,7 +1,9 @@
connection node_2;
connection node_1;
# #
# wsrep_start_position # wsrep_start_position
# #
# save the initial value CALL mtr.add_suppression("WSREP: SST failed for position .*");
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position; SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
# default # default
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
@ -11,46 +13,92 @@ SELECT @@global.wsrep_start_position;
# scope # scope
SELECT @@session.wsrep_start_position; SELECT @@session.wsrep_start_position;
ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position @@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1 00000000-0000-0000-0000-000000000000:-1
# valid values # valid values
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2'; SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-2
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
12345678-1234-1234-1234-123456789012:100
SET @@global.wsrep_start_position=default;
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position @@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1 00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:0'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
# invalid values # invalid values
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2A';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2A'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0A';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:0A'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1'; SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100'; SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0'; SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999'; SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a'; SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='OFF'; SET @@global.wsrep_start_position='OFF';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position=ON; SET @@global.wsrep_start_position=ON;
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position=''; SET @@global.wsrep_start_position='';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of ''
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position=NULL; SET @@global.wsrep_start_position=NULL;
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET @@global.wsrep_start_position='junk'; SET @@global.wsrep_start_position='junk';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk' ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
# restore the initial value # restore the initial value
SET @@global.wsrep_start_position = @wsrep_start_position_global_saved; SET @@global.wsrep_start_position = @wsrep_start_position_global_saved;

View File

@ -0,0 +1,19 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE p (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT) ENGINE = InnoDB;
CREATE TABLE c (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, FOREIGN KEY (pid) REFERENCES p (id) ON DELETE CASCADE ON UPDATE CASCADE);
CREATE INDEX bitmap5 ON c(bitmap5) USING BTREE;
INSERT INTO p VALUES(1);
INSERT INTO c(pid) VALUES(1);
connection node_2;
connection node_1;
DELETE FROM p WHERE id=1;
SELECT * FROM p;
id
SELECT * FROM c;
id pid bitmap bitmap5
connection node_2;
connection node_1;
DROP TABLE c;
DROP TABLE p;

View File

@ -7,7 +7,6 @@
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc --source include/galera_have_debug_sync.inc
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
--let $galera_connection_name = ctrl --let $galera_connection_name = ctrl

View File

@ -10,17 +10,25 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1'; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1
--source include/wait_condition.inc --source include/wait_condition.inc
ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED; ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
--connection node_1 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
INSERT INTO t1 VALUES (2, 2); INSERT INTO t1 VALUES (2, 2);
SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) AS EXPECT_2 FROM t1;
SELECT * FROM t1;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1
--source include/wait_condition.inc
INSERT INTO t1 VALUES (3, 3); INSERT INTO t1 VALUES (3, 3);
SELECT COUNT(*) = 3 FROM t1; SELECT COUNT(*) AS EXPECT_3 FROM t1;
SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;

View File

@ -1,12 +1,12 @@
--source include/have_wsrep.inc --source include/galera_cluster.inc
--echo # --echo #
--echo # wsrep_start_position --echo # wsrep_start_position
--echo # --echo #
--echo # save the initial value CALL mtr.add_suppression("WSREP: SST failed for position .*");
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
--echo # default --echo # default
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
@ -14,40 +14,60 @@ SELECT @@global.wsrep_start_position;
--echo # scope --echo # scope
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_start_position; SELECT @@session.wsrep_start_position;
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
--echo --echo
--echo # valid values --echo # valid values
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2'; SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position;
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SELECT @@global.wsrep_start_position;
SET @@global.wsrep_start_position=default;
SELECT @@global.wsrep_start_position; SELECT @@global.wsrep_start_position;
--echo --echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0';
SELECT @@global.wsrep_start_position;
--echo # invalid values --echo # invalid values
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2A';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0A';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1'; SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100'; SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0'; SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999'; SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a'; SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='OFF'; SET @@global.wsrep_start_position='OFF';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position=ON; SET @@global.wsrep_start_position=ON;
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position=''; SET @@global.wsrep_start_position='';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position=NULL; SET @@global.wsrep_start_position=NULL;
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='junk'; SET @@global.wsrep_start_position='junk';
SELECT @@global.wsrep_start_position;
--echo --echo
--echo # restore the initial value --echo # restore the initial value

View File

@ -0,0 +1,42 @@
#
# This test is for testing virtual columnm support in galera cluster
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# test case for verifying that cascaded delete in a table with virtual column does not crash slave node
#
--connection node_1
CREATE TABLE p (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT) ENGINE = InnoDB;
CREATE TABLE c (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, FOREIGN KEY (pid) REFERENCES p (id) ON DELETE CASCADE ON UPDATE CASCADE);
# not sure of this index is needed for the test
CREATE INDEX bitmap5 ON c(bitmap5) USING BTREE;
INSERT INTO p VALUES(1);
INSERT INTO c(pid) VALUES(1);
--connection node_2
# wait until both INSERTS have arrived in node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM c
--source include/wait_condition.inc
--connection node_1
# delete from parent table, it will cascade into child table
# node_2 might have problem in applying this cascaded delete
DELETE FROM p WHERE id=1;
SELECT * FROM p;
SELECT * FROM c;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM c;
--source include/wait_condition.inc
--connection node_1
DROP TABLE c;
DROP TABLE p;

View File

@ -11,5 +11,5 @@
############################################################################## ##############################################################################
GCF-1060 : MDEV-20848 galera_sr.GCF_1060 GCF-1060 : MDEV-20848 galera_sr.GCF_1060
galera-features#56 : MDEV-18542 galera_sr.galera-features#56

View File

@ -18,21 +18,21 @@ set session wsrep_sync_wait=0;
SET GLOBAL wsrep_slave_threads = 4; SET GLOBAL wsrep_slave_threads = 4;
SET SESSION wsrep_trx_fragment_size = 1; SET SESSION wsrep_trx_fragment_size = 1;
connection node_1; connection node_1;
INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;;
connection node_1a; connection node_1a;
INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;;
connection node_2; connection node_2;
INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;;
connection node_1; connection node_1;
connection node_1a; connection node_1a;
connection node_2; connection node_2;
set session wsrep_sync_wait=15; set session wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
30000 300
SELECT COUNT(DISTINCT f1) FROM t1; SELECT COUNT(DISTINCT f1) FROM t1;
COUNT(DISTINCT f1) COUNT(DISTINCT f1)
30000 300
connection default; connection default;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE ten; DROP TABLE ten;

View File

@ -3,8 +3,6 @@
## ##
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/big_test.inc
# Create a second connection to node1 so that we can run transactions concurrently # Create a second connection to node1 so that we can run transactions concurrently
--let $galera_connection_name = node_1a --let $galera_connection_name = node_1a
@ -19,7 +17,6 @@ INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
SET SESSION wsrep_trx_fragment_size = 1; SET SESSION wsrep_trx_fragment_size = 1;
--connection node_2 --connection node_2
set session wsrep_sync_wait=15; set session wsrep_sync_wait=15;
SELECT COUNT(*) from ten; SELECT COUNT(*) from ten;
@ -35,13 +32,13 @@ SET GLOBAL wsrep_slave_threads = 4;
SET SESSION wsrep_trx_fragment_size = 1; SET SESSION wsrep_trx_fragment_size = 1;
--connection node_1 --connection node_1
--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; --send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--connection node_1a --connection node_1a
--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; --send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--connection node_2 --connection node_2
--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; --send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--connection node_1 --connection node_1
--reap --reap

View File

@ -291,43 +291,6 @@ a b vb
5 NULL NULL 5 NULL NULL
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-17899 Assertion failures on rollback of instant ADD/DROP
# MDEV-18098 Crash after rollback of instant DROP COLUMN
#
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_commit_inplace_fail_1';
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2);
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
ALTER TABLE t1 ADD COLUMN c INT;
ERROR HY000: Internal error: Injected error!
SELECT * FROM t1;
a b
1 2
DROP TABLE t1;
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN c INT;
ERROR HY000: Internal error: Injected error!
BEGIN;
INSERT INTO t1 VALUES(1, 1);
ROLLBACK;
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
INSERT INTO t1 values (1,1);
SELECT * FROM t1;
a b
1 1
DROP TABLE t1;
SET debug_dbug = @save_dbug;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
22
#
# MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
# #
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
@ -370,6 +333,60 @@ SET DEBUG_SYNC='RESET';
disconnect con2; disconnect con2;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-24653 Assertion block->page.id.page_no() == index->page failed
# in innobase_add_instant_try()
#
SET @saved_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug;
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3),(4);
ALTER TABLE t1 ADD COLUMN b INT;
DELETE FROM t1;
InnoDB 0 transactions not purged
ALTER TABLE t1 ADD COLUMN c INT;
SELECT * FROM t1;
a b c
DROP TABLE t1;
SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit;
# End of 10.3 tests
#
# MDEV-17899 Assertion failures on rollback of instant ADD/DROP
# MDEV-18098 Crash after rollback of instant DROP COLUMN
#
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_commit_inplace_fail_1';
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2);
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
ALTER TABLE t1 ADD COLUMN c INT;
ERROR HY000: Internal error: Injected error!
SELECT * FROM t1;
a b
1 2
DROP TABLE t1;
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN c INT;
ERROR HY000: Internal error: Injected error!
BEGIN;
INSERT INTO t1 VALUES(1, 1);
ROLLBACK;
ALTER TABLE t1 DROP COLUMN b;
ERROR HY000: Internal error: Injected error!
INSERT INTO t1 values (1,1);
SELECT * FROM t1;
a b
1 1
DROP TABLE t1;
SET debug_dbug = @save_dbug;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
28
#
# MDEV-24512 Assertion failed in rec_is_metadata() # MDEV-24512 Assertion failed in rec_is_metadata()
# in btr_discard_only_page_on_level() # in btr_discard_only_page_on_level()
# #
@ -383,6 +400,7 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
SELECT * FROM t1; SELECT * FROM t1;
c2 c c2 c
DROP TABLE t1; DROP TABLE t1;
# End of 10.4 tests
# #
# MDEV-22867 Assertion instant.n_core_fields == n_core_fields # MDEV-22867 Assertion instant.n_core_fields == n_core_fields
# in dict_index_t::instant_add_field # in dict_index_t::instant_add_field
@ -421,4 +439,5 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
SET DEBUG_SYNC=RESET; SET DEBUG_SYNC=RESET;
# End of 10.5 tests
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;

View File

@ -325,42 +325,6 @@ CHECK TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17899 Assertion failures on rollback of instant ADD/DROP
--echo # MDEV-18098 Crash after rollback of instant DROP COLUMN
--echo #
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_commit_inplace_fail_1';
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2);
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN c INT;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN c INT;
BEGIN;
INSERT INTO t1 VALUES(1, 1);
ROLLBACK;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
INSERT INTO t1 values (1,1);
SELECT * FROM t1;
DROP TABLE t1;
SET debug_dbug = @save_dbug;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
--echo # --echo #
--echo # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col --echo # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
--echo # --echo #
@ -413,6 +377,63 @@ SET DEBUG_SYNC='RESET';
--disconnect con2 --disconnect con2
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-24653 Assertion block->page.id.page_no() == index->page failed
--echo # in innobase_add_instant_try()
--echo #
SET @saved_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug;
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3),(4);
ALTER TABLE t1 ADD COLUMN b INT;
DELETE FROM t1;
--source include/wait_all_purged.inc
ALTER TABLE t1 ADD COLUMN c INT;
SELECT * FROM t1;
DROP TABLE t1;
SET GLOBAL innodb_limit_optimistic_insert_debug = @saved_limit;
--echo # End of 10.3 tests
--echo #
--echo # MDEV-17899 Assertion failures on rollback of instant ADD/DROP
--echo # MDEV-18098 Crash after rollback of instant DROP COLUMN
--echo #
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,ib_commit_inplace_fail_1';
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,2);
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN c INT;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a int, b int) ENGINE=InnoDB;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 ADD COLUMN c INT;
BEGIN;
INSERT INTO t1 VALUES(1, 1);
ROLLBACK;
--error ER_INTERNAL_ERROR
ALTER TABLE t1 DROP COLUMN b;
INSERT INTO t1 values (1,1);
SELECT * FROM t1;
DROP TABLE t1;
SET debug_dbug = @save_dbug;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
--echo # --echo #
--echo # MDEV-24512 Assertion failed in rec_is_metadata() --echo # MDEV-24512 Assertion failed in rec_is_metadata()
--echo # in btr_discard_only_page_on_level() --echo # in btr_discard_only_page_on_level()
@ -429,6 +450,8 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.4 tests
--echo # --echo #
--echo # MDEV-22867 Assertion instant.n_core_fields == n_core_fields --echo # MDEV-22867 Assertion instant.n_core_fields == n_core_fields
--echo # in dict_index_t::instant_add_field --echo # in dict_index_t::instant_add_field
@ -475,4 +498,6 @@ CHECK TABLE t1;
DROP TABLE t1; DROP TABLE t1;
SET DEBUG_SYNC=RESET; SET DEBUG_SYNC=RESET;
--echo # End of 10.5 tests
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;

View File

@ -232,6 +232,38 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb; f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1); ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-21478 Inplace alter fails to report error when
# FTS_DOC_ID is added
SET NAMES utf8;
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD;
ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB;
ALTER TABLE t1 ADD FTS_DOC_İD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
ERROR 42000: Incorrect column name 'FTS_DOC_İD'
ALTER TABLE t1 ADD FTS_DOC_İD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'FTS_DOC_İD'
ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'fts_doc_id'
ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE;
ERROR 42000: Incorrect column name 'fts_doc_id'
ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'fts_doc_id'
ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
ERROR 42000: Incorrect column name 'fts_doc_id'
ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
ERROR 42000: Incorrect column name 'FTS_DOC_ID'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
DROP TABLE t1; DROP TABLE t1;
@ -244,3 +276,4 @@ CREATE TABLE t1
ENGINE=InnoDB; ENGINE=InnoDB;
ALTER TABLE t1 ADD c SERIAL; ALTER TABLE t1 ADD c SERIAL;
DROP TABLE t1; DROP TABLE t1;
# End of 10.3 tests

View File

@ -278,6 +278,47 @@ CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1); ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-21478 Inplace alter fails to report error when
--echo # FTS_DOC_ID is added
SET NAMES utf8;
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD;
ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD FTS_DOC_İD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD FTS_DOC_İD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY;
--error ER_WRONG_COLUMN_NAME
ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Add more than one FTS index # Add more than one FTS index
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
@ -294,3 +335,5 @@ CREATE TABLE t1
ENGINE=InnoDB; ENGINE=InnoDB;
ALTER TABLE t1 ADD c SERIAL; ALTER TABLE t1 ADD c SERIAL;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.3 tests

View File

@ -16,9 +16,11 @@ SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
NONE NONE
SET @@global.wsrep_debug=1; SET @@global.wsrep_debug=1;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
SERVER NONE
# valid values # valid values
SET @@global.wsrep_debug=NONE; SET @@global.wsrep_debug=NONE;
@ -26,9 +28,11 @@ SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
NONE NONE
SET @@global.wsrep_debug=SERVER; SET @@global.wsrep_debug=SERVER;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug
SERVER NONE
SET @@global.wsrep_debug=default; SET @@global.wsrep_debug=default;
SELECT @@global.wsrep_debug; SELECT @@global.wsrep_debug;
@@global.wsrep_debug @@global.wsrep_debug

View File

@ -0,0 +1,44 @@
SELECT @@wsrep_on;
@@wsrep_on
1
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
SET GLOBAL wsrep_provider=none;
SET SESSION wsrep_trx_fragment_size=DEFAULT;
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_size;
@@session.wsrep_trx_fragment_size
0
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SHOW WARNINGS;
Level Code Message
Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET GLOBAL wsrep_debug=1;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug;
@@global.wsrep_debug
NONE
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
5
SET GLOBAL wsrep_desync=1;
ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
0
SET SESSION wsrep_trx_fragment_unit='rows';
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_unit;
@@session.wsrep_trx_fragment_unit
rows
SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
SET @@global.wsrep_debug = @wsrep_debug_saved;

View File

@ -0,0 +1,39 @@
SELECT @@wsrep_on;
@@wsrep_on
0
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
SET SESSION wsrep_trx_fragment_size=DEFAULT;
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_size;
@@session.wsrep_trx_fragment_size
0
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SHOW WARNINGS;
Level Code Message
Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET GLOBAL wsrep_debug=1;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug;
@@global.wsrep_debug
NONE
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
5
SET GLOBAL wsrep_desync=1;
ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
0
SET SESSION wsrep_trx_fragment_unit='rows';
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_unit;
@@session.wsrep_trx_fragment_unit
rows

View File

@ -0,0 +1,12 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld.1]
wsrep-on=ON
binlog-format=ROW
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep-cluster-address='gcomm://'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port

View File

@ -0,0 +1,38 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
SELECT @@wsrep_on;
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
SET GLOBAL wsrep_provider=none;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_size=DEFAULT;
SELECT @@session.wsrep_trx_fragment_size;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SHOW WARNINGS;
SELECT @@global.wsrep_start_position;
SET GLOBAL wsrep_debug=1;
SELECT @@global.wsrep_debug;
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_desync=1;
SELECT @@global.wsrep_desync;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_unit='rows';
SELECT @@session.wsrep_trx_fragment_unit;
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
--source include/galera_wait_ready.inc
SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
SET @@global.wsrep_debug = @wsrep_debug_saved;
--enable_query_log

View File

@ -0,0 +1,12 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld]
wsrep-on=OFF
[mysqld.1]
wsrep-on=OFF
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port

View File

@ -0,0 +1,30 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
SELECT @@wsrep_on;
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_size=DEFAULT;
SELECT @@session.wsrep_trx_fragment_size;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SHOW WARNINGS;
SELECT @@global.wsrep_start_position;
SET GLOBAL wsrep_debug=1;
SELECT @@global.wsrep_debug;
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_desync=1;
SELECT @@global.wsrep_desync;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_unit='rows';
SELECT @@session.wsrep_trx_fragment_unit;
--disable_query_log
SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
SET @@global.wsrep_debug = @wsrep_debug_saved;
--enable_query_log

View File

@ -18,7 +18,7 @@ ELSE()
SET(GSSAPI_SERVER gssapi_server.cc) SET(GSSAPI_SERVER gssapi_server.cc)
SET(GSSAPI_ERRMSG gssapi_errmsg.cc) SET(GSSAPI_ERRMSG gssapi_errmsg.cc)
IF(APPLE) IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET_SOURCE_FILES_PROPERTIES( SET_SOURCE_FILES_PROPERTIES(
${GSSAPI_CLIENT} ${GSSAPI_SERVER} ${GSSAPI_ERRMSG} ${GSSAPI_CLIENT} ${GSSAPI_SERVER} ${GSSAPI_ERRMSG}
PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations") PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations")

View File

@ -4,7 +4,7 @@ ADD_LIBRARY(pam_mariadb_mtr MODULE pam_mariadb_mtr.c)
SET_TARGET_PROPERTIES (pam_mariadb_mtr PROPERTIES PREFIX "") SET_TARGET_PROPERTIES (pam_mariadb_mtr PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(pam_mariadb_mtr pam) TARGET_LINK_LIBRARIES(pam_mariadb_mtr pam)
IF(APPLE) IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
SET_SOURCE_FILES_PROPERTIES( SET_SOURCE_FILES_PROPERTIES(
pam_mariadb_mtr.c pam_mariadb_mtr.c
PROPERTY COMPILE_FLAGS "-Wno-incompatible-pointer-types-discards-qualifiers") PROPERTY COMPILE_FLAGS "-Wno-incompatible-pointer-types-discards-qualifiers")

View File

@ -27,6 +27,7 @@
set sql_mode=''; set sql_mode='';
set default_storage_engine=Aria; set default_storage_engine=Aria;
set enforce_storage_engine=NULL; set enforce_storage_engine=NULL;
set alter_algorithm=DEFAULT;
set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO'); set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');

View File

@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED #ifndef FIELD_INCLUDED
#define FIELD_INCLUDED #define FIELD_INCLUDED
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2020, MariaDB Corporation. Copyright (c) 2008, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -2088,7 +2088,7 @@ public:
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
const LEX_CSTRING *field_name_arg, const LEX_CSTRING *field_name_arg,
const DTCollation &collation); const DTCollation &collation);
uint decimals() const override { return NOT_FIXED_DEC; } uint decimals() const override { return is_created_from_null_item ? 0 : NOT_FIXED_DEC; }
int save_in_field(Field *to) override { return save_in_field_str(to); } int save_in_field(Field *to) override { return save_in_field_str(to); }
bool memcpy_field_possible(const Field *from) const override bool memcpy_field_possible(const Field *from) const override
{ {

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2018, Oracle and/or its affiliates. Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -42,7 +42,6 @@
#include <mysql/psi/mysql_statement.h> #include <mysql/psi/mysql_statement.h>
#include <strfunc.h> #include <strfunc.h>
#include "compat56.h" #include "compat56.h"
#include "wsrep_mysqld.h"
#include "sql_insert.h" #include "sql_insert.h"
#else #else
#include "mysqld_error.h" #include "mysqld_error.h"

View File

@ -5414,7 +5414,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
tables->trg_event_map= new_trg_event_map; tables->trg_event_map= new_trg_event_map;
lex->query_tables_last= &tables->next_global; lex->query_tables_last= &tables->next_global;
} }
else if (!WSREP_ON) else
{ {
tables->slave_fk_event_map= new_trg_event_map; tables->slave_fk_event_map= new_trg_event_map;
lex->query_tables_last= &tables->next_global; lex->query_tables_last= &tables->next_global;

View File

@ -2988,7 +2988,7 @@ Sp_handler::show_create_sp(THD *thd, String *buf,
buf->append(STRING_WITH_LEN(" RETURN ")); buf->append(STRING_WITH_LEN(" RETURN "));
else else
buf->append(STRING_WITH_LEN(" RETURNS ")); buf->append(STRING_WITH_LEN(" RETURNS "));
buf->append(&returns); buf->append(returns.str, returns.length); // Not \0 terminated
} }
buf->append('\n'); buf->append('\n');
switch (chistics.daccess) { switch (chistics.daccess) {

View File

@ -1452,6 +1452,8 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
for (; sl; sl= sl->next_select()) for (; sl; sl= sl->next_select())
{ {
Item *extracted_cond_copy; Item *extracted_cond_copy;
if (!sl->cond_pushdown_is_allowed())
continue;
/* /*
For each select of the unit except the last one For each select of the unit except the last one
create a clone of extracted_cond create a clone of extracted_cond

View File

@ -2826,6 +2826,8 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
Return the quote character, to have the parser fail on syntax error. Return the quote character, to have the parser fail on syntax error.
*/ */
m_ptr= (char *) m_tok_start + 1; m_ptr= (char *) m_tok_start + 1;
if (m_echo)
m_cpp_ptr= (char *) m_cpp_tok_start + 1;
return quote_char; return quote_char;
} }
int var_length= cs->charlen(get_ptr() - 1, get_end_of_query()); int var_length= cs->charlen(get_ptr() - 1, get_end_of_query());

View File

@ -1785,7 +1785,7 @@ JOIN::init_range_rowid_filters()
int int
JOIN::optimize_inner() JOIN::optimize_inner()
{ {
DBUG_ENTER("JOIN::optimize"); DBUG_ENTER("JOIN::optimize_inner");
subq_exit_fl= false; subq_exit_fl= false;
do_send_rows = (unit->lim.get_select_limit()) ? 1 : 0; do_send_rows = (unit->lim.get_select_limit()) ? 1 : 0;
@ -1858,6 +1858,10 @@ JOIN::optimize_inner()
table_count= select_lex->leaf_tables.elements; table_count= select_lex->leaf_tables.elements;
if (select_lex->options & OPTION_SCHEMA_TABLE &&
optimize_schema_tables_memory_usage(select_lex->leaf_tables))
DBUG_RETURN(1);
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */ if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
DBUG_RETURN(-1); DBUG_RETURN(-1);

View File

@ -5038,7 +5038,8 @@ public:
Sql_condition::enum_warning_level *level, Sql_condition::enum_warning_level *level,
const char* msg, Sql_condition ** cond_hdl) const char* msg, Sql_condition ** cond_hdl)
{ {
if (sql_errno == ER_TRG_NO_DEFINER || sql_errno == ER_TRG_NO_CREATION_CTX) if (sql_errno == ER_TRG_NO_DEFINER || sql_errno == ER_TRG_NO_CREATION_CTX
|| sql_errno == ER_PARSE_ERROR)
return true; return true;
if (*level != Sql_condition::WARN_LEVEL_ERROR) if (*level != Sql_condition::WARN_LEVEL_ERROR)
@ -8476,10 +8477,18 @@ end:
} }
static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list) bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables)
{
List_iterator<TABLE_LIST> tli(tables);
while (TABLE_LIST *table_list= tli++)
{ {
TABLE *table= table_list->table; TABLE *table= table_list->table;
THD *thd=table->in_use; THD *thd=table->in_use;
if (!table_list->schema_table || !thd->fill_information_schema_tables())
continue;
if (!table->is_created()) if (!table->is_created())
{ {
TMP_TABLE_PARAM *p= table_list->schema_table_param; TMP_TABLE_PARAM *p= table_list->schema_table_param;
@ -8526,6 +8535,7 @@ static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
table_list->select_lex->options | thd->variables.option_bits)) table_list->select_lex->options | thd->variables.option_bits))
return 1; return 1;
} }
}
return 0; return 0;
} }
@ -8550,9 +8560,6 @@ bool optimize_schema_tables_reads(JOIN *join)
TABLE_LIST *table_list= tab->table->pos_in_table_list; TABLE_LIST *table_list= tab->table->pos_in_table_list;
if (table_list->schema_table && thd->fill_information_schema_tables()) if (table_list->schema_table && thd->fill_information_schema_tables())
{ {
if (optimize_schema_tables_memory_usage(table_list))
DBUG_RETURN(1);
/* A value of 0 indicates a dummy implementation */ /* A value of 0 indicates a dummy implementation */
if (table_list->schema_table->fill_table == 0) if (table_list->schema_table->fill_table == 0)
continue; continue;

View File

@ -246,6 +246,7 @@ public:
}; };
bool optimize_schema_tables_reads(JOIN *join); bool optimize_schema_tables_reads(JOIN *join);
bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables);
/* Handle the ignored database directories list for SHOW/I_S. */ /* Handle the ignored database directories list for SHOW/I_S. */
bool ignore_db_dirs_init(); bool ignore_db_dirs_init();

View File

@ -2601,7 +2601,7 @@ error:
if (has_vers_fields && table->versioned(VERS_TIMESTAMP)) if (has_vers_fields && table->versioned(VERS_TIMESTAMP))
{ {
store_record(table, record[2]); store_record(table, record[2]);
if (vers_insert_history_row(table)) if (unlikely(error= vers_insert_history_row(table)))
{ {
restore_record(table, record[2]); restore_record(table, record[2]);
goto error; goto error;

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. /* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2020, MariaDB Copyright (c) 2008, 2021, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -1166,7 +1166,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
thd->stmt_arena= table->expr_arena; thd->stmt_arena= table->expr_arena;
thd->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset); thd->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset);
expr_str.append(&parse_vcol_keyword); expr_str.append(&parse_vcol_keyword);
Sql_mode_instant_remove sms(thd, MODE_NO_BACKSLASH_ESCAPES); Sql_mode_instant_remove sms(thd, MODE_NO_BACKSLASH_ESCAPES |
MODE_EMPTY_STRING_IS_NULL);
while (pos < end) while (pos < end)
{ {
@ -3430,9 +3431,8 @@ ret:
if (unlikely(thd->is_error() || error)) if (unlikely(thd->is_error() || error))
{ {
thd->clear_error(); thd->clear_error();
my_error(ER_SQL_DISCOVER_ERROR, MYF(0), my_error(ER_SQL_DISCOVER_ERROR, MYF(0), hton_name(hton)->str,
plugin_name(db_plugin)->str, db.str, table_name.str, db.str, table_name.str, sql_copy);
sql_copy);
DBUG_RETURN(HA_ERR_GENERIC); DBUG_RETURN(HA_ERR_GENERIC);
} }
/* Treat the table as normal table from binary logging point of view */ /* Treat the table as normal table from binary logging point of view */

View File

@ -42,7 +42,7 @@ extern wsrep_seqno_t local_seqno;
extern Wsrep_schema* wsrep_schema; extern Wsrep_schema* wsrep_schema;
// a helper function // a helper function
void wsrep_sst_received(THD*, const wsrep_uuid_t&, wsrep_seqno_t, bool wsrep_sst_received(THD*, const wsrep_uuid_t&, wsrep_seqno_t,
const void*, size_t); const void*, size_t);
void wsrep_notify_status(enum wsrep::server_state::state status, void wsrep_notify_status(enum wsrep::server_state::state status,

View File

@ -917,6 +917,13 @@ int Wsrep_schema::append_fragment(THD* thd,
thd->thread_id, thd->thread_id,
os.str().c_str(), os.str().c_str(),
transaction_id.get()); transaction_id.get());
/* use private query table list for the duration of fragment storing,
populated query table list from "parent DML" may cause problems .e.g
for virtual column handling
*/
Query_tables_list query_tables_list_backup;
thd->lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
Wsrep_schema_impl::binlog_off binlog_off(thd); Wsrep_schema_impl::binlog_off binlog_off(thd);
Wsrep_schema_impl::init_stmt(thd); Wsrep_schema_impl::init_stmt(thd);
@ -924,6 +931,7 @@ int Wsrep_schema::append_fragment(THD* thd,
if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)) if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table))
{ {
trans_rollback_stmt(thd); trans_rollback_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -937,9 +945,11 @@ int Wsrep_schema::append_fragment(THD* thd,
if ((error= Wsrep_schema_impl::insert(frag_table))) { if ((error= Wsrep_schema_impl::insert(frag_table))) {
WSREP_ERROR("Failed to write to frag table: %d", error); WSREP_ERROR("Failed to write to frag table: %d", error);
trans_rollback_stmt(thd); trans_rollback_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
Wsrep_schema_impl::finish_stmt(thd); Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -956,6 +966,13 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
ws_meta.seqno().get()); ws_meta.seqno().get());
DBUG_ASSERT(ws_meta.seqno().is_undefined() == false); DBUG_ASSERT(ws_meta.seqno().is_undefined() == false);
/* use private query table list for the duration of fragment storing,
populated query table list from "parent DML" may cause problems .e.g
for virtual column handling
*/
Query_tables_list query_tables_list_backup;
thd->lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
Wsrep_schema_impl::binlog_off binlog_off(thd); Wsrep_schema_impl::binlog_off binlog_off(thd);
int error; int error;
uchar key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; uchar key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
@ -965,6 +982,7 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
Wsrep_schema_impl::init_stmt(thd); Wsrep_schema_impl::init_stmt(thd);
if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)) if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table))
{ {
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -985,6 +1003,7 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
error); error);
} }
Wsrep_schema_impl::finish_stmt(thd); Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1000,11 +1019,13 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
frag_table->s->table_name.str, frag_table->s->table_name.str,
error); error);
Wsrep_schema_impl::finish_stmt(thd); Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
int ret= Wsrep_schema_impl::end_index_scan(frag_table); int ret= Wsrep_schema_impl::end_index_scan(frag_table);
Wsrep_schema_impl::finish_stmt(thd); Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }

View File

@ -309,12 +309,40 @@ bool wsrep_before_SE()
} }
// Signal end of SST // Signal end of SST
static void wsrep_sst_complete (THD* thd, static bool wsrep_sst_complete (THD* thd,
int const rcode) int const rcode,
wsrep::gtid const sst_gtid)
{ {
Wsrep_client_service client_service(thd, thd->wsrep_cs()); Wsrep_client_service client_service(thd, thd->wsrep_cs());
Wsrep_server_state::instance().sst_received(client_service, rcode); Wsrep_server_state& server_state= Wsrep_server_state::instance();
enum wsrep::server_state::state state= server_state.state();
bool failed= false;
char start_pos_buf[FN_REFLEN];
ssize_t len= wsrep::print_to_c_str(sst_gtid, start_pos_buf, FN_REFLEN-1);
start_pos_buf[len]='\0';
// Do not call sst_received if we are not in joiner or
// initialized state on server. This is because it
// assumes we are on those states. Give error if we are
// in incorrect state.
if ((state == Wsrep_server_state::s_joiner ||
state == Wsrep_server_state::s_initialized))
{
Wsrep_server_state::instance().sst_received(client_service,
rcode);
WSREP_INFO("SST succeeded for position %s", start_pos_buf);
}
else
{
WSREP_ERROR("SST failed for position %s initialized %d server_state %s",
start_pos_buf,
server_state.is_initialized(),
wsrep::to_c_string(state));
failed= true;
}
wsrep_joiner_monitor_end(); wsrep_joiner_monitor_end();
return failed;
} }
/* /*
@ -326,13 +354,15 @@ static void wsrep_sst_complete (THD* thd,
@param seqno [IN] Initial state sequence number @param seqno [IN] Initial state sequence number
@param state [IN] Always NULL, also ignored by wsrep provider (?) @param state [IN] Always NULL, also ignored by wsrep provider (?)
@param state_len [IN] Always 0, also ignored by wsrep provider (?) @param state_len [IN] Always 0, also ignored by wsrep provider (?)
@return true when successful, false if error
*/ */
void wsrep_sst_received (THD* thd, bool wsrep_sst_received (THD* thd,
const wsrep_uuid_t& uuid, const wsrep_uuid_t& uuid,
wsrep_seqno_t const seqno, wsrep_seqno_t const seqno,
const void* const state, const void* const state,
size_t const state_len) size_t const state_len)
{ {
bool error= false;
/* /*
To keep track of whether the local uuid:seqno should be updated. Also, note To keep track of whether the local uuid:seqno should be updated. Also, note
that local state (uuid:seqno) is updated/checkpointed only after we get an that local state (uuid:seqno) is updated/checkpointed only after we get an
@ -372,8 +402,10 @@ void wsrep_sst_received (THD* thd,
if (WSREP_ON) if (WSREP_ON)
{ {
int const rcode(seqno < 0 ? seqno : 0); int const rcode(seqno < 0 ? seqno : 0);
wsrep_sst_complete(thd,rcode); error= wsrep_sst_complete(thd,rcode, sst_gtid);
} }
return error;
} }
static int sst_scan_uuid_seqno (const char* str, static int sst_scan_uuid_seqno (const char* str,
@ -655,7 +687,7 @@ err:
/* Read committed isolation to avoid gap locking */ /* Read committed isolation to avoid gap locking */
thd->variables.tx_isolation= ISO_READ_COMMITTED; thd->variables.tx_isolation= ISO_READ_COMMITTED;
wsrep_sst_complete (thd, -err); wsrep_sst_complete (thd, -err, ret_gtid);
delete thd; delete thd;
my_thread_end(); my_thread_end();

View File

@ -223,8 +223,11 @@ bool wsrep_start_position_verify (const char* start_str)
char* endptr; char* endptr;
char* startptr= (char *)start_str + uuid_len + 1; char* startptr= (char *)start_str + uuid_len + 1;
wsrep_seqno_t const seqno __attribute__((unused)) // to avoid GCC warnings wsrep_seqno_t const seqno(parse_value<uint64_t>(&startptr, &endptr));
(parse_value<uint64_t>(&startptr, &endptr));
// Do not allow seqno < -1
if (seqno < -1)
return true;
// Start parsing native GTID part // Start parsing native GTID part
if (*startptr == ',') if (*startptr == ',')
@ -270,12 +273,24 @@ bool wsrep_set_local_position(THD* thd, const char* const value,
wsrep_gtid_server.seqno(parse_value<uint64_t>(&startptr, &endptr)); wsrep_gtid_server.seqno(parse_value<uint64_t>(&startptr, &endptr));
} }
if (sst) { char start_pos_buf[FN_REFLEN];
wsrep_sst_received (thd, uuid, seqno, NULL, 0); memcpy(start_pos_buf, value, length);
} else { start_pos_buf[length]='\0';
// If both are same as WSREP_START_POSITION_ZERO just set local
if (!strcmp(start_pos_buf, WSREP_START_POSITION_ZERO) &&
!strcmp(wsrep_start_position, WSREP_START_POSITION_ZERO))
goto set;
else
WSREP_INFO("SST setting local position to %s current %s", start_pos_buf, wsrep_start_position);
if (sst)
return (wsrep_sst_received (thd, uuid, seqno, NULL, 0));
set:
local_uuid= uuid; local_uuid= uuid;
local_seqno= seqno; local_seqno= seqno;
}
return false; return false;
} }
@ -292,19 +307,34 @@ bool wsrep_start_position_check (sys_var *self, THD* thd, set_var* var)
var->save_result.string_value.length); var->save_result.string_value.length);
start_pos_buf[var->save_result.string_value.length]= 0; start_pos_buf[var->save_result.string_value.length]= 0;
WSREP_DEBUG("SST wsrep_start_position check for new position %s old %s",
start_pos_buf, wsrep_start_position);
// Verify the format. // Verify the format.
if (wsrep_start_position_verify(start_pos_buf)) return true; if (wsrep_start_position_verify(start_pos_buf)) return true;
// Give error if position is updated when wsrep is not enabled or
// provider is not loaded.
if ((!WSREP_ON || !Wsrep_server_state::instance().is_provider_loaded())
&& strcmp(start_pos_buf, WSREP_START_POSITION_ZERO))
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Cannot set 'wsrep_start_position' because "
"wsrep is switched off or provider is not loaded");
goto err;
}
/* /*
As part of further verification, we try to update the value and catch As part of further verification, we try to update the value and catch
errors (if any). errors (if any) only when value actually has been changed.
*/ */
if (wsrep_set_local_position(thd, var->save_result.string_value.str, if (wsrep_set_local_position(thd, var->save_result.string_value.str,
var->save_result.string_value.length, var->save_result.string_value.length,
true)) true))
{
goto err; goto err;
}
return false; return false;
@ -509,7 +539,20 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type)
bool wsrep_debug_update(sys_var *self, THD* thd, enum_var_type type) bool wsrep_debug_update(sys_var *self, THD* thd, enum_var_type type)
{ {
// Give warnings if wsrep_debug is set and wsrep is disabled or
// provider is not loaded, it will not have any effect
if ((!WSREP_ON || !Wsrep_server_state::instance().is_provider_loaded())
&& wsrep_debug)
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Setting 'wsrep_debug' has no effect because "
"wsrep is switched off");
wsrep_debug= 0;
}
else
Wsrep_server_state::instance().debug_log_level(wsrep_debug); Wsrep_server_state::instance().debug_log_level(wsrep_debug);
return false; return false;
} }
@ -791,6 +834,18 @@ bool wsrep_trx_fragment_size_update(sys_var* self, THD *thd, enum_var_type)
{ {
WSREP_DEBUG("wsrep_trx_fragment_size_update: %llu", WSREP_DEBUG("wsrep_trx_fragment_size_update: %llu",
thd->variables.wsrep_trx_fragment_size); thd->variables.wsrep_trx_fragment_size);
// Give error if wsrep_trx_fragment_size is set and wsrep is disabled or
// provider is not loaded
if (!WSREP_ON || !Wsrep_server_state::instance().is_provider_loaded())
{
push_warning (thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Cannot set 'wsrep_trx_fragment_size' because "
"wsrep is switched off");
return true;
}
if (thd->variables.wsrep_trx_fragment_size) if (thd->variables.wsrep_trx_fragment_size)
{ {
return thd->wsrep_cs().enable_streaming( return thd->wsrep_cs().enable_streaming(
@ -808,6 +863,18 @@ bool wsrep_trx_fragment_unit_update(sys_var* self, THD *thd, enum_var_type)
{ {
WSREP_DEBUG("wsrep_trx_fragment_unit_update: %lu", WSREP_DEBUG("wsrep_trx_fragment_unit_update: %lu",
thd->variables.wsrep_trx_fragment_unit); thd->variables.wsrep_trx_fragment_unit);
// Give error if wsrep_trx_fragment_unit is set and wsrep is disabled or
// provider is not loaded
if (!WSREP_ON || !Wsrep_server_state::instance().is_provider_loaded())
{
push_warning (thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Cannot set 'wsrep_trx_fragment_unit' because "
"wsrep is switched off");
return true;
}
if (thd->variables.wsrep_trx_fragment_size) if (thd->variables.wsrep_trx_fragment_size)
{ {
return thd->wsrep_cs().enable_streaming( return thd->wsrep_cs().enable_streaming(

View File

@ -367,9 +367,6 @@ int ha_heap::info(uint flag)
{ {
HEAPINFO hp_info; HEAPINFO hp_info;
if (!file)
return 0;
(void) heap_info(file,&hp_info,flag); (void) heap_info(file,&hp_info,flag);
errkey= hp_info.errkey; errkey= hp_info.errkey;

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2020, MariaDB Corporation. Copyright (c) 2016, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -153,9 +153,11 @@ before_first:
/* If the table is emptied during an ALGORITHM=NOCOPY /* If the table is emptied during an ALGORITHM=NOCOPY
DROP COLUMN ... that is not ALGORITHM=INSTANT, DROP COLUMN ... that is not ALGORITHM=INSTANT,
then we must preserve any instant ADD metadata. */ then we must preserve any instant ADD metadata. */
ut_ad(index->table->instant); ut_ad(index->table->instant
|| block->page.id().page_no() != index->page);
#endif #endif
ut_ad(index->is_instant()); ut_ad(index->is_instant()
|| block->page.id().page_no() != index->page);
ut_ad(page_get_n_recs(block->frame) == 1); ut_ad(page_get_n_recs(block->frame) == 1);
ut_ad(page_is_leaf(block->frame)); ut_ad(page_is_leaf(block->frame));
ut_ad(!page_has_prev(block->frame)); ut_ad(!page_has_prev(block->frame));
@ -173,7 +175,9 @@ before_first:
rec = page_rec_get_next(rec); rec = page_rec_get_next(rec);
if (page_rec_is_supremum(rec)) { if (page_rec_is_supremum(rec)) {
ut_ad(page_has_next(block->frame) ut_ad(page_has_next(block->frame)
|| rec_is_alter_metadata(p, *index)); || rec_is_alter_metadata(p, *index)
|| block->page.id().page_no()
!= index->page);
goto before_first; goto before_first;
} }
} }

View File

@ -5822,11 +5822,13 @@ add_all_virtual:
const rec_t* rec = btr_pcur_get_rec(&pcur); const rec_t* rec = btr_pcur_get_rec(&pcur);
que_thr_t* thr = pars_complete_graph_for_exec( que_thr_t* thr = pars_complete_graph_for_exec(
NULL, trx, ctx->heap, NULL); NULL, trx, ctx->heap, NULL);
const bool is_root = block->page.id().page_no() == index->page;
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
if (rec_is_metadata(rec, *index)) { if (rec_is_metadata(rec, *index)) {
ut_ad(page_rec_is_user_rec(rec)); ut_ad(page_rec_is_user_rec(rec));
if (!rec_is_alter_metadata(rec, *index) if (is_root
&& !rec_is_alter_metadata(rec, *index)
&& !index->table->instant && !index->table->instant
&& !page_has_next(block->frame) && !page_has_next(block->frame)
&& page_rec_is_last(rec, block->frame)) { && page_rec_is_last(rec, block->frame)) {
@ -5908,7 +5910,8 @@ add_all_virtual:
} }
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
goto func_exit; goto func_exit;
} else if (page_rec_is_supremum(rec) && !index->table->instant) { } else if (is_root && page_rec_is_supremum(rec)
&& !index->table->instant) {
empty_table: empty_table:
/* The table is empty. */ /* The table is empty. */
ut_ad(fil_page_index_page_check(block->frame)); ut_ad(fil_page_index_page_check(block->frame));
@ -6432,6 +6435,7 @@ new_clustered_failed:
} }
if (dict_col_name_is_reserved(field->field_name.str)) { if (dict_col_name_is_reserved(field->field_name.str)) {
wrong_column_name:
dict_mem_table_free(ctx->new_table); dict_mem_table_free(ctx->new_table);
ctx->new_table = ctx->old_table; ctx->new_table = ctx->old_table;
my_error(ER_WRONG_COLUMN_NAME, MYF(0), my_error(ER_WRONG_COLUMN_NAME, MYF(0),
@ -6439,6 +6443,21 @@ new_clustered_failed:
goto new_clustered_failed; goto new_clustered_failed;
} }
/** Note the FTS_DOC_ID name is case sensitive due
to internal query parser.
FTS_DOC_ID column must be of BIGINT NOT NULL type
and it should be in all capitalized characters */
if (!innobase_strcasecmp(field->field_name.str,
FTS_DOC_ID_COL_NAME)) {
if (col_type != DATA_INT
|| field->real_maybe_null()
|| col_len != sizeof(doc_id_t)
|| strcmp(field->field_name.str,
FTS_DOC_ID_COL_NAME)) {
goto wrong_column_name;
}
}
if (is_virtual) { if (is_virtual) {
dict_mem_table_add_v_col( dict_mem_table_add_v_col(
ctx->new_table, ctx->heap, ctx->new_table, ctx->heap,

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation. Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -901,8 +901,10 @@ public:
#endif #endif
/** Latest recovered binlog offset */ /** Latest recovered binlog offset */
uint64_t recovered_binlog_offset; uint64_t recovered_binlog_offset;
/** Latest recovred binlog file name */ /** Latest recovered binlog file name */
char recovered_binlog_filename[TRX_SYS_MYSQL_LOG_NAME_LEN]; char recovered_binlog_filename[TRX_SYS_MYSQL_LOG_NAME_LEN];
/** FIL_PAGE_LSN of the page with the latest recovered binlog metadata */
lsn_t recovered_binlog_lsn;
/** /**

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation. Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -457,34 +457,25 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr)
max_trx_id = id; max_trx_id = id;
} }
const char* binlog_name = TRX_RSEG + TRX_RSEG_BINLOG_NAME const byte* binlog_name = TRX_RSEG + TRX_RSEG_BINLOG_NAME
+ reinterpret_cast<const char*>(rseg_hdr->frame); + rseg_hdr->frame;
if (*binlog_name) { if (*binlog_name) {
lsn_t lsn = mach_read_from_8(my_assume_aligned<8>(
FIL_PAGE_LSN
+ rseg_hdr
->frame));
compile_time_assert(TRX_RSEG_BINLOG_NAME_LEN == sizeof compile_time_assert(TRX_RSEG_BINLOG_NAME_LEN == sizeof
trx_sys.recovered_binlog_filename); trx_sys.recovered_binlog_filename);
if (lsn > trx_sys.recovered_binlog_lsn) {
int cmp = *trx_sys.recovered_binlog_filename trx_sys.recovered_binlog_lsn = lsn;
? strncmp(binlog_name, trx_sys.recovered_binlog_offset
trx_sys.recovered_binlog_filename, = mach_read_from_8(
TRX_RSEG_BINLOG_NAME_LEN) TRX_RSEG
: 1; + TRX_RSEG_BINLOG_OFFSET
if (cmp >= 0) {
uint64_t binlog_offset = mach_read_from_8(
TRX_RSEG + TRX_RSEG_BINLOG_OFFSET
+ rseg_hdr->frame); + rseg_hdr->frame);
if (cmp) { memcpy(trx_sys.recovered_binlog_filename,
memcpy(trx_sys.
recovered_binlog_filename,
binlog_name, binlog_name,
TRX_RSEG_BINLOG_NAME_LEN); TRX_RSEG_BINLOG_NAME_LEN);
trx_sys.recovered_binlog_offset
= binlog_offset;
} else if (binlog_offset >
trx_sys.recovered_binlog_offset) {
trx_sys.recovered_binlog_offset
= binlog_offset;
}
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
Copyright (C) 2008-2009 Sun Microsystems, Inc. Copyright (C) 2008-2009 Sun Microsystems, Inc.
Copyright (c) 2009, 2020, MariaDB Corporation Ab Copyright (c) 2009, 2021, MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -2550,9 +2550,6 @@ int ha_maria::info(uint flag)
MARIA_INFO maria_info; MARIA_INFO maria_info;
char name_buff[FN_REFLEN]; char name_buff[FN_REFLEN];
if (!file)
return 0;
(void) maria_status(file, &maria_info, flag); (void) maria_status(file, &maria_info, flag);
if (flag & HA_STATUS_VARIABLE) if (flag & HA_STATUS_VARIABLE)
{ {