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
3
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
#
# 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;
--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 #

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
Warnings:
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';
--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');
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
#

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');
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 # End of 10.3 tests
--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
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
#
# 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
#
# 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
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 #

View File

@ -1,7 +1,7 @@
#
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
#
connect con1,localhost,root,,;
connect con1,localhost,root;
connection con1;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
connection default;
@ -13,17 +13,21 @@ User
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
#
# End of 5.5 tests
#
#
# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
#
connect con1,localhost,root,,;
select sleep(100000);;
connect con1,localhost,root;
select sleep(100000);
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
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select sleep(100000)
KILL QUERY con_id;
KILL QUERY $con_id;
#
# 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 #
connect (con1,localhost,root,,);
connect con1,localhost,root;
connection con1;
@ -39,22 +39,22 @@ SET DEBUG_SYNC = 'RESET';
source include/wait_until_count_sessions.inc;
--echo End of 5.5 tests
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
--echo #
--connect (con1,localhost,root,,)
--connect con1,localhost,root
--let $con_id = `SELECT CONNECTION_ID()`
--send select sleep(100000);
--send select sleep(100000)
--connection default
evalp SHOW EXPLAIN FOR $con_id;
evalp KILL QUERY $con_id;
--replace_result $con_id con_id
eval SHOW EXPLAIN FOR $con_id;
--replace_result $con_id con_id
eval KILL QUERY $con_id;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -115,7 +115,6 @@ RETURN 'str';
END|
ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1'
SET NAMES utf8;
DROP FUNCTION IF EXISTS bug48766;
CREATE FUNCTION bug48766 ()
RETURNS ENUM( 'w' ) CHARACTER SET ucs2
RETURN 0;
@ -140,3 +139,13 @@ WHERE ROUTINE_NAME='bug48766';
DTD_IDENTIFIER
enum('а','б','в','г')
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
#
SET NAMES utf8;
--disable_warnings
DROP FUNCTION IF EXISTS bug48766;
--enable_warnings
#
# 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';
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
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
#

View File

@ -1865,6 +1865,24 @@ select * from t1 where a > 4;
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 # End of 10.3 tests
--echo #

View File

