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

Imported Upstream version 5.5.46

parent 3f8c7c93
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
# Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE # Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE
# WITH FOREIGN KEY CONSTRAINT. # WITH FOREIGN KEY CONSTRAINT.
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
CREATE TABLE PERSON ( CREATE TABLE PERSON (
......
-- source include/have_innodb.inc
-- source include/not_embedded.inc
#
# Bug #68148: drop index on a foreign key column leads to missing table
# MDEV-8845: Table disappear after modifying FK
#
set global innodb_file_per_table=1;
CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE `main` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ref_id1` int(11) NOT NULL,
`ref_id2` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_1` (`ref_id1`,`ref_id2`),
KEY `FK_set_out_analysis_route_id` (`ref_id2`),
CONSTRAINT `FK_1` FOREIGN KEY (`ref_id1`) REFERENCES `ref_table1` (`id`) ,
CONSTRAINT `FK_2` FOREIGN KEY (`ref_id2`) REFERENCES `ref_table2` (`id`)
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
DROP INDEX `idx_1` ON `main`;
SHOW TABLES;
--echo # restart and see if we can still access the main table
--source include/restart_mysqld.inc
# This is required to access the table
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `main` ADD INDEX `idx_1` (`ref_id1`);
SHOW CREATE TABLE `main`;
DROP TABLE main, ref_table1, ref_table2;
--ignore-builtin-innodb
--loose-innodb
--source include/not_embedded.inc
--source include/not_windows.inc
if (!$HA_INNODB_SO) {
--skip Need InnoDB plugin
}
#
# MDEV-8474: InnoDB sets per-connection data unsafely
# Below test caused hang
#
install plugin innodb soname 'ha_innodb';
create table t1(a int not null primary key) engine=innodb;
connect (con1, localhost, root);
connection con1;
begin;
insert into t1 values(1);
connection default;
flush tables;
send uninstall plugin innodb;
connection con1;
select sleep(1);
disconnect con1;
connection default;
reap;
--source include/restart_mysqld.inc
drop table t1;
#
# Another test that caused hang.
#
connect (con1, localhost, root);
connection con1;
install plugin innodb soname 'ha_innodb';
create table t2(a int not null primary key) engine=innodb;
insert into t2 values(1);
drop table t2;
connection default;
send uninstall plugin innodb;
connection con1;
select sleep(1);
disconnect con1;
connection default;
reap;
--source include/restart_mysqld.inc
...@@ -6,6 +6,12 @@ if (`select plugin_auth_version <= "5.5.43-MariaDB-37.2" from information_schema ...@@ -6,6 +6,12 @@ if (`select plugin_auth_version <= "5.5.43-MariaDB-37.2" from information_schema
# Embedded server does not support restarting. # Embedded server does not support restarting.
--source include/not_embedded.inc --source include/not_embedded.inc
# MDEV-8841 - close tables opened by previous tests,
# so they don't get marked crashed when the server gets crashed
--disable_query_log
FLUSH TABLES;
--enable_query_log
CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connect (con1,localhost,root); connect (con1,localhost,root);
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_sjis.inc --source include/have_sjis.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--character_set sjis --character_set sjis
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ucs2.inc --source include/have_ucs2.inc
--source include/have_innodb.inc --source include/have_innodb.inc
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_ujis.inc --source include/have_ujis.inc
--source include/have_innodb.inc --source include/have_innodb.inc
......
#Server variable option 'lower_case_table_names' sets '0' as default value
#in case sensitive filesystem. Using 'lower_case_table_names=0' in case of
#insensitive filsystem is not allowed.
-- source include/have_case_sensitive_file_system.inc
--source include/have_utf8.inc --source include/have_utf8.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--disable_warnings --disable_warnings
......
#
# 18075170 - sql node restart required to avoid deadlock after
# restore
#
CREATE TABLE t1 (id INT) ENGINE=NDBCluster;
CREATE TABLE t2 (id INT) ENGINE=NDBCluster;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
DROP TABLE t1;
DROP TABLE t2;
SET autocommit = 0;
SELECT * FROM t1;
id
1
SELECT * FROM t2;
id
1
ROLLBACK;
SET autocommit = 1;
drop table t1;
drop table t2;
SET autocommit = 0;
SELECT * FROM t1;
id
1
SELECT * FROM t2;
id
1
ALTER TABLE t1 ADD val INT;
ROLLBACK;
SET autocommit = 1;
drop table t1;
drop table t2;
-- source include/have_ndb.inc
-- source include/count_sessions.inc
--echo #
--echo # 18075170 - sql node restart required to avoid deadlock after
--echo # restore
--echo #
# Test Auto Discover option within a transaction
# and make sure the transaction is not broken.
CREATE TABLE t1 (id INT) ENGINE=NDBCluster;
CREATE TABLE t2 (id INT) ENGINE=NDBCluster;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
-- source include/ndb_backup.inc
DROP TABLE t1;
DROP TABLE t2;
-- source include/ndb_restore_master.inc
SET autocommit = 0;
SELECT * FROM t1;
# Without fix below select was resulting in DEADLOCK error. With fix select
# should succeed.
SELECT * FROM t2;
ROLLBACK;
SET autocommit = 1;
drop table t1;
drop table t2;
#
# Checking lock preservation in transaction
#
# Using existing backup to create the scenario. Tables are deleted as part of
# above test cleanup. Thus restoring the backup will bring the system to
# required state.
-- source include/ndb_restore_master.inc
SET autocommit = 0;
SELECT * FROM t1;
SELECT * FROM t2;
connect(con2, localhost, root);
--SEND ALTER TABLE t1 ADD val INT
connection default;
# Alter from con2 will be in waiting state as there is a lock on t1 from
# default connection due to active transaction. We check for this condition
# then releasing the lock by rollbacking active transaction.
let $wait_condition=
SELECT count(*) = 1 FROM information_schema.processlist WHERE state
LIKE "Waiting%" AND info = "ALTER TABLE t1 ADD val INT";
--source include/wait_condition.inc
ROLLBACK;
SET autocommit = 1;
connection con2;
--REAP
disconnect con2;
connection default;
drop table t1;
drop table t2;
# Wait till all disconnects are completed
-- source include/wait_until_count_sessions.inc
...@@ -38,7 +38,7 @@ spins ...@@ -38,7 +38,7 @@ spins
NULL NULL
select * from performance_schema.setup_timers where name='wait'; select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME NAME TIMER_NAME
wait CYCLE wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
...@@ -53,7 +53,7 @@ spins ...@@ -53,7 +53,7 @@ spins
NULL NULL
select * from performance_schema.setup_timers where name='wait'; select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME NAME TIMER_NAME
wait CYCLE wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
......
...@@ -34,6 +34,7 @@ show status like "Qcache_hits"; ...@@ -34,6 +34,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1; select spins from performance_schema.events_waits_current order by event_name limit 1;
--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait'; select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
...@@ -42,6 +43,7 @@ show status like "Qcache_hits"; ...@@ -42,6 +43,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1; select spins from performance_schema.events_waits_current order by event_name limit 1;
--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait'; select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
......
select plugin_status from information_schema.plugins where plugin_name='feedback'; select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status plugin_status
ACTIVE ACTIVE
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1
FEEDBACK version 1.1 FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
......
select plugin_status from information_schema.plugins where plugin_name='feedback'; select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status plugin_status
ACTIVE ACTIVE
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 2
FEEDBACK version 1.1 FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
......
...@@ -4,7 +4,24 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'fe ...@@ -4,7 +4,24 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'fe
} }
select plugin_status from information_schema.plugins where plugin_name='feedback'; select plugin_status from information_schema.plugins where plugin_name='feedback';
# Every SELECT from INFORMATION_SCHEMA.FEEDBACK increases the value of 'FEEDBACK used'.
# We cannot record the actual value, because the test can be executed more than once,
# but we can check that the value indeed increases as expected.
# There is still a room for some race condition, e.g. if at the very moment
# between first SELECT to store the value and the next SELECT to check that it increases,
# the feedback plugin is activated. But the probability of it is close to 0,
# so lets get back to it if it ever happens.
# Lets say the plugin was used X times before this SELECT
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
# Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
# Now when we are happy with 'FEEDBACK used', we can check everything else
--replace_result https http --replace_result https http
--sorted_result --sorted_result
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
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