summaryrefslogtreecommitdiff
path: root/storage/test_sql_discovery/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'storage/test_sql_discovery/mysql-test')
-rw-r--r--storage/test_sql_discovery/mysql-test/archive/discover.rdiff35
-rw-r--r--storage/test_sql_discovery/mysql-test/archive/discover.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff11
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/create.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/drop.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/plugin.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/rename.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc4
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt2
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/simple.result199
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/simple.test133
13 files changed, 405 insertions, 0 deletions
diff --git a/storage/test_sql_discovery/mysql-test/archive/discover.rdiff b/storage/test_sql_discovery/mysql-test/archive/discover.rdiff
new file mode 100644
index 00000000000..3148999079f
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/archive/discover.rdiff
@@ -0,0 +1,35 @@
+--- suite/archive/discover.result 2013-04-08 00:06:37.000000000 +0200
++++ /usr/home/serg/Abk/mysql/10.0-serg/storage/test_sql_discovery/mysql-test/archive/discover.reject 2013-04-08 00:07:02.000000000 +0200
+@@ -42,6 +42,7 @@
+ t1 BASE TABLE
+ t2 BASE TABLE
+ t1.ARZ
++t1.frm
+ t2.ARZ
+ t2.frm
+ #
+@@ -60,6 +61,7 @@
+ flush tables;
+ rename table t2 to t0;
+ t0.ARZ
++t0.frm
+ t1.ARZ
+ t1.frm
+ #
+@@ -77,6 +79,7 @@
+ flush tables;
+ drop table t1;
+ t0.ARZ
++t0.frm
+ #
+ # discover of table non-existance on drop
+ #
+@@ -86,7 +89,7 @@
+ drop table t0;
+ show status like 'Handler_discover';
+ Variable_name Value
+-Handler_discover 7
++Handler_discover 8
+ #
+ # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
+ #
diff --git a/storage/test_sql_discovery/mysql-test/archive/discover.test b/storage/test_sql_discovery/mysql-test/archive/discover.test
new file mode 100644
index 00000000000..6d7414280c5
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/archive/discover.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source discover.test
diff --git a/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff b/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff
new file mode 100644
index 00000000000..b9288d70f4b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff
@@ -0,0 +1,11 @@
+--- r/plugin.result 2013-02-21 19:46:59.000000000 +0100
++++ r/plugin.reject 2013-02-27 11:13:22.000000000 +0100
+@@ -71,6 +71,8 @@
+ SELECT * FROM t2;
+ ERROR 42000: Unknown storage engine 'EXAMPLE'
+ DROP TABLE t2;
++Warnings:
++Error 1286 Unknown storage engine 'EXAMPLE'
+ UNINSTALL PLUGIN EXAMPLE;
+ ERROR 42000: PLUGIN EXAMPLE does not exist
+ UNINSTALL PLUGIN non_exist;
diff --git a/storage/test_sql_discovery/mysql-test/main/t/create.test b/storage/test_sql_discovery/mysql-test/main/t/create.test
new file mode 100644
index 00000000000..4b3dd16c0a2
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/create.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source create.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/drop.test b/storage/test_sql_discovery/mysql-test/main/t/drop.test
new file mode 100644
index 00000000000..2b3f864ec6b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/drop.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source drop.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test b/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test
new file mode 100644
index 00000000000..9c052839d93
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source mdl_sync.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test b/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test
new file mode 100644
index 00000000000..7fccc33fdbd
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source partition_disabled.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/plugin.test b/storage/test_sql_discovery/mysql-test/main/t/plugin.test
new file mode 100644
index 00000000000..52315af0645
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/plugin.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source plugin.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/rename.test b/storage/test_sql_discovery/mysql-test/main/t/rename.test
new file mode 100644
index 00000000000..ba645131401
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/rename.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source rename.test
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc
new file mode 100644
index 00000000000..b13cbd7d12b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'test_sql_discovery' AND support='YES'`)
+{
+ --skip Test requires test_sql_discovery engine
+}
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt
new file mode 100644
index 00000000000..7d5c2404a50
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt
@@ -0,0 +1,2 @@
+--plugin-load=$HA_TEST_SQL_DISCOVERY_SO
+--loose-test-sql-discovery
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
new file mode 100644
index 00000000000..4fee0a983ed
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
@@ -0,0 +1,199 @@
+show variables like 'test_sql_discovery%';
+Variable_name Value
+test_sql_discovery_statement
+test_sql_discovery_write_frm ON
+set sql_quote_show_create=0;
+create table t1 (a int) engine=test_sql_discovery;
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
+select * from t0;
+ERROR 42S02: Table 'test.t0' doesn't exist
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'foobar bwa-ha-ha' at line 1
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:select 1';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'select 1'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1290 The MariaDB server is running with the --skip-partition option so it cannot execute this statement
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) union=(t3,t4)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 like t2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 like t2'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 select * from t2'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) index directory="/tmp"'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) data directory="/tmp"'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) engine=myisam'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create temporary table t1 (a int)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table if not exists t1 (a int)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+select * from t1;
+a
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) DEFAULT NULL
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=latin1
+drop table t1;
+set @@test_sql_discovery_statement='t1:create table t2 (a int)';
+select * from t1;
+a
+select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+drop table t1;
+set @@test_sql_discovery_statement='t1:
+create table t1 (
+ a int not null default 5 primary key,
+ b timestamp,
+ c tinyblob,
+ d decimal(5,2),
+ e varchar(30) character set ascii,
+ f geometry not null,
+ index (d,b),
+ unique index (c(10)),
+ fulltext (e),
+ spatial (f)
+) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 13
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) NOT NULL DEFAULT '5',
+ b timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ c tinyblob,
+ d decimal(5,2) DEFAULT NULL,
+ e varchar(30) CHARACTER SET ascii DEFAULT NULL,
+ f geometry NOT NULL,
+ PRIMARY KEY (a),
+ UNIQUE KEY c (c(10)),
+ KEY d (d,b),
+ SPATIAL KEY f (f),
+ FULLTEXT KEY e (e)
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=utf8 MIN_ROWS=10 MAX_ROWS=100 CHECKSUM=1 COMMENT='abc'
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+----
+t1.frm
+----
+show open tables from test;
+Database Table In_use Name_locked
+test t1 0 0
+select * from t1;
+a b c d e f
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+flush tables;
+select * from t1;
+a b c d e f
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+drop table t1;
+set @@test_sql_discovery_write_frm=0;
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) DEFAULT NULL
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=latin1
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 15
+----
+----
+show open tables from test;
+Database Table In_use Name_locked
+test t1 0 0
+select * from t1;
+a
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 15
+flush tables;
+select * from t1;
+a
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 16
+drop table t1;
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 16
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test
new file mode 100644
index 00000000000..4aa5ac2864e
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test
@@ -0,0 +1,133 @@
+--source inc.inc
+
+show variables like 'test_sql_discovery%';
+set sql_quote_show_create=0;
+let $mysqld_datadir= `select @@datadir`;
+
+--error ER_CANT_CREATE_TABLE
+create table t1 (a int) engine=test_sql_discovery;
+
+--error ER_NO_SUCH_TABLE
+select * from t1;
+
+set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
+--error ER_NO_SUCH_TABLE
+select * from t0;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+#
+# test different invalid discovering statements
+#
+
+set @@test_sql_discovery_statement='t1:select 1';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 like t2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+#
+# this should work:
+#
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+select * from t1;
+show create table t1;
+drop table t1;
+
+# table name in the create table statement is ignored
+set @@test_sql_discovery_statement='t1:create table t2 (a int)';
+select * from t1;
+--error ER_NO_SUCH_TABLE
+select * from t2;
+drop table t1;
+
+# and something more complex
+set @@test_sql_discovery_statement='t1:
+create table t1 (
+ a int not null default 5 primary key,
+ b timestamp,
+ c tinyblob,
+ d decimal(5,2),
+ e varchar(30) character set ascii,
+ f geometry not null,
+ index (d,b),
+ unique index (c(10)),
+ fulltext (e),
+ spatial (f)
+) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
+show status like 'handler_discover';
+show create table t1;
+show status like 'handler_discover';
+--echo ----
+--list_files $mysqld_datadir/test t*
+--echo ----
+show open tables from test;
+select * from t1;
+show status like 'handler_discover';
+flush tables;
+select * from t1;
+show status like 'handler_discover';
+drop table t1;
+
+set @@test_sql_discovery_write_frm=0;
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+show status like 'handler_discover';
+show create table t1;
+show status like 'handler_discover';
+--echo ----
+--list_files $mysqld_datadir/test t*
+--echo ----
+show open tables from test;
+select * from t1;
+show status like 'handler_discover';
+flush tables;
+select * from t1;
+show status like 'handler_discover';
+drop table t1;
+show status like 'handler_discover';
+