summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/include/mtr_warnings.sql2
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/r/create.result1
-rw-r--r--mysql-test/r/drop.result1
-rw-r--r--mysql-test/r/mysqlcheck.result1
-rw-r--r--mysql-test/r/upgrade.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql_upgrade.result1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test1
-rw-r--r--mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test2
-rw-r--r--mysql-test/t/create.test1
-rw-r--r--mysql-test/t/drop.test2
-rw-r--r--mysql-test/t/mysqlcheck.test1
-rw-r--r--mysql-test/t/upgrade.test1
-rw-r--r--sql/handler.cc34
-rw-r--r--sql/handler.h3
-rw-r--r--sql/sql_db.cc2
17 files changed, 50 insertions, 7 deletions
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index 0a6077c21d2..0ad1079cd92 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -108,7 +108,7 @@ INSERT INTO global_suppressions VALUES
("Incorrect definition of table"),
("Incorrect information in file"),
("InnoDB: Warning: we did not need to do crash recovery"),
- ("Invalid \\(old\\?\\) table or database name"),
+ /*("Invalid \\(old\\?\\) table or database name"),*/
("Lock wait timeout exceeded"),
("Log entry on master is longer than max_allowed_packet"),
("unknown option '--loose-"),
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 9c4b1142ecc..2672d130a5f 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -4775,7 +4775,7 @@ sub extract_warning_lines ($$) {
qr/slave SQL thread aborted/,
qr/unknown option '--loose[-_]/,
qr/unknown variable 'loose[-_]/,
- qr/Invalid .*old.* table or database name/,
+ #qr/Invalid .*old.* table or database name/,
qr/Now setting lower_case_table_names to [02]/,
qr/Setting lower_case_table_names=2/,
qr/You have forced lower_case_table_names to 0/,
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 2dd9bc8cfec..173a3887f4a 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("table or database name 't-1'");
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
drop view if exists v1;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 55309e54fb3..e1adfe95d8b 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("table or database name 'abc`def'");
drop table if exists t1;
drop database if exists mysqltest;
drop database if exists client_test_db;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 3f5c08d7294..46469556215 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Invalid .old.. table or database name");
DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
index d565bb2dbd6..48f0cd4ffb5 100644
--- a/mysql-test/r/upgrade.result
+++ b/mysql-test/r/upgrade.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Invalid .old.. table or database name");
drop database if exists `mysqltest1`;
drop database if exists `mysqltest-1`;
drop database if exists `#mysql50#mysqltest-1`;
diff --git a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
index 632529ce2b9..9e360beba2c 100644
--- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
+++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("table or database name 'mysqltest-1'");
DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
CREATE DATABASE `#mysql50#mysqltest-1`;
Master position is not changed
diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
index fedad86ea91..ec40d23f9eb 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -11,6 +11,7 @@
--source include/have_mysql_upgrade.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("table or database name 'mysqltest-1'");
connection master;
--disable_warnings
diff --git a/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result b/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
index 5802c71d280..6ae3fd70188 100644
--- a/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
+++ b/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("table or database name '.otherdir'");
select @@ignore_db_dirs;
@@ignore_db_dirs
e,lost+found,.mysqlgui,ignored_db
diff --git a/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test
index 9544fc540f9..78f6479dea6 100644
--- a/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test
+++ b/mysql-test/suite/sys_vars/t/ignore_db_dirs_basic.test
@@ -1,3 +1,5 @@
+call mtr.add_suppression("table or database name '.otherdir'");
+
select @@ignore_db_dirs;
let $MYSQLD_DATADIR= `select @@datadir`;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index f82d859243a..a1152045dd9 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1,3 +1,4 @@
+call mtr.add_suppression("table or database name 't-1'");
#
# Check some special create statements.
#
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 079b10cf708..2cd87b1d980 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -1,3 +1,5 @@
+call mtr.add_suppression("table or database name 'abc`def'");
+
# Initialise
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 06d702495c2..d7dab675dc6 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Invalid .old.. table or database name");
# Embedded server doesn't support external clients
--source include/not_embedded.inc
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index c6d01a16f49..18375856a79 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Invalid .old.. table or database name");
-- source include/not_embedded.inc
--disable_warnings
diff --git a/sql/handler.cc b/sql/handler.cc
index d7adf85fa55..5ef40768798 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4571,10 +4571,9 @@ static int cmp_table_names(LEX_STRING * const *a, LEX_STRING * const *b)
Discovered_table_list::Discovered_table_list(THD *thd_arg,
Dynamic_array<LEX_STRING*> *tables_arg,
- const LEX_STRING *wild_arg)
+ const LEX_STRING *wild_arg) :
+ thd(thd_arg), with_temps(false), tables(tables_arg)
{
- thd= thd_arg;
- tables= tables_arg;
if (wild_arg->str && wild_arg->str[0])
{
wild= wild_arg->str;
@@ -4586,6 +4585,12 @@ Discovered_table_list::Discovered_table_list(THD *thd_arg,
bool Discovered_table_list::add_table(const char *tname, size_t tlen)
{
+ /*
+ TODO Check with_temps and filter out temp tables.
+ Implement the check, when we'll have at least one affected engine (with
+ custom discover_table_names() method, that calls add_table() directly).
+ Note: avoid comparing the same name twice (here and in add_file).
+ */
if (wild && my_wildcmp(files_charset_info, tname, tname + tlen, wild, wend,
wild_prefix, wild_one, wild_many))
return 0;
@@ -4598,8 +4603,13 @@ bool Discovered_table_list::add_table(const char *tname, size_t tlen)
bool Discovered_table_list::add_file(const char *fname)
{
+ bool is_temp= strncmp(fname, STRING_WITH_LEN(tmp_file_prefix)) == 0;
+
+ if (is_temp && !with_temps)
+ return 0;
+
char tname[SAFE_NAME_LEN + 1];
- size_t tlen= filename_to_tablename(fname, tname, sizeof(tname));
+ size_t tlen= filename_to_tablename(fname, tname, sizeof(tname), is_temp);
return add_table(tname, tlen);
}
@@ -4658,6 +4668,22 @@ static my_bool discover_names(THD *thd, plugin_ref plugin,
return 0;
}
+/**
+ Return the list of tables
+
+ @param thd
+ @param db database to look into
+ @param dirp list of files in this database (as returned by my_dir())
+ @param result the object to return the list of files in
+ @param reusable if true, on return, 'dirp' will be a valid list of all
+ non-table files. If false, discovery will work much faster,
+ but it will leave 'dirp' corrupted and completely unusable,
+ only good for my_dirend().
+
+ Normally, reusable=false for SHOW and INFORMATION_SCHEMA, and reusable=true
+ for DROP DATABASE (as it needs to know and delete non-table files).
+*/
+
int ha_discover_table_names(THD *thd, LEX_STRING *db, MY_DIR *dirp,
Discovered_table_list *result, bool reusable)
{
diff --git a/sql/handler.h b/sql/handler.h
index e77d80e7668..a3537add781 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3193,11 +3193,14 @@ class Discovered_table_list: public handlerton::discovered_list
{
THD *thd;
const char *wild, *wend;
+ bool with_temps; // whether to include temp tables in the result
public:
Dynamic_array<LEX_STRING*> *tables;
Discovered_table_list(THD *thd_arg, Dynamic_array<LEX_STRING*> *tables_arg,
const LEX_STRING *wild_arg);
+ Discovered_table_list(THD *thd_arg, Dynamic_array<LEX_STRING*> *tables_arg)
+ : thd(thd_arg), wild(NULL), with_temps(true), tables(tables_arg) {}
~Discovered_table_list() {}
bool add_table(const char *tname, size_t tlen);
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 7cc2caaa881..ec7561594c9 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -991,7 +991,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
/* first, get the list of tables */
Dynamic_array<LEX_STRING*> files(dirp->number_of_files);
- Discovered_table_list tl(thd, &files, &null_lex_str);
+ Discovered_table_list tl(thd, &files);
if (ha_discover_table_names(thd, &db, dirp, &tl, true))
DBUG_RETURN(1);