@ -13,8 +13,7 @@ CREATE TABLE t1 (
`name` varchar(32) default 'name')
DEFAULT CHARSET=latin1;
connection master;
CREATE TABLE t1 ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -38,6 +37,9 @@ id group a\\b a\\ name
1 1 2 NULL foo
2 1 2 NULL fee
DROP TABLE t1;
#
# MDEV-11311 Create federated table does not work as expected
#
create table t1 (
a bigint(20) not null auto_increment,
b bigint(20) not null,
@ -57,8 +59,7 @@ t1 CREATE TABLE `t1` (
KEY `b` (`b`,`c`,`d`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection master;
create table t1 engine=federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -72,6 +73,12 @@ t1 CREATE TABLE `t1` (
drop table t1;
connection slave;
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;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;

View File

@ -13,9 +13,7 @@ CREATE TABLE t1 (
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1 ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
evalp CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW CREATE TABLE t1;
@ -30,9 +28,9 @@ connection slave;
SELECT * FROM t1;
DROP TABLE t1;
#
#
#
--echo #
--echo # MDEV-11311 Create federated table does not work as expected
--echo #
create table t1 (
a bigint(20) not null auto_increment,
b bigint(20) not null,
@ -44,9 +42,7 @@ create table t1 (
show create table t1;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table t1 engine=federated
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
evalp create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
show create table t1;
drop table t1;
@ -54,5 +50,12 @@ drop table t1;
connection slave;
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;

View File

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

View File

@ -1,7 +1,9 @@
connection node_2;
connection node_1;
#
# 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;
# default
SELECT @@global.wsrep_start_position;
@ -11,46 +13,92 @@ SELECT @@global.wsrep_start_position;
# scope
SELECT @@session.wsrep_start_position;
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;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
# valid values
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
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;
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:-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
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';
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';
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';
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';
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';
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';
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;
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='';
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;
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';
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
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/galera_have_debug_sync.inc
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
--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);
--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
ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
--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);
SELECT COUNT(*) = 2 FROM t1;
SELECT COUNT(*) AS EXPECT_2 FROM t1;
SELECT * FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1
--source include/wait_condition.inc
INSERT INTO t1 VALUES (3, 3);
SELECT COUNT(*) = 3 FROM t1;
SELECT COUNT(*) AS EXPECT_3 FROM t1;
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -1,12 +1,12 @@
--source include/have_wsrep.inc
--source include/galera_cluster.inc
--echo #
--echo # wsrep_start_position
--echo #
--echo # save the initial value
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
CALL mtr.add_suppression("WSREP: SST failed for position .*");
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
--echo # default
SELECT @@global.wsrep_start_position;
@ -14,40 +14,60 @@ SELECT @@global.wsrep_start_position;
--echo # scope
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_start_position;
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position;
--echo
--echo # valid values
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
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;
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
SELECT @@global.wsrep_start_position;
--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
--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';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='OFF';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position=ON;
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='';
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position=NULL;
SELECT @@global.wsrep_start_position;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_start_position='junk';
SELECT @@global.wsrep_start_position;
--echo
--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
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 SESSION wsrep_trx_fragment_size = 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;
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;
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_1a;
connection node_2;
set session wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
COUNT(*)
30000
300
SELECT COUNT(DISTINCT f1) FROM t1;
COUNT(DISTINCT f1)
30000
300
connection default;
DROP TABLE t1;
DROP TABLE ten;

View File

@ -3,8 +3,6 @@
##
--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
--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;
SET SESSION wsrep_trx_fragment_size = 1;
--connection node_2
set session wsrep_sync_wait=15;
SELECT COUNT(*) from ten;
@ -35,13 +32,13 @@ SET GLOBAL wsrep_slave_threads = 4;
SET SESSION wsrep_trx_fragment_size = 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
--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
--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
--reap

View File

@ -291,43 +291,6 @@ a b vb
5 NULL NULL
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
#
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
@ -370,6 +333,60 @@ SET DEBUG_SYNC='RESET';
disconnect con2;
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()
# in btr_discard_only_page_on_level()
#
@ -383,6 +400,7 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
SELECT * FROM t1;
c2 c
DROP TABLE t1;
# End of 10.4 tests
#
# MDEV-22867 Assertion instant.n_core_fields == n_core_fields
# in dict_index_t::instant_add_field
@ -421,4 +439,5 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET DEBUG_SYNC=RESET;
# End of 10.5 tests
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;

View File

@ -325,42 +325,6 @@ CHECK TABLE t1;
SELECT * FROM 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 # MDEV-21045 AddressSanitizer: use-after-poison in mem_heap_dup / row_log_table_get_pk_col
--echo #
@ -413,6 +377,63 @@ SET DEBUG_SYNC='RESET';
--disconnect con2
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 # MDEV-24512 Assertion failed in rec_is_metadata()
--echo # in btr_discard_only_page_on_level()
@ -429,6 +450,8 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
SELECT * FROM t1;
DROP TABLE t1;
--echo # End of 10.4 tests
--echo #
--echo # MDEV-22867 Assertion instant.n_core_fields == n_core_fields
--echo # in dict_index_t::instant_add_field
@ -475,4 +498,6 @@ CHECK TABLE t1;
DROP TABLE t1;
SET DEBUG_SYNC=RESET;
--echo # End of 10.5 tests
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;
ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
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;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
DROP TABLE t1;
@ -244,3 +276,4 @@ CREATE TABLE t1
ENGINE=InnoDB;
ALTER TABLE t1 ADD c SERIAL;
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);
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
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
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;
ALTER TABLE t1 ADD c SERIAL;
DROP TABLE t1;
--echo # End of 10.3 tests

View File

@ -16,9 +16,11 @@ SELECT @@global.wsrep_debug;
@@global.wsrep_debug
NONE
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
SERVER
NONE
# valid values
SET @@global.wsrep_debug=NONE;
@ -26,9 +28,11 @@ SELECT @@global.wsrep_debug;
@@global.wsrep_debug
NONE
SET @@global.wsrep_debug=SERVER;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug;
@@global.wsrep_debug
SERVER
NONE
SET @@global.wsrep_debug=default;
SELECT @@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_ERRMSG gssapi_errmsg.cc)
IF(APPLE)
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET_SOURCE_FILES_PROPERTIES(
${GSSAPI_CLIENT} ${GSSAPI_SERVER} ${GSSAPI_ERRMSG}
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 "")
TARGET_LINK_LIBRARIES(pam_mariadb_mtr pam)
IF(APPLE)
IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
SET_SOURCE_FILES_PROPERTIES(
pam_mariadb_mtr.c
PROPERTY COMPILE_FLAGS "-Wno-incompatible-pointer-types-discards-qualifiers")

View File

@ -27,6 +27,7 @@
set sql_mode='';
set default_storage_engine=Aria;
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');

View File

@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED
#define FIELD_INCLUDED
/* 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
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,
const LEX_CSTRING *field_name_arg,
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); }
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) 2009, 2020, MariaDB
Copyright (c) 2009, 2021, MariaDB
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
@ -42,7 +42,6 @@
#include <mysql/psi/mysql_statement.h>
#include <strfunc.h>
#include "compat56.h"
#include "wsrep_mysqld.h"
#include "sql_insert.h"
#else
#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;
lex->query_tables_last= &tables->next_global;
}
else if (!WSREP_ON)
else
{
tables->slave_fk_event_map= new_trg_event_map;
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 "));
else
buf->append(STRING_WITH_LEN(" RETURNS "));
buf->append(&returns);
buf->append(returns.str, returns.length); // Not \0 terminated
}
buf->append('\n');
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())
{
Item *extracted_cond_copy;
if (!sl->cond_pushdown_is_allowed())
continue;
/*
For each select of the unit except the last one
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.
*/
m_ptr= (char *) m_tok_start + 1;
if (m_echo)
m_cpp_ptr= (char *) m_cpp_tok_start + 1;
return quote_char;
}
int var_length= cs->charlen(get_ptr() - 1, get_end_of_query());

View File

@ -1785,7 +1785,7 @@ JOIN::init_range_rowid_filters()
int
JOIN::optimize_inner()
{
DBUG_ENTER("JOIN::optimize");
DBUG_ENTER("JOIN::optimize_inner");
subq_exit_fl= false;
do_send_rows = (unit->lim.get_select_limit()) ? 1 : 0;
@ -1858,6 +1858,10 @@ JOIN::optimize_inner()
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 */
DBUG_RETURN(-1);

View File

@ -5038,7 +5038,8 @@ public:
Sql_condition::enum_warning_level *level,
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;
if (*level != Sql_condition::WARN_LEVEL_ERROR)
@ -8476,55 +8477,64 @@ end:
}
static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables)
{
TABLE *table= table_list->table;
THD *thd=table->in_use;
if (!table->is_created())
List_iterator<TABLE_LIST> tli(tables);
while (TABLE_LIST *table_list= tli++)
{
TMP_TABLE_PARAM *p= table_list->schema_table_param;
TMP_ENGINE_COLUMNDEF *from_recinfo, *to_recinfo;
DBUG_ASSERT(table->s->keys == 0);
DBUG_ASSERT(table->s->uniques == 0);
TABLE *table= table_list->table;
THD *thd=table->in_use;
uchar *cur= table->field[0]->ptr;
/* first recinfo could be a NULL bitmap, not an actual Field */
from_recinfo= to_recinfo= p->start_recinfo + (cur != table->record[0]);
for (uint i=0; i < table->s->fields; i++, from_recinfo++)
{
Field *field= table->field[i];
DBUG_ASSERT(field->vcol_info == 0);
DBUG_ASSERT(from_recinfo->length);
DBUG_ASSERT(from_recinfo->length == field->pack_length_in_rec());
if (bitmap_is_set(table->read_set, i))
{
field->move_field(cur);
*to_recinfo++= *from_recinfo;
cur+= from_recinfo->length;
}
else
{
field= new (thd->mem_root) Field_string(cur, 0, field->null_ptr,
field->null_bit, Field::NONE,
&field->field_name, field->dtcollation());
field->init(table);
field->field_index= i;
DBUG_ASSERT(field->pack_length_in_rec() == 0);
table->field[i]= field;
}
}
if ((table->s->reclength= (ulong)(cur - table->record[0])) == 0)
{
/* all fields were optimized away. Force a non-0-length row */
table->s->reclength= to_recinfo->length= 1;
to_recinfo++;
}
p->recinfo= to_recinfo;
if (!table_list->schema_table || !thd->fill_information_schema_tables())
continue;
// TODO switch from Aria to Memory if all blobs were optimized away?
if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo,
table_list->select_lex->options | thd->variables.option_bits))
return 1;
if (!table->is_created())
{
TMP_TABLE_PARAM *p= table_list->schema_table_param;
TMP_ENGINE_COLUMNDEF *from_recinfo, *to_recinfo;
DBUG_ASSERT(table->s->keys == 0);
DBUG_ASSERT(table->s->uniques == 0);
uchar *cur= table->field[0]->ptr;
/* first recinfo could be a NULL bitmap, not an actual Field */
from_recinfo= to_recinfo= p->start_recinfo + (cur != table->record[0]);
for (uint i=0; i < table->s->fields; i++, from_recinfo++)
{
Field *field= table->field[i];
DBUG_ASSERT(field->vcol_info == 0);
DBUG_ASSERT(from_recinfo->length);
DBUG_ASSERT(from_recinfo->length == field->pack_length_in_rec());
if (bitmap_is_set(table->read_set, i))
{
field->move_field(cur);
*to_recinfo++= *from_recinfo;
cur+= from_recinfo->length;
}
else
{
field= new (thd->mem_root) Field_string(cur, 0, field->null_ptr,
field->null_bit, Field::NONE,
&field->field_name, field->dtcollation());
field->init(table);
field->field_index= i;
DBUG_ASSERT(field->pack_length_in_rec() == 0);
table->field[i]= field;
}
}
if ((table->s->reclength= (ulong)(cur - table->record[0])) == 0)
{
/* all fields were optimized away. Force a non-0-length row */
table->s->reclength= to_recinfo->length= 1;
to_recinfo++;
}
p->recinfo= to_recinfo;
// TODO switch from Aria to Memory if all blobs were optimized away?
if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo,
table_list->select_lex->options | thd->variables.option_bits))
return 1;
}
}
return 0;
}
@ -8550,9 +8560,6 @@ bool optimize_schema_tables_reads(JOIN *join)
TABLE_LIST *table_list= tab->table->pos_in_table_list;
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 */
if (table_list->schema_table->fill_table == 0)
continue;

View File

@ -246,6 +246,7 @@ public:
};
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. */
bool ignore_db_dirs_init();

View File

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

View File

@ -1,5 +1,5 @@
/* 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
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->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset);
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)
{
@ -3430,9 +3431,8 @@ ret:
if (unlikely(thd->is_error() || error))
{
thd->clear_error();
my_error(ER_SQL_DISCOVER_ERROR, MYF(0),
plugin_name(db_plugin)->str, db.str, table_name.str,
sql_copy);
my_error(ER_SQL_DISCOVER_ERROR, MYF(0), hton_name(hton)->str,
db.str, table_name.str, sql_copy);
DBUG_RETURN(HA_ERR_GENERIC);
}
/* 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;
// 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);
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,
os.str().c_str(),
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::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))
{
trans_rollback_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1);
}
@ -937,9 +945,11 @@ int Wsrep_schema::append_fragment(THD* thd,
if ((error= Wsrep_schema_impl::insert(frag_table))) {
WSREP_ERROR("Failed to write to frag table: %d", error);
trans_rollback_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1);
}
Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(0);
}
@ -956,6 +966,13 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
ws_meta.seqno().get());
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);
int error;
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);
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);
}
@ -985,6 +1003,7 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
error);
}
Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1);
}
@ -1000,11 +1019,13 @@ int Wsrep_schema::update_fragment_meta(THD* thd,
frag_table->s->table_name.str,
error);
Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1);
}
int ret= Wsrep_schema_impl::end_index_scan(frag_table);
Wsrep_schema_impl::finish_stmt(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(ret);
}

View File

@ -309,12 +309,40 @@ bool wsrep_before_SE()
}
// Signal end of SST
static void wsrep_sst_complete (THD* thd,
int const rcode)
static bool wsrep_sst_complete (THD* thd,
int const rcode,
wsrep::gtid const sst_gtid)
{
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();
return failed;
}
/*
@ -326,13 +354,15 @@ static void wsrep_sst_complete (THD* thd,
@param seqno [IN] Initial state sequence number
@param state [IN] Always NULL, 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,
wsrep_seqno_t const seqno,
const void* const state,
size_t const state_len)
{
bool error= false;
/*
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
@ -372,8 +402,10 @@ void wsrep_sst_received (THD* thd,
if (WSREP_ON)
{
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,
@ -655,7 +687,7 @@ err:
/* Read committed isolation to avoid gap locking */
thd->variables.tx_isolation= ISO_READ_COMMITTED;
wsrep_sst_complete (thd, -err);
wsrep_sst_complete (thd, -err, ret_gtid);
delete thd;
my_thread_end();

