Commit 9e17ef84 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Backport of revno: 2617.68.3

Followup to Bug#42546 Backup: RESTORE fails, thinking it finds an existing table

This patch updates lowercase_table2.test with the changed error message
CREATE TABLE produces if it fails because it finds an matching TABLE_SHARE 
in the TDC even if the .FRM/.MYD has been removed from disk.

With the changes introduced in Bug#42546, CREATE TABLE uses open_tables()
which will find the TDC entry and fail in open_table_from_share() with
ER_FILE_NOT_FOUND. Before, CREATE TABLE would not use open_tables() and
fail with ER_TABLE_EXISTS_ERROR upon finding the TDC entry in
mysql_create_table_no_lock().
parent b20a409c
...@@ -226,10 +226,9 @@ drop table t_bug44738_UPPERCASE; ...@@ -226,10 +226,9 @@ drop table t_bug44738_UPPERCASE;
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
drop table t_bug44738_UPPERCASE; drop table t_bug44738_UPPERCASE;
# Finally, let us check that another issue which was exposed by # Finally, let us check that another issue which was exposed by
# the original test case is solved. I.e. that fuse in CREATE TABLE # the original test case is solved. I.e. that the table is not
# which ensures that table is not created if there is an entry for # created if there is an entry for it in TDC even though it was
# it in TDC even though it was removed from disk uses normalized # removed from disk.
# version of the table name.
create table t_bug44738_UPPERCASE (i int) engine = myisam; create table t_bug44738_UPPERCASE (i int) engine = myisam;
# Load table definition in TDC. # Load table definition in TDC.
select table_schema, table_name, table_comment from information_schema.tables select table_schema, table_name, table_comment from information_schema.tables
...@@ -237,10 +236,13 @@ where table_schema = 'test' and table_name like 't_bug44738_%'; ...@@ -237,10 +236,13 @@ where table_schema = 'test' and table_name like 't_bug44738_%';
table_schema table_name table_comment table_schema table_name table_comment
test t_bug44738_UPPERCASE test t_bug44738_UPPERCASE
# Simulate manual removal of the table. # Simulate manual removal of the table.
# After manual removal of table still there should be an entry for table # Check that still there is an entry for table in TDC.
# in TDC so attempt to create table with the same name should fail. show open tables like 't_bug44738_%';
Database Table In_use Name_locked
test t_bug44738_uppercase 0 0
# So attempt to create table with the same name should fail.
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
ERROR 42S01: Table 't_bug44738_uppercase' already exists ERROR HY000: Can't find file: 't_bug44738_uppercase' (errno: 2)
# And should succeed after FLUSH TABLES. # And should succeed after FLUSH TABLES.
flush tables; flush tables;
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
......
...@@ -201,10 +201,9 @@ create table t_bug44738_UPPERCASE (i int); ...@@ -201,10 +201,9 @@ create table t_bug44738_UPPERCASE (i int);
drop table t_bug44738_UPPERCASE; drop table t_bug44738_UPPERCASE;
--echo # Finally, let us check that another issue which was exposed by --echo # Finally, let us check that another issue which was exposed by
--echo # the original test case is solved. I.e. that fuse in CREATE TABLE --echo # the original test case is solved. I.e. that the table is not
--echo # which ensures that table is not created if there is an entry for --echo # created if there is an entry for it in TDC even though it was
--echo # it in TDC even though it was removed from disk uses normalized --echo # removed from disk.
--echo # version of the table name.
create table t_bug44738_UPPERCASE (i int) engine = myisam; create table t_bug44738_UPPERCASE (i int) engine = myisam;
--echo # Load table definition in TDC. --echo # Load table definition in TDC.
select table_schema, table_name, table_comment from information_schema.tables select table_schema, table_name, table_comment from information_schema.tables
...@@ -214,9 +213,10 @@ let $MYSQLD_DATADIR= `select @@datadir`; ...@@ -214,9 +213,10 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm --remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD --remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI --remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI
--echo # After manual removal of table still there should be an entry for table --echo # Check that still there is an entry for table in TDC.
--echo # in TDC so attempt to create table with the same name should fail. show open tables like 't_bug44738_%';
--error ER_TABLE_EXISTS_ERROR --echo # So attempt to create table with the same name should fail.
--error ER_FILE_NOT_FOUND
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
--echo # And should succeed after FLUSH TABLES. --echo # And should succeed after FLUSH TABLES.
flush tables; flush tables;
......
Markdown is supported
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