Commit 28a18fef authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.50' into ubuntu-14.04

Upstream version 5.5.50
parents 3747036d 95c6357a
...@@ -5830,5 +5830,44 @@ OCTET_LENGTH(a) a ...@@ -5830,5 +5830,44 @@ OCTET_LENGTH(a) a
255 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 255 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
#
#
SET NAMES utf8;
SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data;
data
131072
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data
) AS sub;
len
131072
SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data;
data
131070
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data
) AS sub;
len
131070
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub;
len
73532
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub;
len
73534
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub;
len
73556
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub;
len
131070
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
len
131072
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
len
131074
#
# End of 5.5 tests # End of 5.5 tests
# #
...@@ -2622,6 +2622,40 @@ OCTET_LENGTH(a) a ...@@ -2622,6 +2622,40 @@ OCTET_LENGTH(a) a
252 😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎 252 😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
#
#
SET NAMES utf8mb4;
SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data;
data
65532
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub;
len
65532
SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data;
data
65538
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub;
len
65538
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub;
len
65532
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub;
len
65535
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub;
len
65538
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub;
len
196605
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
len
196608
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
......
...@@ -15,3 +15,15 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci, ...@@ -15,3 +15,15 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
FULLTEXT(a)); FULLTEXT(a));
INSERT INTO t1 VALUES(0xA3C2); INSERT INTO t1 VALUES(0xA3C2);
DROP TABLE t1; DROP TABLE t1;
create table t1 (
id varchar(255),
business_name text null collate utf8mb4_unicode_ci,
street_address text,
fulltext index ft (business_name),
fulltext index ft2 (street_address)
);
select * from t1 where match (business_name, street_address) against ('some business name and address here');
ERROR HY000: Can't find FULLTEXT index matching the column list
select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode);
id business_name street_address
drop table t1;
...@@ -28,3 +28,18 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (` ...@@ -28,3 +28,18 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`
UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN
# KEY CONSTRAINT
CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB;
CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL,
CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB;
# Without patch, reports incorrect error.
INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
REPLACE INTO t2 VALUES('abc', 2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
Warnings:
Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
DROP TABLE t2, t1;
...@@ -6,5 +6,5 @@ SHOW PROCESSLIST; ...@@ -6,5 +6,5 @@ SHOW PROCESSLIST;
ERROR 70100: Query execution was interrupted ERROR 70100: Query execution was interrupted
SHOW PROCESSLIST; SHOW PROCESSLIST;
Id User Host db Command Time State Info Progress Id User Host db Command Time State Info Progress
# root # test Sleep # # NULL 0.000 # root # test # # # # 0.000
# root # test Query # # SHOW PROCESSLIST 0.000 # root # test # # # # 0.000
...@@ -101,3 +101,31 @@ Februar ...@@ -101,3 +101,31 @@ Februar
SELECT monthname('2001-03-01'); SELECT monthname('2001-03-01');
monthname('2001-03-01') monthname('2001-03-01')
März März
#
# MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
#
SET NAMES utf8;
CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
INSERT INTO t1 VALUES ('test',now());
Warnings:
Note 1265 Data truncated for column 'd' at row 1
SET lc_time_names=ru_RU;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
SET lc_time_names=en_US;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
c
test
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
c
test
SET NAMES latin1;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
c
test
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
c
test
DROP TABLE t1;
...@@ -198,8 +198,6 @@ Ssl_cipher DHE-RSA-AES256-SHA ...@@ -198,8 +198,6 @@ Ssl_cipher DHE-RSA-AES256-SHA
Variable_name Value Variable_name Value
Ssl_cipher EDH-RSA-DES-CBC3-SHA Ssl_cipher EDH-RSA-DES-CBC3-SHA
Variable_name Value Variable_name Value
Ssl_cipher EDH-RSA-DES-CBC-SHA
Variable_name Value
Ssl_cipher RC4-SHA Ssl_cipher RC4-SHA
select 'is still running; no cipher request crashed the server' as result from dual; select 'is still running; no cipher request crashed the server' as result from dual;
result result
......
...@@ -643,3 +643,23 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW ...@@ -643,3 +643,23 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB; SET default_storage_engine = NEW.INNODB;
ERROR 42S22: Unknown column 'INNODB' in 'NEW' ERROR 42S22: Unknown column 'INNODB' in 'NEW'
DROP TABLE t1; DROP TABLE t1;
select 0==0;
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 '=0' at line 1
select 1=!0, 1 = ! 0;
1=!0 1 = ! 0
1 1
select !!0, ! ! 0;
!!0 ! ! 0
0 0
select 2>!0, 2 > ! 0;
2>!0 2 > ! 0
1 1
select 0<=!0, 0 <= !0;
0<=!0 0 <= !0
1 1
select 1<<!0, 1 << !0;
1<<!0 1 << !0
2 2
select 0<!0, 0 < ! 0;
0<!0 0 < ! 0
1 1
...@@ -32,12 +32,9 @@ update t1, t2 set val= 1 where id1=id2; ...@@ -32,12 +32,9 @@ update t1, t2 set val= 1 where id1=id2;
call bug9486(); call bug9486();
lock tables t2 write; lock tables t2 write;
call bug9486(); call bug9486();
show processlist; SELECT state,info FROM information_schema.processlist WHERE id=con1root_id;
Id User Host db Command Time State Info Progress state info
# root localhost test Sleep # NULL 0.000 Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2
# root localhost test Query # Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2 0.000
# root localhost test Query # NULL show processlist 0.000
# root localhost test Sleep # NULL 0.000
unlock tables; unlock tables;
drop procedure bug9486; drop procedure bug9486;
drop table t1, t2; drop table t1, t2;
......
#
# Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
#
# try to connect with wrong '--ssl-ca' path : should fail
ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed
# try to connect with correct '--ssl-ca' path : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
#
# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
# PATH SUBSTITUTION
#
# try to connect with '--ssl-ca' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-key' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-cert' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
...@@ -442,6 +442,7 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; ...@@ -442,6 +442,7 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
drop table t1; drop table t1;
# #
# MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
# MDEV-9972 Least function retuns date in date time format
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
id BIGINT NOT NULL, id BIGINT NOT NULL,
...@@ -465,9 +466,9 @@ LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)), ...@@ -465,9 +466,9 @@ LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)),
IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin
FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); FROM t1 LEFT JOIN t2 ON (t1.id=t2.id);
id date_debut date_fin id date_debut date_fin
1 2016-01-01 2016-01-31 00:00:00 1 2016-01-01 2016-01-31
2 2016-02-01 2016-01-28 00:00:00 2 2016-02-01 2016-01-28
3 2016-03-01 2016-03-31 00:00:00 3 2016-03-01 2016-03-31
4 2016-04-01 NULL 4 2016-04-01 NULL
DROP TABLE t1,t2; DROP TABLE t1,t2;
SELECT SELECT
......
set global log_warnings=2;
set @@wait_timeout=1;
set global log_warnings=@@log_warnings;
...@@ -44,8 +44,7 @@ connection con1; ...@@ -44,8 +44,7 @@ connection con1;
--error 2006,2013 --error 2006,2013
reap; reap;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-binlog_mdev342.test restart-binlog_mdev342.test
EOF EOF
......
...@@ -68,3 +68,47 @@ Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referen ...@@ -68,3 +68,47 @@ Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referen
Error 1005 Can't create table '#sql-temporary' (errno: 150) Error 1005 Can't create table '#sql-temporary' (errno: 150)
drop table t2; drop table t2;
drop table t1; drop table t1;
CREATE DATABASE kg_test1;
CREATE DATABASE kg_test2;
CREATE TABLE `kg_test1`.`group` (
Id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `kg_test1`.`person` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
show create table `kg_test1`.`person`;
Table Create Table
person CREATE TABLE `person` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
CREATE TABLE `kg_test2`.`person2` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
ERROR HY000: Can't create table 'kg_test2.person2' (errno: 150)
CREATE TABLE `kg_test2`.`person2` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
show create table `kg_test2`.`person2`;
Table Create Table
person2 CREATE TABLE `person2` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
SHOW WARNINGS;
Level Code Message
DROP DATABASE kg_test2;
DROP DATABASE kg_test1;
set names utf8;
CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100),
c INT,
z INT,
INDEX(b))
ENGINE=InnoDB;
INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1);
CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b);
CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā;
a b c z a b c z
1 x 1 1 1 x 1 1
select @@unique_checks;
@@unique_checks
0
select @@innodb_change_buffering_debug;
@@innodb_change_buffering_debug
1
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā;
count(*) count(*)
1024 2
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxā" is corrupted. test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxē" is corrupted. test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
select c from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
show warnings; ERROR HY000: Index corrupt_bit_test_ā is corrupted
ERROR HY000: Index corrupt_bit_test_ā is corrupted
Level Code Message Level Code Message
Warning 179 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Warning 179 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted
Warning 179 Got error 179 when reading table `test`.`corrupt_bit_test_ā` Warning 179 Got error 179 when reading table `test`.`corrupt_bit_test_ā`
Error 1712 Index corrupt_bit_test_ā is corrupted Error 1712 Index corrupt_bit_test_ā is corrupted
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
select * from corrupt_bit_test_ā use index(primary) where a = 10001;
a b c z a b c z
10001 a 20001 20001 10001 a 20001 20001
begin;
insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002);
delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback;
drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
set names utf8;
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
drop index idxē on corrupt_bit_test_ā; Table Create Table
select z from corrupt_bit_test_ā limit 10; corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(100) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`z` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `idxē` (`z`,`b`),
KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
ERROR HY000: Index corrupt_bit_test_ā is corrupted
ERROR HY000: Index corrupt_bit_test_ā is corrupted
Table Create Table
corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(100) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`z` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
z z
20001 20001
1 1
1
2 2
11
12
21
22
31
32
drop table corrupt_bit_test_ā;
DROP DATABASE pad;
SET GLOBAL innodb_change_buffering_debug = 0;
...@@ -124,3 +124,44 @@ show warnings; ...@@ -124,3 +124,44 @@ show warnings;
drop table t2; drop table t2;
drop table t1; drop table t1;
#
# MDEV-9142 :Adding Constraint with no database reference
# results in ERROR 1046 (3D000) at line 13: No database selected
#
CREATE DATABASE kg_test1;
CREATE DATABASE kg_test2;
CREATE TABLE `kg_test1`.`group` (
Id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `kg_test1`.`person` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
show create table `kg_test1`.`person`;
--error 1005
CREATE TABLE `kg_test2`.`person2` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
CREATE TABLE `kg_test2`.`person2` (
`Id` INT(11) NOT NULL AUTO_INCREMENT,
`Name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `fk_person_group` FOREIGN KEY (`Id`) REFERENCES `kg_test1`.`group` (`Id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
show create table `kg_test2`.`person2`;
SHOW WARNINGS;
DROP DATABASE kg_test2;
DROP DATABASE kg_test1;
...@@ -2,45 +2,23 @@ ...@@ -2,45 +2,23 @@
# Test for persistent corrupt bit for corrupted index and table # Test for persistent corrupt bit for corrupted index and table
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/not_embedded.inc
# Issues with innodb_change_buffering_debug on Windows, so the test scenario
# cannot be created on windows
--source include/not_windows.inc
# This test needs debug server # This test needs debug server
--source include/have_debug.inc -- source include/have_debug.inc
-- disable_query_log -- disable_query_log
call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE"); call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE");
# This test setup is extracted from bug56680.test:
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
SET GLOBAL innodb_change_buffering_debug = 1;
# Turn off Unique Check to create corrupted index with dup key
SET UNIQUE_CHECKS=0;
CREATE DATABASE pad;
let $i=338;
while ($i)
{
--eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB;
dec $i;
}
-- enable_query_log
set names utf8; set names utf8;
SET UNIQUE_CHECKS=0;
CREATE TABLE corrupt_bit_test_ā( CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY, a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100), b CHAR(100),
c INT, c INT,
z INT, z INT,
INDEX(b)) INDEX idx(b))
ENGINE=InnoDB; ENGINE=InnoDB;
INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1);
...@@ -53,38 +31,21 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); ...@@ -53,38 +31,21 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā; SELECT * FROM corrupt_bit_test_ā;
select @@unique_checks;
select @@innodb_change_buffering_debug;
# Create enough rows for the table, so that the insert buffer will be
# used for modifying the secondary index page. There must be multiple
# index pages, because changes to the root page are never buffered.
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); # This will flag all secondary indexes corrupted
SET SESSION debug_dbug="+d,dict_set_index_corrupted";
# Create a dup key error on index "idxē" and "idxā" by inserting a dup value check table corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1); SET SESSION debug_dbug="-d,dict_set_index_corrupted";
# creating an index should succeed even if other secondary indexes are corrupted # Cannot create new indexes while corrupted indexes exist
--error ER_INDEX_CORRUPT
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
--error ER_INDEX_CORRUPT
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
# Check table will find the unique indexes corrupted
# with dup key
check table corrupt_bit_test_ā;
# This selection intend to use the corrupted index. Expect to fail # This selection intend to use the corrupted index. Expect to fail
-- error ER_INDEX_CORRUPT -- error ER_INDEX_CORRUPT
select c from corrupt_bit_test_ā; select c from corrupt_bit_test_ā;
...@@ -108,7 +69,6 @@ delete from corrupt_bit_test_ā where a = 10001; ...@@ -108,7 +69,6 @@ delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback; rollback;
# Drop one corrupted index before reboot
drop index idxā on corrupt_bit_test_ā; drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā; check table corrupt_bit_test_ā;
...@@ -118,14 +78,26 @@ set names utf8; ...@@ -118,14 +78,26 @@ set names utf8;
-- error ER_INDEX_CORRUPT -- error ER_INDEX_CORRUPT
select z from corrupt_bit_test_ā; select z from corrupt_bit_test_ā;
show create table corrupt_bit_test_ā;
# Drop the corrupted index # Drop the corrupted index
drop index idxē on corrupt_bit_test_ā; drop index idxē on corrupt_bit_test_ā;
# Cannot create new indexes while a corrupt index exists.
--error ER_INDEX_CORRUPT
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
--error ER_INDEX_CORRUPT
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
show create table corrupt_bit_test_ā;
drop index idx on corrupt_bit_test_ā;
# Now that there exist no corrupted indexes, we can create new indexes.
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
# Now select back to normal # Now select back to normal
select z from corrupt_bit_test_ā limit 10; select z from corrupt_bit_test_ā limit 10;
# Drop table # Drop table
drop table corrupt_bit_test_ā; drop table corrupt_bit_test_ā;
DROP DATABASE pad;
SET GLOBAL innodb_change_buffering_debug = 0;
...@@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; ...@@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1 = PASSWORD('pwd 098');
SET PASSWORD FOR u1=<secret>; SET PASSWORD FOR u1=<secret>;
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 '=<secret>' 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 '<secret>' at line 1
CREATE USER u3 IDENTIFIED BY ''; CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3; drop user u1, u2, u3;
select 2; select 2;
......
...@@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; ...@@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1 = PASSWORD('pwd 098');
SET PASSWORD FOR u1=<secret>; SET PASSWORD FOR u1=<secret>;
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 '=<secret>' 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 '<secret>' at line 1
CREATE USER u3 IDENTIFIED BY ''; CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3; drop user u1, u2, u3;
select 2; select 2;
......
...@@ -209,8 +209,7 @@ EOF ...@@ -209,8 +209,7 @@ EOF
--shutdown_server 30 --shutdown_server 30
--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test restart-rpl_mdev382.test
EOF EOF
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment