初版
This commit is contained in:
12
build/lib/mysql/mysql-test/suite/federated/disabled.def
Normal file
12
build/lib/mysql/mysql-test/suite/federated/disabled.def
Normal file
@@ -0,0 +1,12 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
federated_transactions : Bug#11746899 Transactions do not work
|
||||
2185
build/lib/mysql/mysql-test/suite/federated/federated.result
Normal file
2185
build/lib/mysql/mysql-test/suite/federated/federated.result
Normal file
File diff suppressed because it is too large
Load Diff
2002
build/lib/mysql/mysql-test/suite/federated/federated.test
Normal file
2002
build/lib/mysql/mysql-test/suite/federated/federated.test
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.archive_table;
|
||||
CREATE TABLE federated.archive_table (
|
||||
`id` int(4) NOT NULL,
|
||||
`name` varchar(54) default NULL
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(4) NOT NULL,
|
||||
`name` varchar(54) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table';
|
||||
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (2, 'bar');
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 foo
|
||||
2 bar
|
||||
DELETE FROM federated.t1 WHERE id = 1;
|
||||
ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 foo
|
||||
2 bar
|
||||
UPDATE federated.t1 SET name='baz' WHERE id = 1;
|
||||
ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 foo
|
||||
2 bar
|
||||
DROP TABLE federated.t1;
|
||||
DROP TABLE federated.archive_table;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,58 @@
|
||||
source include/have_archive.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.archive_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE federated.archive_table (
|
||||
`id` int(4) NOT NULL,
|
||||
`name` varchar(54) default NULL
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
--enable_warnings
|
||||
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.t1 (
|
||||
`id` int(4) NOT NULL,
|
||||
`name` varchar(54) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table';
|
||||
|
||||
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (2, 'bar');
|
||||
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
--error 1296
|
||||
DELETE FROM federated.t1 WHERE id = 1;
|
||||
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
|
||||
--error 1296
|
||||
UPDATE federated.t1 SET name='baz' WHERE id = 1;
|
||||
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
|
||||
# --error 1296
|
||||
# TRUNCATE federated.t1;
|
||||
#
|
||||
# SELECT * from federated.t1;
|
||||
|
||||
DROP TABLE federated.t1;
|
||||
connection slave;
|
||||
DROP TABLE federated.archive_table;
|
||||
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
CREATE TABLE federated.bug_13118_table (
|
||||
`foo` integer,
|
||||
`bar` integer
|
||||
);
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`foo` integer,
|
||||
`bar` integer
|
||||
) ENGINE="FEDERATED"
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_13118_table';
|
||||
SELECT * from federated.t1;
|
||||
foo bar
|
||||
INSERT INTO federated.t1 VALUES (1,1);
|
||||
SELECT * FROM federated.t1;
|
||||
foo bar
|
||||
1 1
|
||||
INSERT INTO federated.t1 VALUES (1,1);
|
||||
SELECT * FROM federated.t1;
|
||||
foo bar
|
||||
1 1
|
||||
1 1
|
||||
DROP TABLE federated.t1;
|
||||
DROP TABLE federated.bug_13118_table;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,41 @@
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE federated.bug_13118_table (
|
||||
`foo` integer,
|
||||
`bar` integer
|
||||
);
|
||||
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
--enable_warnings
|
||||
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.t1 (
|
||||
`foo` integer,
|
||||
`bar` integer
|
||||
) ENGINE="FEDERATED"
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_13118_table';
|
||||
|
||||
SELECT * from federated.t1;
|
||||
|
||||
INSERT INTO federated.t1 VALUES (1,1);
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
INSERT INTO federated.t1 VALUES (1,1);
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
|
||||
DROP TABLE federated.t1;
|
||||
connection slave;
|
||||
DROP TABLE federated.bug_13118_table;
|
||||
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int auto_increment primary key,
|
||||
`value` int
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO federated.t1 SET value=1;
|
||||
INSERT INTO federated.t1 SET value=2;
|
||||
INSERT INTO federated.t1 SET value=2;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int auto_increment primary key,
|
||||
`value` int
|
||||
) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
|
||||
SELECT * from federated.t1;
|
||||
id value
|
||||
1 1
|
||||
2 2
|
||||
3 2
|
||||
INSERT INTO federated.t1 SET value=4;
|
||||
SELECT LAST_INSERT_ID();
|
||||
LAST_INSERT_ID()
|
||||
4
|
||||
|
||||
5 inserted
|
||||
6 inserted
|
||||
|
||||
7 inserted
|
||||
8 inserted
|
||||
SELECT * from federated.t1;
|
||||
id value
|
||||
1 1
|
||||
2 2
|
||||
3 2
|
||||
4 4
|
||||
5 54
|
||||
6 55
|
||||
7 54
|
||||
8 55
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,62 @@
|
||||
# Check that path to the specific test program has been setup
|
||||
if (`select LENGTH("$MYSQL_BUG25714") = 0`)
|
||||
{
|
||||
skip Need bug25714 test program;
|
||||
}
|
||||
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection master;
|
||||
# Disable concurrent inserts to avoid test failures when reading
|
||||
# data from concurrent connections (insert might return before
|
||||
# the data is actually in the table).
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
|
||||
connection slave;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int auto_increment primary key,
|
||||
`value` int
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO federated.t1 SET value=1;
|
||||
INSERT INTO federated.t1 SET value=2;
|
||||
INSERT INTO federated.t1 SET value=2;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
--enable_warnings
|
||||
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.t1 (
|
||||
`id` int auto_increment primary key,
|
||||
`value` int
|
||||
) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
|
||||
|
||||
SELECT * from federated.t1;
|
||||
|
||||
INSERT INTO federated.t1 SET value=4;
|
||||
|
||||
SELECT LAST_INSERT_ID();
|
||||
|
||||
--exec $MYSQL_BUG25714 $SLAVE_MYPORT
|
||||
--exec $MYSQL_BUG25714 $MASTER_MYPORT
|
||||
|
||||
SELECT * from federated.t1;
|
||||
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
connection slave;
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
|
||||
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
|
||||
#
|
||||
# Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
|
||||
# when encountering a federated table that cannot connect to its remote table.
|
||||
#
|
||||
# The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
|
||||
# the remote connection error and push a warning instead. This allows the SELECT operation
|
||||
# to complete while still indicating a problem. This fix applies to any non-fatal system
|
||||
# error that occurs during a query against I_S.TABLES.de
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE IF NOT EXISTS realdb;
|
||||
DROP TABLE IF EXISTS realdb.t0;
|
||||
DROP TABLE IF EXISTS federated.t0;
|
||||
#
|
||||
# Create the base table to be referenced
|
||||
#
|
||||
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
|
||||
#
|
||||
# Create a federated table with a bogus port number
|
||||
#
|
||||
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
|
||||
#
|
||||
# Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
|
||||
#
|
||||
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
|
||||
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
|
||||
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
|
||||
federated t0 BASE TABLE FEDERATED NULL 0 Unable to connect to foreign data source: Can't connect to MySQL server on '127.
|
||||
realdb t0 BASE TABLE MyISAM Dynamic 0 0
|
||||
Warnings:
|
||||
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
|
||||
#
|
||||
# Create a MyISAM table then corrupt the file
|
||||
#
|
||||
USE realdb;
|
||||
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
|
||||
#
|
||||
# Corrupt the MyISAM table by deleting the base file
|
||||
#
|
||||
#
|
||||
# Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
|
||||
#
|
||||
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
|
||||
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
||||
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
|
||||
realdb t1 BASE TABLE NULL NULL NULL NULL Can't find file: 't1' (errno: 2)
|
||||
Warnings:
|
||||
Warning 1017 Can't find file: 't1' (errno: 2)
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Warning 1017 Can't find file: 't1' (errno: 2)
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
DROP TABLE IF EXISTS realdb.t0;
|
||||
DROP TABLE IF EXISTS federated.t0;
|
||||
DROP DATABASE realdb;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,74 @@
|
||||
--echo #
|
||||
--echo # Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
|
||||
--echo #
|
||||
--echo # Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
|
||||
--echo # when encountering a federated table that cannot connect to its remote table.
|
||||
--echo #
|
||||
--echo # The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
|
||||
--echo # the remote connection error and push a warning instead. This allows the SELECT operation
|
||||
--echo # to complete while still indicating a problem. This fix applies to any non-fatal system
|
||||
--echo # error that occurs during a query against I_S.TABLES.de
|
||||
|
||||
--source suite/federated/include/federated.inc
|
||||
|
||||
--disable_warnings
|
||||
CREATE DATABASE IF NOT EXISTS realdb;
|
||||
# Federated database exists
|
||||
DROP TABLE IF EXISTS realdb.t0;
|
||||
DROP TABLE IF EXISTS federated.t0;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Create the base table to be referenced
|
||||
--echo #
|
||||
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
|
||||
|
||||
--echo #
|
||||
--echo # Create a federated table with a bogus port number
|
||||
--echo #
|
||||
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
|
||||
|
||||
#--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
|
||||
--echo #
|
||||
--echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
|
||||
--echo #
|
||||
# Remove O/S-specific socket error
|
||||
--replace_regex /\(.*\)/(socket errno)/
|
||||
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
|
||||
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
|
||||
|
||||
# Remove O/S-specific socket error
|
||||
--replace_regex /\(.*\)/(socket errno)/
|
||||
SHOW WARNINGS;
|
||||
|
||||
--echo #
|
||||
--echo # Create a MyISAM table then corrupt the file
|
||||
--echo #
|
||||
USE realdb;
|
||||
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
|
||||
--echo #
|
||||
--echo # Corrupt the MyISAM table by deleting the base file
|
||||
--echo #
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
--remove_file $MYSQLD_DATADIR/realdb/t1.MYD
|
||||
--remove_file $MYSQLD_DATADIR/realdb/t1.MYI
|
||||
|
||||
--echo #
|
||||
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
|
||||
--echo #
|
||||
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
|
||||
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
|
||||
|
||||
SHOW WARNINGS;
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS realdb.t0;
|
||||
DROP TABLE IF EXISTS federated.t0;
|
||||
DROP DATABASE realdb;
|
||||
--enable_warnings
|
||||
|
||||
--source suite/federated/include/federated_cleanup.inc
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
#
|
||||
# Bug#47525: MySQL crashed (Federated)
|
||||
#
|
||||
# Switch to slave
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
# Switch to master
|
||||
CREATE TABLE t1(a INT) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
# Start a asynchronous reload
|
||||
# Wait for tables to be closed
|
||||
# Ensure that the server didn't crash
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
# Drop tables on master and slave
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1;
|
||||
# Federated cleanup
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,39 @@
|
||||
--source include/have_debug.inc
|
||||
--source suite/federated/include/federated.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#47525: MySQL crashed (Federated)
|
||||
--echo #
|
||||
|
||||
connection slave;
|
||||
--echo # Switch to slave
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
connection master;
|
||||
--echo # Switch to master
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE t1(a INT) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Start a asynchronous reload
|
||||
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= refresh 2>&1
|
||||
|
||||
--echo # Wait for tables to be closed
|
||||
let $show_statement= SHOW STATUS LIKE 'Open_tables';
|
||||
let $field= Value;
|
||||
let $condition= = '0';
|
||||
--source include/wait_show_condition.inc
|
||||
|
||||
--echo # Ensure that the server didn't crash
|
||||
SELECT * FROM t1;
|
||||
--echo # Drop tables on master and slave
|
||||
DROP TABLE t1;
|
||||
connection slave;
|
||||
DROP TABLE t1;
|
||||
|
||||
connection default;
|
||||
--echo # Federated cleanup
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
@@ -0,0 +1,25 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
create table federated.t1 (a int primary key, b varchar(64))
|
||||
engine=myisam;
|
||||
create table federated.t1 (a int primary key, b varchar(64))
|
||||
engine=federated
|
||||
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
|
||||
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
select * from federated.t1;
|
||||
a b
|
||||
1 Larry
|
||||
2 Curly
|
||||
truncate federated.t1;
|
||||
alter table federated.t1 engine=innodb;
|
||||
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
select * from federated.t1;
|
||||
a b
|
||||
drop table federated.t1;
|
||||
drop table federated.t1;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
@@ -0,0 +1,39 @@
|
||||
# NOTE: Keep any include/ files that will kill / skip a test BEFORE any others
|
||||
# having federated.inc before have_innodb.inc allows for an orphaned database
|
||||
# that can cause other tests to fail.
|
||||
# See Bug #40645 Test main.federated_innodb does not always clean up after itself
|
||||
|
||||
source include/have_innodb.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
#
|
||||
# Bug#25513 Federated transaction failures
|
||||
#
|
||||
connection slave;
|
||||
create table federated.t1 (a int primary key, b varchar(64))
|
||||
engine=myisam;
|
||||
connection master;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval create table federated.t1 (a int primary key, b varchar(64))
|
||||
engine=federated
|
||||
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
|
||||
|
||||
--error ER_DUP_KEY
|
||||
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
||||
select * from federated.t1;
|
||||
|
||||
connection slave;
|
||||
truncate federated.t1;
|
||||
alter table federated.t1 engine=innodb;
|
||||
connection master;
|
||||
|
||||
--error ER_DUP_KEY
|
||||
insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
|
||||
select * from federated.t1;
|
||||
|
||||
drop table federated.t1;
|
||||
connection slave;
|
||||
drop table federated.t1;
|
||||
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
@@ -0,0 +1,19 @@
|
||||
CREATE TABLE t2(a int);
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
Warnings:
|
||||
Warning 1286 Unknown table engine 'FEDERATED'
|
||||
Warning 1266 Using storage engine MyISAM for table 't1'
|
||||
DROP TABLE t1;
|
||||
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
|
||||
INSTALL PLUGIN FEDERATED SONAME 'FEDERATED_PLUGIN';
|
||||
ERROR HY000: Function 'FEDERATED' already exists
|
||||
UNINSTALL PLUGIN federated;
|
||||
INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN';
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
UNINSTALL PLUGIN federated;
|
||||
UNINSTALL PLUGIN federated;
|
||||
ERROR 42000: PLUGIN federated does not exist
|
||||
DROP TABLE t2;
|
||||
@@ -0,0 +1,37 @@
|
||||
--source include/have_federated_plugin.inc
|
||||
|
||||
# Uninstall will not uninstall if ps has been used
|
||||
--disable_ps_protocol
|
||||
|
||||
connect (master,localhost,root,,test,$MASTER_MYPORT,);
|
||||
connect (slave,localhost,root,,test,$SLAVE_MYPORT,);
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t2(a int);
|
||||
|
||||
connection slave;
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
--error ER_UDF_EXISTS
|
||||
eval INSTALL PLUGIN FEDERATED SONAME '$FEDERATED_PLUGIN';
|
||||
|
||||
UNINSTALL PLUGIN federated;
|
||||
|
||||
--replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN
|
||||
eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN';
|
||||
|
||||
CREATE TABLE t1(a int) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2';
|
||||
DROP TABLE t1;
|
||||
|
||||
UNINSTALL PLUGIN federated;
|
||||
--error ER_SP_DOES_NOT_EXIST
|
||||
UNINSTALL PLUGIN federated;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t2;
|
||||
@@ -0,0 +1,280 @@
|
||||
CREATE DATABASE federated;
|
||||
CREATE DATABASE federated;
|
||||
create database first_db;
|
||||
create database second_db;
|
||||
use first_db;
|
||||
DROP TABLE IF EXISTS first_db.t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE first_db.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
DROP TABLE IF EXISTS first_db.t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE first_db.t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
use second_db;
|
||||
DROP TABLE IF EXISTS second_db.t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE second_db.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
DROP TABLE IF EXISTS second_db.t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE second_db.t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
drop server if exists 'server_one';
|
||||
create server 'server_one' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'first_db',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT SLAVE_PORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
drop server if exists 'server_two';
|
||||
create server 'server_two' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'second_db',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT SLAVE_PORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
select * from mysql.servers order by Server_name;
|
||||
Server_name Host Db Username Password Port Socket Wrapper Owner
|
||||
server_one 127.0.0.1 first_db root SLAVE_PORT mysql root
|
||||
server_two 127.0.0.1 second_db root SLAVE_PORT mysql root
|
||||
DROP TABLE IF EXISTS federated.old;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'old'
|
||||
CREATE TABLE federated.old (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t1';
|
||||
INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format');
|
||||
SELECT * FROM federated.old;
|
||||
id name
|
||||
1 federated.old-> first_db.t1, url format
|
||||
DROP TABLE IF EXISTS federated.old2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'old2'
|
||||
CREATE TABLE federated.old2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t2';
|
||||
INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format');
|
||||
SELECT * FROM federated.old2;
|
||||
id name
|
||||
1 federated.old2-> first_db.t2, url format
|
||||
DROP TABLE IF EXISTS federated.urldb2t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'urldb2t1'
|
||||
CREATE TABLE federated.urldb2t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t1';
|
||||
INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format');
|
||||
SELECT * FROM federated.urldb2t1;
|
||||
id name
|
||||
1 federated.urldb2t1 -> second_db.t1, url format
|
||||
DROP TABLE IF EXISTS federated.urldb2t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'urldb2t2'
|
||||
CREATE TABLE federated.urldb2t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t2';
|
||||
INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format');
|
||||
SELECT * FROM federated.urldb2t2;
|
||||
id name
|
||||
1 federated.urldb2t2 -> second_db.t2, url format
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='server_one';
|
||||
INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1');
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 federated.old-> first_db.t1, url format
|
||||
1 server_one, new scheme, first_db.t1
|
||||
DROP TABLE IF EXISTS federated.whatever;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'whatever'
|
||||
CREATE TABLE federated.whatever (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='server_one/t1';
|
||||
INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1');
|
||||
SELECT * FROM federated.whatever;
|
||||
id name
|
||||
1 federated.old-> first_db.t1, url format
|
||||
1 server_one, new scheme, first_db.t1
|
||||
1 server_one, new scheme, whatever, first_db.t1
|
||||
ALTER SERVER 'server_one' options(DATABASE 'second_db');
|
||||
INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1');
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 federated.urldb2t1 -> second_db.t1, url format
|
||||
1 server_two, new scheme, second_db.t1
|
||||
INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1');
|
||||
SELECT * FROM federated.whatever;
|
||||
id name
|
||||
1 federated.urldb2t1 -> second_db.t1, url format
|
||||
1 server_two, new scheme, second_db.t1
|
||||
1 server_two, new scheme, whatever, second_db.t1
|
||||
drop table federated.t1;
|
||||
drop server 'server_one';
|
||||
drop server 'server_two';
|
||||
select * from mysql.servers order by Server_name;
|
||||
Server_name Host Db Username Password Port Socket Wrapper Owner
|
||||
drop table first_db.t1;
|
||||
drop table second_db.t1;
|
||||
drop database first_db;
|
||||
drop database second_db;
|
||||
create database db_legitimate;
|
||||
create database db_bogus;
|
||||
use db_legitimate;
|
||||
CREATE TABLE db_legitimate.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
);
|
||||
INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate');
|
||||
use db_bogus;
|
||||
CREATE TABLE db_bogus.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
;
|
||||
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
|
||||
create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT SLAVE_PORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
create user guest_select@localhost;
|
||||
grant select on federated.* to guest_select@localhost;
|
||||
create user guest_super@localhost;
|
||||
grant select,SUPER,RELOAD on *.* to guest_super@localhost;
|
||||
create user guest_usage@localhost;
|
||||
grant usage on *.* to guest_usage@localhost;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
) ENGINE = FEDERATED CONNECTION = 's1';
|
||||
select * from federated.t1;
|
||||
id name
|
||||
1 this is legitimate
|
||||
alter server s1 options (database 'db_bogus');
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
id name
|
||||
1 this is legitimate
|
||||
alter server s1 options (database 'db_bogus');
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
id name
|
||||
1 this is legitimate
|
||||
alter server s1 options (database 'db_bogus');
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
id name
|
||||
2 this is bogus
|
||||
drop server if exists 's1';
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT SLAVE_PORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
drop server 's1';
|
||||
create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT SLAVE_PORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
id name
|
||||
1 this is legitimate
|
||||
drop database db_legitimate;
|
||||
drop database db_bogus;
|
||||
drop user guest_super@localhost;
|
||||
drop user guest_usage@localhost;
|
||||
drop user guest_select@localhost;
|
||||
drop table federated.t1;
|
||||
drop server 's1';
|
||||
create server 's1' foreign data wrapper 'mysql' options (port 3306);
|
||||
alter server 's1' options
|
||||
(host 'localhost', database '', user '',
|
||||
password '', socket '', owner '', port 3306);
|
||||
alter server 's1' options
|
||||
(host 'localhost', database 'database1', user '',
|
||||
password '', socket '', owner '', port 3306);
|
||||
drop server 's1';
|
||||
# End of 5.1 tests
|
||||
use test;
|
||||
create procedure p1 ()
|
||||
begin
|
||||
DECLARE v INT DEFAULT 0;
|
||||
DECLARE i INT;
|
||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
|
||||
SET i = sleep(5);
|
||||
WHILE v < 10000 do
|
||||
CREATE SERVER s
|
||||
FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
|
||||
ALTER SERVER s OPTIONS (USER 'Remote');
|
||||
DROP SERVER s;
|
||||
SET v = v + 1;
|
||||
END WHILE;
|
||||
END//
|
||||
use test;
|
||||
call p1();
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
drop server if exists s;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
336
build/lib/mysql/mysql-test/suite/federated/federated_server.test
Normal file
336
build/lib/mysql/mysql-test/suite/federated/federated_server.test
Normal file
@@ -0,0 +1,336 @@
|
||||
# WL #3031 This test tests the new servers table as well as
|
||||
# if federated can utilise the servers table
|
||||
-- source suite/federated/include/federated.inc
|
||||
|
||||
connection slave;
|
||||
create database first_db;
|
||||
create database second_db;
|
||||
|
||||
use first_db;
|
||||
|
||||
DROP TABLE IF EXISTS first_db.t1;
|
||||
CREATE TABLE first_db.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP TABLE IF EXISTS first_db.t2;
|
||||
CREATE TABLE first_db.t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
|
||||
use second_db;
|
||||
DROP TABLE IF EXISTS second_db.t1;
|
||||
CREATE TABLE second_db.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP TABLE IF EXISTS second_db.t2;
|
||||
CREATE TABLE second_db.t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1;
|
||||
|
||||
connection master;
|
||||
|
||||
drop server if exists 'server_one';
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval create server 'server_one' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'first_db',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT $SLAVE_MYPORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
|
||||
drop server if exists 'server_two';
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval create server 'server_two' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'second_db',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT $SLAVE_MYPORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
# Adding 'order by' clause here, in order to maintain consistent result out of the select query.
|
||||
#eval select * from mysql.servers;
|
||||
eval select * from mysql.servers order by Server_name;
|
||||
|
||||
DROP TABLE IF EXISTS federated.old;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.old (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t1';
|
||||
|
||||
INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format');
|
||||
|
||||
SELECT * FROM federated.old;
|
||||
|
||||
DROP TABLE IF EXISTS federated.old2;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.old2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t2';
|
||||
|
||||
INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format');
|
||||
SELECT * FROM federated.old2;
|
||||
|
||||
DROP TABLE IF EXISTS federated.urldb2t1;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.urldb2t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t1';
|
||||
INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format');
|
||||
SELECT * FROM federated.urldb2t1;
|
||||
|
||||
DROP TABLE IF EXISTS federated.urldb2t2;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.urldb2t2 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t2';
|
||||
INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format');
|
||||
SELECT * FROM federated.urldb2t2;
|
||||
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='server_one';
|
||||
|
||||
INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1');
|
||||
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
DROP TABLE IF EXISTS federated.whatever;
|
||||
CREATE TABLE federated.whatever (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='server_one/t1';
|
||||
INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1');
|
||||
SELECT * FROM federated.whatever;
|
||||
|
||||
ALTER SERVER 'server_one' options(DATABASE 'second_db');
|
||||
|
||||
# FLUSH TABLES is now unneccessary
|
||||
|
||||
INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1');
|
||||
SELECT * FROM federated.t1;
|
||||
|
||||
INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1');
|
||||
SELECT * FROM federated.whatever;
|
||||
|
||||
drop table federated.t1;
|
||||
|
||||
drop server 'server_one';
|
||||
drop server 'server_two';
|
||||
# Adding 'order by' clause here, in order to maintain consistent result out of the select query.
|
||||
#select * from mysql.servers;
|
||||
eval select * from mysql.servers order by Server_name;
|
||||
|
||||
connection slave;
|
||||
drop table first_db.t1;
|
||||
drop table second_db.t1;
|
||||
drop database first_db;
|
||||
drop database second_db;
|
||||
|
||||
#
|
||||
# Bug#25671 - CREATE/DROP/ALTER SERVER should require privileges
|
||||
#
|
||||
# Changes to SERVER declarations should require SUPER privilege.
|
||||
# Based upon test case by Giuseppe Maxia
|
||||
|
||||
create database db_legitimate;
|
||||
create database db_bogus;
|
||||
|
||||
use db_legitimate;
|
||||
CREATE TABLE db_legitimate.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
);
|
||||
INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate');
|
||||
|
||||
use db_bogus;
|
||||
CREATE TABLE db_bogus.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
)
|
||||
;
|
||||
INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
|
||||
|
||||
connection master;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT $SLAVE_MYPORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
|
||||
create user guest_select@localhost;
|
||||
grant select on federated.* to guest_select@localhost;
|
||||
|
||||
create user guest_super@localhost;
|
||||
grant select,SUPER,RELOAD on *.* to guest_super@localhost;
|
||||
|
||||
create user guest_usage@localhost;
|
||||
grant usage on *.* to guest_usage@localhost;
|
||||
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(64) NOT NULL default ''
|
||||
) ENGINE = FEDERATED CONNECTION = 's1';
|
||||
|
||||
select * from federated.t1;
|
||||
|
||||
connect (conn_select,127.0.0.1,guest_select,,federated,$MASTER_MYPORT);
|
||||
connect (conn_usage,127.0.0.1,guest_usage,,,$MASTER_MYPORT);
|
||||
connect (conn_super,127.0.0.1,guest_super,,,$MASTER_MYPORT);
|
||||
|
||||
connection conn_select;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
alter server s1 options (database 'db_bogus');
|
||||
|
||||
connection master;
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
|
||||
connection conn_usage;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
alter server s1 options (database 'db_bogus');
|
||||
|
||||
connection master;
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
|
||||
connection conn_super;
|
||||
alter server s1 options (database 'db_bogus');
|
||||
|
||||
connection master;
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
|
||||
connection conn_select;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
drop server if exists 's1';
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
eval create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT $SLAVE_MYPORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
|
||||
connection conn_super;
|
||||
drop server 's1';
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval create server 's1' foreign data wrapper 'mysql' options
|
||||
(HOST '127.0.0.1',
|
||||
DATABASE 'db_legitimate',
|
||||
USER 'root',
|
||||
PASSWORD '',
|
||||
PORT $SLAVE_MYPORT,
|
||||
SOCKET '',
|
||||
OWNER 'root');
|
||||
|
||||
connection master;
|
||||
flush tables;
|
||||
select * from federated.t1;
|
||||
|
||||
# clean up test
|
||||
connection slave;
|
||||
drop database db_legitimate;
|
||||
drop database db_bogus;
|
||||
|
||||
disconnect conn_select;
|
||||
disconnect conn_usage;
|
||||
disconnect conn_super;
|
||||
|
||||
connection master;
|
||||
drop user guest_super@localhost;
|
||||
drop user guest_usage@localhost;
|
||||
drop user guest_select@localhost;
|
||||
drop table federated.t1;
|
||||
drop server 's1';
|
||||
|
||||
#
|
||||
# Bug#30671 - ALTER SERVER causes the server to crash
|
||||
#
|
||||
create server 's1' foreign data wrapper 'mysql' options (port 3306);
|
||||
alter server 's1' options
|
||||
(host 'localhost', database '', user '',
|
||||
password '', socket '', owner '', port 3306);
|
||||
# The next statement would crash unpatched server
|
||||
alter server 's1' options
|
||||
(host 'localhost', database 'database1', user '',
|
||||
password '', socket '', owner '', port 3306);
|
||||
drop server 's1';
|
||||
|
||||
--echo # End of 5.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#25721 - deadlock with ALTER/CREATE SERVER
|
||||
#
|
||||
connect (other,localhost,root,,);
|
||||
connection master;
|
||||
use test;
|
||||
delimiter //;
|
||||
create procedure p1 ()
|
||||
begin
|
||||
DECLARE v INT DEFAULT 0;
|
||||
DECLARE i INT;
|
||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
|
||||
SET i = sleep(5);
|
||||
WHILE v < 10000 do
|
||||
CREATE SERVER s
|
||||
FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
|
||||
ALTER SERVER s OPTIONS (USER 'Remote');
|
||||
DROP SERVER s;
|
||||
SET v = v + 1;
|
||||
END WHILE;
|
||||
END//
|
||||
delimiter ;//
|
||||
connection other;
|
||||
use test;
|
||||
send call p1();
|
||||
connection master;
|
||||
call p1();
|
||||
connection other;
|
||||
reap;
|
||||
drop procedure p1;
|
||||
drop server if exists s;
|
||||
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
@@ -0,0 +1,49 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
stop slave;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(32) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1 ENGINE=innodb;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(32) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
|
||||
set autocommit=0;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
|
||||
COMMIT;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (3, 'fie');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (4, 'fum');
|
||||
ROLLBACK;
|
||||
set autocommit=1;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (5, 'foe');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
|
||||
SELECT * FROM federated.t1;
|
||||
id name
|
||||
1 foo
|
||||
2 fee
|
||||
5 foe
|
||||
6 fig
|
||||
DELETE FROM federated.t1;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
@@ -0,0 +1,38 @@
|
||||
source include/have_innodb.inc;
|
||||
source suite/federated/include/federated.inc;
|
||||
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
#SHOW ENGINES;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(32) NOT NULL default ''
|
||||
)
|
||||
DEFAULT CHARSET=latin1 ENGINE=innodb;
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
# # correct connection, same named tables
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL,
|
||||
`name` varchar(32) NOT NULL default ''
|
||||
)
|
||||
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
|
||||
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
|
||||
|
||||
set autocommit=0;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
|
||||
COMMIT;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (3, 'fie');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (4, 'fum');
|
||||
ROLLBACK;
|
||||
set autocommit=1;
|
||||
INSERT INTO federated.t1 (id, name) VALUES (5, 'foe');
|
||||
INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
|
||||
|
||||
SELECT * FROM federated.t1;
|
||||
DELETE FROM federated.t1;
|
||||
|
||||
source suite/federated/include/federated_cleanup.inc;
|
||||
@@ -0,0 +1,11 @@
|
||||
--source include/not_embedded.inc
|
||||
--source suite/federated/include/have_federated_db.inc
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
|
||||
connection master;
|
||||
CREATE DATABASE federated;
|
||||
|
||||
connection slave;
|
||||
CREATE DATABASE federated;
|
||||
@@ -0,0 +1,9 @@
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE federated;
|
||||
--enable_warnings
|
||||
@@ -0,0 +1,6 @@
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'federated'`)
|
||||
{
|
||||
skip Need federated engine;
|
||||
}
|
||||
15
build/lib/mysql/mysql-test/suite/federated/my.cnf
Normal file
15
build/lib/mysql/mysql-test/suite/federated/my.cnf
Normal file
@@ -0,0 +1,15 @@
|
||||
# Use default setting for mysqld processes
|
||||
!include include/default_mysqld.cnf
|
||||
|
||||
[mysqld.1]
|
||||
log-bin= master-bin
|
||||
|
||||
[mysqld.2]
|
||||
|
||||
|
||||
[ENV]
|
||||
MASTER_MYPORT= @mysqld.1.port
|
||||
MASTER_MYSOCK= @mysqld.1.socket
|
||||
|
||||
SLAVE_MYPORT= @mysqld.2.port
|
||||
SLAVE_MYSOCK= @mysqld.2.socket
|
||||
Reference in New Issue
Block a user