mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixes to allow one to compile and test innodb_plugin
If one compiles innodb_plugin, then the tests in suite/innodb_plugin will use the plugin. If not and xtradb is used, the tests will use xtradb. mysql-test/include/have_innodb_plugin.inc: Test both for innodb_plugin and xtradb mysql-test/include/have_real_innodb_plugin.inc: Test if we are using innodb_plugin (but not xtradb) mysql-test/include/have_xtradb.inc: Test if xtradb is used mysql-test/lib/mtr_cases.pm: Enable easy testing of innodb_plugin mysql-test/mysql-test-run.pl: Added supression for difference between xtradb & innodb_plugin mysql-test/suite/innodb_plugin/r/innodb-index-ip.result: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb-index-xb.result: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb-index.result: Move tests away that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb-ip.result: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb-xb.result: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb.result: Move tests away that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/r/innodb_bug21704-xb.result: Test result differ for xtradb mysql-test/suite/innodb_plugin/r/innodb_bug46000.result: Remove (not needed) error message not given by MariaDB mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result: Test result differs for xtradb mysql-test/suite/innodb_plugin/r/innodb_bug49164.result: Update results mysql-test/suite/innodb_plugin/r/innodb_bug53591.result: Remove (not needed) error message not given by MariaDB mysql-test/suite/innodb_plugin/r/innodb_bug54679.result: Updated result file mysql-test/suite/innodb_plugin/r/innodb_mysql.result: Updated result file mysql-test/suite/innodb_plugin/t/disabled.def: Disable some tests that depends on newer version of XtraDB mysql-test/suite/innodb_plugin/t/innodb-index-ip.test: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb-index-xb.test: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb-index.test: Move tests away that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb-ip.test: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb-xb.test: Tests from innodb-index that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb.test: Move tests away that gave different results for innodb_plugin and xtradb mysql-test/suite/innodb_plugin/t/innodb_bug21704-xb.test: Test result differ for xtradb mysql-test/suite/innodb_plugin/t/innodb_bug21704.test: Test result differ for xtradb mysql-test/suite/innodb_plugin/t/innodb_bug53591.test: Test results only makes sence for innodb_plugin (things works ok for xtradb) sql/sql_table.cc: Don't set HA_CREATE_USED_ROW_FORMAT for create table (only for update_create_info) if ROW_FORMAT is not used. storage/innodb_plugin/handler/ha_innodb.cc: Fixed wrong error message from innodb. This is needed as MariaDB properly handles errors from ha_index_init() storage/xtradb/handler/ha_innodb.cc: Update base information for XtraDB so that one can use informationschema.plugins to check if one is using XtraDB
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%' OR plugin_description LIKE '%xtradb%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
||||
|
4
mysql-test/include/have_real_innodb_plugin.inc
Normal file
4
mysql-test/include/have_real_innodb_plugin.inc
Normal file
@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
4
mysql-test/include/have_xtradb.inc
Normal file
4
mysql-test/include/have_xtradb.inc
Normal file
@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_description LIKE '%xtradb%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
@ -68,9 +68,22 @@ require "mtr_misc.pl";
|
||||
my $do_test_reg;
|
||||
my $skip_test_reg;
|
||||
|
||||
# Related to adding InnoDB plugin combinations
|
||||
my $lib_innodb_plugin;
|
||||
|
||||
# If "Quick collect", set to 1 once a test to run has been found.
|
||||
my $some_test_found;
|
||||
|
||||
sub find_innodb_plugin {
|
||||
$lib_innodb_plugin=
|
||||
my_find_file($::basedir,
|
||||
["storage/innodb_plugin", "storage/innodb_plugin/.libs",
|
||||
"lib/mysql/plugin", "lib/plugin"],
|
||||
["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
|
||||
"ha_innodb_plugin.sl"],
|
||||
NOT_REQUIRED);
|
||||
}
|
||||
|
||||
sub init_pattern {
|
||||
my ($from, $what)= @_;
|
||||
return undef unless defined $from;
|
||||
@ -103,6 +116,8 @@ sub collect_test_cases ($$$) {
|
||||
$do_test_reg= init_pattern($do_test, "--do-test");
|
||||
$skip_test_reg= init_pattern($skip_test, "--skip-test");
|
||||
|
||||
&find_innodb_plugin;
|
||||
|
||||
# If not reordering, we also shouldn't group by suites, unless
|
||||
# no test cases were named.
|
||||
# This also effects some logic in the loop following this.
|
||||
@ -953,6 +968,30 @@ sub collect_one_test_case {
|
||||
return $tinfo;
|
||||
}
|
||||
}
|
||||
elsif ( $tinfo->{'innodb_plugin_test'} )
|
||||
{
|
||||
# This is a test that needs the innodb plugin
|
||||
if (&find_innodb_plugin)
|
||||
{
|
||||
my $sep= (IS_WINDOWS) ? ';' : ':';
|
||||
my $plugin_filename= basename($lib_innodb_plugin);
|
||||
my $plugin_list=
|
||||
"innodb=$plugin_filename$sep" .
|
||||
"innodb_trx=$plugin_filename$sep" .
|
||||
"innodb_locks=$plugin_filename$sep" .
|
||||
"innodb_lock_waits=$plugin_filename$sep" .
|
||||
"innodb_cmp=$plugin_filename$sep" .
|
||||
"innodb_cmp_reset=$plugin_filename$sep" .
|
||||
"innodb_cmpmem=$plugin_filename$sep" .
|
||||
"innodb_cmpmem_reset=$plugin_filename";
|
||||
|
||||
foreach my $k ('master_opt', 'slave_opt') {
|
||||
push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
|
||||
push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
|
||||
push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
|
||||
@ -1121,8 +1160,11 @@ my @tags=
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
|
||||
["include/have_real.inc", "innodb_test", 1],
|
||||
["include/have_real_innodb_plugin.inc", "innodb_plugin_test", 1],
|
||||
["include/have_xtradb.inc", "innodb_test", 1],
|
||||
["include/have_pbxt.inc", "pbxt_test", 1],
|
||||
["include/have_innodb_plugin.inc", "innodb_test", 1],
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
|
@ -4044,6 +4044,7 @@ sub extract_warning_lines ($) {
|
||||
qr/Slave: Can't drop database.* database doesn't exist/,
|
||||
qr/Slave: Operation DROP USER failed for 'create_rout_db'/,
|
||||
qr|Checking table: '\./mtr/test_suppressions'|,
|
||||
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in MySQL|,
|
||||
qr|mysqld: Table '\./mtr/test_suppressions' is marked as crashed and should be repaired|
|
||||
);
|
||||
|
||||
|
18
mysql-test/suite/innodb_plugin/r/innodb-index-ip.result
Normal file
18
mysql-test/suite/innodb_plugin/r/innodb-index-ip.result
Normal file
@ -0,0 +1,18 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
ERROR 23000: Duplicate entry '4' for key 'b'
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
ERROR 23000: Duplicate entry 'ac' for key 'c'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` char(10) DEFAULT NULL,
|
||||
`d` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
18
mysql-test/suite/innodb_plugin/r/innodb-index-xb.result
Normal file
18
mysql-test/suite/innodb_plugin/r/innodb-index-xb.result
Normal file
@ -0,0 +1,18 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
ERROR 23000: Duplicate entry 'ac' for key 'c'
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
ERROR 23000: Duplicate entry 'ac' for key 'c'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` char(10) DEFAULT NULL,
|
||||
`d` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
@ -440,8 +440,6 @@ t3 CREATE TABLE `t3` (
|
||||
PRIMARY KEY (`a`),
|
||||
KEY `c` (`c`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
alter table t2 drop index b, add index (b);
|
||||
ERROR 42000: Incorrect index name 'b'
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
@ -625,22 +623,6 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `b` (`b`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
ERROR 23000: Duplicate entry '4' for key 'b'
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
ERROR 23000: Duplicate entry 'ac' for key 'c'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` char(10) DEFAULT NULL,
|
||||
`d` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
|
||||
insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
|
||||
alter table t1 add unique index (b);
|
||||
|
31
mysql-test/suite/innodb_plugin/r/innodb-ip.result
Normal file
31
mysql-test/suite/innodb_plugin/r/innodb-ip.result
Normal file
@ -0,0 +1,31 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (
|
||||
sca_code char(6) NOT NULL,
|
||||
cat_code char(6) NOT NULL,
|
||||
sca_desc varchar(50),
|
||||
lan_code char(2) NOT NULL,
|
||||
sca_pic varchar(100),
|
||||
sca_sdesc varchar(50),
|
||||
sca_sch_desc varchar(16),
|
||||
PRIMARY KEY (sca_code, cat_code, lan_code),
|
||||
INDEX sca_pic (sca_pic)
|
||||
) engine = innodb ;
|
||||
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
ERROR 42000: Incorrect index name 'sca_pic'
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
count(*)
|
||||
1
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
sca_pic
|
||||
NULL
|
||||
NULL
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
30
mysql-test/suite/innodb_plugin/r/innodb-xb.result
Normal file
30
mysql-test/suite/innodb_plugin/r/innodb-xb.result
Normal file
@ -0,0 +1,30 @@
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (
|
||||
sca_code char(6) NOT NULL,
|
||||
cat_code char(6) NOT NULL,
|
||||
sca_desc varchar(50),
|
||||
lan_code char(2) NOT NULL,
|
||||
sca_pic varchar(100),
|
||||
sca_sdesc varchar(50),
|
||||
sca_sch_desc varchar(16),
|
||||
PRIMARY KEY (sca_code, cat_code, lan_code),
|
||||
INDEX sca_pic (sca_pic)
|
||||
) engine = innodb ;
|
||||
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
count(*)
|
||||
1
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
sca_pic
|
||||
NULL
|
||||
NULL
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
@ -700,22 +700,6 @@ count(*)
|
||||
select count(*) from t1 where cat_code='E';
|
||||
count(*)
|
||||
0
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
ERROR 42000: Incorrect index name 'sca_pic'
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
count(*)
|
||||
1
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
count(*)
|
||||
1
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
sca_pic
|
||||
NULL
|
||||
NULL
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
||||
set @a:=now();
|
||||
CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
|
||||
@ -1362,7 +1346,7 @@ insert t2 select * from t1;
|
||||
insert t3 select * from t1;
|
||||
checksum table t1, t2, t3, t4 quick;
|
||||
Table Checksum
|
||||
test.t1 2948697075
|
||||
test.t1 3442722830
|
||||
test.t2 NULL
|
||||
test.t3 NULL
|
||||
test.t4 NULL
|
||||
@ -1370,17 +1354,17 @@ Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
checksum table t1, t2, t3, t4;
|
||||
Table Checksum
|
||||
test.t1 2948697075
|
||||
test.t2 2948697075
|
||||
test.t3 2948697075
|
||||
test.t1 3442722830
|
||||
test.t2 3442722830
|
||||
test.t3 3442722830
|
||||
test.t4 NULL
|
||||
Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
checksum table t1, t2, t3, t4 extended;
|
||||
Table Checksum
|
||||
test.t1 2948697075
|
||||
test.t2 2948697075
|
||||
test.t3 2948697075
|
||||
test.t1 3442722830
|
||||
test.t2 3442722830
|
||||
test.t3 3442722830
|
||||
test.t4 NULL
|
||||
Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
@ -1673,13 +1657,13 @@ variable_value
|
||||
16384
|
||||
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
|
||||
variable_value - @innodb_rows_deleted_orig
|
||||
71
|
||||
70
|
||||
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||
variable_value - @innodb_rows_inserted_orig
|
||||
1066
|
||||
1063
|
||||
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||
variable_value - @innodb_rows_updated_orig
|
||||
865
|
||||
863
|
||||
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
|
||||
variable_value - @innodb_row_lock_waits_orig
|
||||
0
|
||||
|
55
mysql-test/suite/innodb_plugin/r/innodb_bug21704-xb.result
Normal file
55
mysql-test/suite/innodb_plugin/r/innodb_bug21704-xb.result
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
# Test that it's not possible to rename columns participating in a
|
||||
# foreign key (either in the referencing or referenced table).
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
|
||||
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
# Test renaming the column in the referenced table.
|
||||
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
@ -14,6 +14,5 @@ show warnings;
|
||||
Level Code Message
|
||||
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
|
||||
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
|
||||
Error 1030 Got error -1 from storage engine
|
||||
create index idx on bug46000(id);
|
||||
drop table bug46000;
|
||||
|
42
mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result
Normal file
42
mysql-test/suite/innodb_plugin/r/innodb_bug49164-xb.result
Normal file
@ -0,0 +1,42 @@
|
||||
SET tx_isolation = 'READ-COMMITTED';
|
||||
CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
|
||||
ENGINE=InnoDB;
|
||||
insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
|
||||
begin;
|
||||
update bug49164 set c=7;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 7
|
||||
2 2 7
|
||||
3 3 7
|
||||
rollback;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
begin;
|
||||
update bug49164 set c=7;
|
||||
SET tx_isolation = 'READ-COMMITTED';
|
||||
begin;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
commit;
|
||||
begin;
|
||||
update bug49164 set c=6 where a=1 and b=1;
|
||||
rollback;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
commit;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 6
|
||||
2 2 2
|
||||
3 3 3
|
||||
drop table bug49164;
|
@ -36,7 +36,7 @@ a b c
|
||||
commit;
|
||||
select * from bug49164;
|
||||
a b c
|
||||
1 1 6
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
drop table bug49164;
|
||||
|
@ -9,7 +9,6 @@ SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 139 Too big row
|
||||
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
|
||||
Error 1030 Got error 139 from storage engine
|
||||
DROP TABLE bug53591;
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
SET GLOBAL innodb_file_format_check=Antelope;
|
||||
|
@ -21,7 +21,7 @@ ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
|
||||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
||||
WHERE TABLE_NAME='bug54679';
|
||||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
|
||||
bug54679 Compressed KEY_BLOCK_SIZE=1
|
||||
bug54679 Compressed key_block_size=1
|
||||
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
|
||||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
|
||||
SHOW WARNINGS;
|
||||
@ -38,7 +38,7 @@ ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
|
||||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
||||
WHERE TABLE_NAME='bug54679';
|
||||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
|
||||
bug54679 Compressed row_format=REDUNDANT KEY_BLOCK_SIZE=2
|
||||
bug54679 Compressed row_format=REDUNDANT key_block_size=2
|
||||
SET GLOBAL innodb_file_format=Antelope;
|
||||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
|
||||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478)
|
||||
|
@ -2311,8 +2311,8 @@ select_type SIMPLE
|
||||
table t1
|
||||
type index
|
||||
possible_keys NULL
|
||||
key b
|
||||
key_len 10
|
||||
key PRIMARY
|
||||
key_len 4
|
||||
ref NULL
|
||||
rows 10
|
||||
Extra Using index
|
||||
|
@ -10,4 +10,13 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
innodb-use-sys-malloc : Waiting for buyfix from Percona for LP#612600
|
||||
innodb-use-sys-malloc : Waiting for bugfix from Percona for LP#612600
|
||||
innodb_plugin.innodb-autoinc-44030 : Waiting for merge with XtraDB
|
||||
innodb_bug48024 : Waiting for merge with XtraDB
|
||||
innodb_bug49164 : Waiting for merge with XtraDB
|
||||
innodb_bug51378 : Waiting for merge with XtraDB
|
||||
innodb_bug51920 : Waiting for merge with XtraDB
|
||||
innodb_bug52663 : Waiting for merge with XtraDB
|
||||
innodb_bug54044 : Waiting for merge with XtraDB
|
||||
innodb_bug52745 : Waiting for merge with XtraDB
|
||||
innodb_bug54679 : Waiting for merge with XtraDB
|
||||
|
18
mysql-test/suite/innodb_plugin/t/innodb-index-ip.test
Normal file
18
mysql-test/suite/innodb_plugin/t/innodb-index-ip.test
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Tests from innodb.test that has different results for innodb_plugin & xtradb.
|
||||
|
||||
-- source include/have_real_innodb_plugin.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
show create table t1;
|
||||
drop table t1;
|
18
mysql-test/suite/innodb_plugin/t/innodb-index-xb.test
Normal file
18
mysql-test/suite/innodb_plugin/t/innodb-index-xb.test
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Tests from innodb.test that has different results for innodb_plugin & xtradb.
|
||||
|
||||
-- source include/have_xtradb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
show create table t1;
|
||||
drop table t1;
|
@ -141,9 +141,6 @@ show create table t4;
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
alter table t3 add constraint dc foreign key (a) references t1(a);
|
||||
show create table t3;
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t2 drop index b, add index (b);
|
||||
show create table t2;
|
||||
--error ER_ROW_IS_REFERENCED_2
|
||||
delete from t1;
|
||||
@ -186,15 +183,6 @@ alter table t1 add index (b);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
|
||||
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (b), add unique index (c), add unique index (d);
|
||||
--error ER_DUP_ENTRY
|
||||
alter table t1 add unique index (c), add unique index (b), add index (d);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
|
||||
insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
|
||||
alter table t1 add unique index (b);
|
||||
|
35
mysql-test/suite/innodb_plugin/t/innodb-ip.test
Normal file
35
mysql-test/suite/innodb_plugin/t/innodb-ip.test
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Tests from innodb.test that has different results for innodb_plugin.
|
||||
|
||||
-- source include/have_real_innodb_plugin.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
sca_code char(6) NOT NULL,
|
||||
cat_code char(6) NOT NULL,
|
||||
sca_desc varchar(50),
|
||||
lan_code char(2) NOT NULL,
|
||||
sca_pic varchar(100),
|
||||
sca_sdesc varchar(50),
|
||||
sca_sch_desc varchar(16),
|
||||
PRIMARY KEY (sca_code, cat_code, lan_code),
|
||||
INDEX sca_pic (sca_pic)
|
||||
) engine = innodb ;
|
||||
|
||||
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
||||
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
35
mysql-test/suite/innodb_plugin/t/innodb-xb.test
Normal file
35
mysql-test/suite/innodb_plugin/t/innodb-xb.test
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Tests from innodb.test that has different results for innodb_plugin.
|
||||
|
||||
-- source include/have_xtradb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
sca_code char(6) NOT NULL,
|
||||
cat_code char(6) NOT NULL,
|
||||
sca_desc varchar(50),
|
||||
lan_code char(2) NOT NULL,
|
||||
sca_pic varchar(100),
|
||||
sca_sdesc varchar(50),
|
||||
sca_sch_desc varchar(16),
|
||||
PRIMARY KEY (sca_code, cat_code, lan_code),
|
||||
INDEX sca_pic (sca_pic)
|
||||
) engine = innodb ;
|
||||
|
||||
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
|
||||
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
#--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
@ -437,16 +437,6 @@ alter table t1 add index sca_pic (cat_code, sca_pic);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where cat_code='E';
|
||||
|
||||
# this should be fixed by MySQL (see Bug #51451)
|
||||
--error ER_WRONG_NAME_FOR_INDEX
|
||||
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
|
||||
alter table t1 drop index sca_pic;
|
||||
alter table t1 add index (sca_pic, cat_code);
|
||||
select count(*) from t1 where sca_code='PD' and sca_pic is null;
|
||||
select count(*) from t1 where sca_pic >= 'n';
|
||||
select sca_pic from t1 where sca_pic is null;
|
||||
update t1 set sca_pic="test" where sca_pic is null;
|
||||
delete from t1 where sca_code='pd';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
|
96
mysql-test/suite/innodb_plugin/t/innodb_bug21704-xb.test
Normal file
96
mysql-test/suite/innodb_plugin/t/innodb_bug21704-xb.test
Normal file
@ -0,0 +1,96 @@
|
||||
-- source include/have_xtradb.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#21704: Renaming column does not update FK definition.
|
||||
--echo #
|
||||
|
||||
--echo
|
||||
--echo # Test that it's not possible to rename columns participating in a
|
||||
--echo # foreign key (either in the referencing or referenced table).
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
|
||||
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
|
||||
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
|
||||
ROW_FORMAT=COMPACT ENGINE=INNODB;
|
||||
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
|
||||
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
|
||||
|
||||
--echo
|
||||
--echo # Test renaming the column in the referenced table.
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 CHANGE a c INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Test renaming the column in the referencing table
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t2 CHANGE a c INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Test with self-referential constraints
|
||||
--echo
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t3 CHANGE a d INT;
|
||||
|
||||
# mysqltest first does replace_regex, then replace_result
|
||||
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
# Embedded server doesn't chdir to data directory
|
||||
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t3 CHANGE b d INT;
|
||||
|
||||
--echo # Ensure that online column rename works.
|
||||
|
||||
--enable_info
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
--disable_info
|
||||
|
||||
--echo
|
||||
--echo # Cleanup.
|
||||
--echo
|
||||
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
@ -1,4 +1,4 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
-- source include/have_real_innodb_plugin.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#21704: Renaming column does not update FK definition.
|
||||
|
@ -1,4 +1,7 @@
|
||||
-- source include/have_innodb_plugin.inc
|
||||
#
|
||||
# XtraDB doesn't have this problem
|
||||
#
|
||||
-- source include/have_real_innodb_plugin.inc
|
||||
|
||||
let $file_format=`select @@innodb_file_format`;
|
||||
let $file_format_check=`select @@innodb_file_format_check`;
|
||||
|
@ -6537,6 +6537,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
uint *index_add_buffer= NULL;
|
||||
uint candidate_key_count= 0;
|
||||
bool no_pk;
|
||||
ulong explicit_used_fields= 0;
|
||||
DBUG_ENTER("mysql_alter_table");
|
||||
|
||||
/*
|
||||
@ -6807,6 +6808,7 @@ view_err:
|
||||
change the row format in update_create_info().
|
||||
*/
|
||||
create_info->used_fields|= HA_CREATE_USED_ROW_FORMAT;
|
||||
explicit_used_fields|= HA_CREATE_USED_ROW_FORMAT;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("old type: %s new type: %s",
|
||||
@ -6967,6 +6969,9 @@ view_err:
|
||||
if (mysql_prepare_alter_table(thd, table, create_info, alter_info))
|
||||
goto err;
|
||||
|
||||
/* Remove markers set for update_create_info */
|
||||
create_info->used_fields&= ~explicit_used_fields;
|
||||
|
||||
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
|
||||
need_copy_table= alter_info->change_level;
|
||||
|
||||
|
@ -5577,7 +5577,8 @@ ha_innobase::change_active_index(
|
||||
keynr);
|
||||
/* The caller seems to ignore this. Thus, we must check
|
||||
this again in row_search_for_mysql(). */
|
||||
DBUG_RETURN(2);
|
||||
DBUG_RETURN(convert_error_code_to_mysql(DB_MISSING_HISTORY,
|
||||
0, NULL));
|
||||
}
|
||||
|
||||
ut_a(prebuilt->search_tuple != 0);
|
||||
|
@ -10925,8 +10925,8 @@ mysql_declare_plugin(xtradb)
|
||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
||||
&innobase_storage_engine,
|
||||
innobase_hton_name,
|
||||
"Innobase Oy",
|
||||
"Supports transactions, row-level locking, and foreign keys",
|
||||
"Percona",
|
||||
"XtraDB engine based on InnoDB plugin. Supports transactions, row-level locking, and foreign keys",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
innobase_init, /* Plugin Init */
|
||||
NULL, /* Plugin Deinit */
|
||||
|
Reference in New Issue
Block a user