View File

@ -223,8 +223,11 @@ bool wsrep_start_position_verify (const char* start_str)
char* endptr;
char* startptr= (char *)start_str + uuid_len + 1;
wsrep_seqno_t const seqno __attribute__((unused)) // to avoid GCC warnings
(parse_value<uint64_t>(&startptr, &endptr));
wsrep_seqno_t const seqno(parse_value<uint64_t>(&startptr, &endptr));
// Do not allow seqno < -1
if (seqno < -1)
return true;
// Start parsing native GTID part
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));
}
if (sst) {
wsrep_sst_received (thd, uuid, seqno, NULL, 0);
} else {
local_uuid= uuid;
local_seqno= seqno;
}
char start_pos_buf[FN_REFLEN];
memcpy(start_pos_buf, value, length);
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_seqno= seqno;
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);
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.
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
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,
var->save_result.string_value.length,
true))
{
goto err;
}
return false;
@ -326,7 +356,7 @@ bool wsrep_start_position_init (const char* val)
{
if (NULL == val || wsrep_start_position_verify (val))
{
WSREP_ERROR("Bad initial value for wsrep_start_position: %s",
WSREP_ERROR("Bad initial value for wsrep_start_position: %s",
(val ? val : ""));
return true;
}
@ -440,8 +470,8 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type)
void wsrep_provider_init (const char* value)
{
WSREP_DEBUG("wsrep_provider_init: %s -> %s",
(wsrep_provider) ? wsrep_provider : "null",
WSREP_DEBUG("wsrep_provider_init: %s -> %s",
(wsrep_provider) ? wsrep_provider : "null",
(value) ? value : "null");
if (NULL == value || wsrep_provider_verify (value))
{
@ -480,7 +510,7 @@ bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type)
void wsrep_provider_options_init(const char* value)
{
if (wsrep_provider_options && wsrep_provider_options != value)
if (wsrep_provider_options && wsrep_provider_options != value)
my_free((void *)wsrep_provider_options);
wsrep_provider_options= value ? my_strdup(PSI_INSTRUMENT_MEM, value, MYF(0)) : NULL;
}
@ -509,8 +539,21 @@ 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)
{
// 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);
return false;
return false;
}
bool
@ -557,11 +600,11 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
return false;
}
/* stop replication is heavy operation, and includes closing all client
/* stop replication is heavy operation, and includes closing all client
connections. Closing clients may need to get LOCK_global_system_variables
at least in MariaDB.
Note: releasing LOCK_global_system_variables may cause race condition, if
Note: releasing LOCK_global_system_variables may cause race condition, if
there can be several concurrent clients changing wsrep_provider
*/
WSREP_DEBUG("wsrep_cluster_address_update: %s", wsrep_cluster_address);
@ -590,8 +633,8 @@ bool wsrep_cluster_address_update (sys_var *self, THD* thd, enum_var_type type)
void wsrep_cluster_address_init (const char* value)
{
WSREP_DEBUG("wsrep_cluster_address_init: %s -> %s",
(wsrep_cluster_address) ? wsrep_cluster_address : "null",
WSREP_DEBUG("wsrep_cluster_address_init: %s -> %s",
(wsrep_cluster_address) ? wsrep_cluster_address : "null",
(value) ? value : "null");
my_free(const_cast<char*>(wsrep_cluster_address));
@ -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",
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)
{
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",
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)
{
return thd->wsrep_cs().enable_streaming(

View File

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

View File

@ -1,7 +1,7 @@
/*****************************************************************************
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
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
DROP COLUMN ... that is not ALGORITHM=INSTANT,
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
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_is_leaf(block->frame));
ut_ad(!page_has_prev(block->frame));
@ -173,7 +175,9 @@ before_first:
rec = page_rec_get_next(rec);
if (page_rec_is_supremum(rec)) {
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;
}
}

View File

@ -5822,11 +5822,13 @@ add_all_virtual:
const rec_t* rec = btr_pcur_get_rec(&pcur);
que_thr_t* thr = pars_complete_graph_for_exec(
NULL, trx, ctx->heap, NULL);
const bool is_root = block->page.id().page_no() == index->page;
dberr_t err = DB_SUCCESS;
if (rec_is_metadata(rec, *index)) {
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
&& !page_has_next(block->frame)
&& page_rec_is_last(rec, block->frame)) {
@ -5908,7 +5910,8 @@ add_all_virtual:
}
btr_pcur_close(&pcur);
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:
/* The table is empty. */
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)) {
wrong_column_name:
dict_mem_table_free(ctx->new_table);
ctx->new_table = ctx->old_table;
my_error(ER_WRONG_COLUMN_NAME, MYF(0),
@ -6439,6 +6443,21 @@ 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) {
dict_mem_table_add_v_col(
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) 2017, 2020, MariaDB Corporation.
Copyright (c) 2017, 2021, MariaDB Corporation.
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
@ -901,8 +901,10 @@ public:
#endif
/** Latest 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];
/** 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) 2017, 2020, MariaDB Corporation.
Copyright (c) 2017, 2021, MariaDB Corporation.
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
@ -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;
}
const char* binlog_name = TRX_RSEG + TRX_RSEG_BINLOG_NAME
+ reinterpret_cast<const char*>(rseg_hdr->frame);
const byte* binlog_name = TRX_RSEG + TRX_RSEG_BINLOG_NAME
+ rseg_hdr->frame;
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
trx_sys.recovered_binlog_filename);
int cmp = *trx_sys.recovered_binlog_filename
? strncmp(binlog_name,
trx_sys.recovered_binlog_filename,
TRX_RSEG_BINLOG_NAME_LEN)
: 1;
if (cmp >= 0) {
uint64_t binlog_offset = mach_read_from_8(
TRX_RSEG + TRX_RSEG_BINLOG_OFFSET
+ rseg_hdr->frame);
if (cmp) {
memcpy(trx_sys.
recovered_binlog_filename,
binlog_name,
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;
}
if (lsn > trx_sys.recovered_binlog_lsn) {
trx_sys.recovered_binlog_lsn = lsn;
trx_sys.recovered_binlog_offset
= mach_read_from_8(
TRX_RSEG
+ TRX_RSEG_BINLOG_OFFSET
+ rseg_hdr->frame);
memcpy(trx_sys.recovered_binlog_filename,
binlog_name,
TRX_RSEG_BINLOG_NAME_LEN);
}
#ifdef WITH_WSREP

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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
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;
char name_buff[FN_REFLEN];
if (!file)
return 0;
(void) maria_status(file, &maria_info, flag);
if (flag & HA_STATUS_VARIABLE)
{