Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2021-01-25 11:02:07 +02:00
commit 3467f63764
35 changed files with 601 additions and 203 deletions

View File

@ -17058,6 +17058,76 @@ 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_total_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_total_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

@ -2008,6 +2008,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

@ -1788,6 +1788,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

@ -1564,6 +1564,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

@ -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,4 +400,5 @@ 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
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,4 +450,6 @@ 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
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

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

@ -1870,7 +1870,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 { return NOT_FIXED_DEC; } uint decimals() const { return is_created_from_null_item ? 0 : NOT_FIXED_DEC; }
int save_in_field(Field *to) { return save_in_field_str(to); } int save_in_field(Field *to) { return save_in_field_str(to); }
bool memcpy_field_possible(const Field *from) const bool memcpy_field_possible(const Field *from) const
{ {

View File

@ -2949,7 +2949,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

@ -2289,6 +2289,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= my_charlen(cs, get_ptr() - 1, get_end_of_query()); int var_length= my_charlen(cs, get_ptr() - 1, get_end_of_query());

View File

@ -1807,7 +1807,7 @@ int JOIN::init_join_caches()
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->select_limit_cnt) ? 1 : 0; do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
@ -1880,6 +1880,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

@ -5099,7 +5099,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)
@ -8704,10 +8705,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;
@ -8754,6 +8763,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;
} }
@ -8778,9 +8788,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

@ -238,6 +238,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

@ -2599,7 +2599,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

@ -1127,7 +1127,7 @@ 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);
thd->variables.sql_mode &= ~MODE_NO_BACKSLASH_ESCAPES; thd->variables.sql_mode &= ~(MODE_NO_BACKSLASH_ESCAPES | MODE_EMPTY_STRING_IS_NULL);
while (pos < end) while (pos < end)
{ {
@ -3210,9 +3210,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

@ -363,9 +363,6 @@ int ha_heap::info(uint flag)
{ {
HEAPINFO hp_info; HEAPINFO hp_info;
if (!table)
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
@ -151,7 +151,8 @@ before_first:
ut_ad(!page_rec_is_infimum(rec)); ut_ad(!page_rec_is_infimum(rec));
if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) { if (UNIV_UNLIKELY(rec_is_metadata(rec, *index))) {
ut_ad(index->table->instant); ut_ad(index->table->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));
@ -169,7 +170,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

@ -5907,11 +5907,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)) {
@ -5993,7 +5995,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));
@ -6523,6 +6526,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),
@ -6530,6 +6534,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
@ -847,8 +847,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
@ -443,8 +443,13 @@ static
void void
trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr) trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr)
{ {
trx_rsegf_t* rseg_header = trx_rsegf_get_new( /* This is based on trx_rsegf_get_new().
rseg->space->id, rseg->page_no, mtr); We need to access buf_block_t. */
buf_block_t *block = buf_page_get(
page_id_t(rseg->space->id, rseg->page_no), 0, RW_S_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
const trx_rsegf_t* rseg_header = TRX_RSEG + block->frame;
if (mach_read_from_4(rseg_header + TRX_RSEG_FORMAT) == 0) { if (mach_read_from_4(rseg_header + TRX_RSEG_FORMAT) == 0) {
trx_id_t id = mach_read_from_8(rseg_header trx_id_t id = mach_read_from_8(rseg_header
@ -455,32 +460,20 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, trx_id_t& max_trx_id, mtr_t* mtr)
} }
if (rseg_header[TRX_RSEG_BINLOG_NAME]) { if (rseg_header[TRX_RSEG_BINLOG_NAME]) {
const char* binlog_name = reinterpret_cast<const char*> lsn_t lsn = std::max(block->page.newest_modification,
(rseg_header) + TRX_RSEG_BINLOG_NAME; mach_read_from_8(FIL_PAGE_LSN
+ block->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) rseg_header
: 1; + TRX_RSEG_BINLOG_OFFSET);
memcpy(trx_sys.recovered_binlog_filename,
if (cmp >= 0) { rseg_header + TRX_RSEG_BINLOG_NAME,
uint64_t binlog_offset = mach_read_from_8(
rseg_header + TRX_RSEG_BINLOG_OFFSET);
if (cmp) {
memcpy(trx_sys.
recovered_binlog_filename,
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

@ -2523,9 +2523,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 (!table)
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)
{ {