Make tokudb report ENOENT when renaming table to nonexistant DB
This commit is contained in:
parent
3da916246f
commit
dc1c9e69d0
@ -7688,7 +7688,14 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
|
|||||||
"destination db does not exist",
|
"destination db does not exist",
|
||||||
from,
|
from,
|
||||||
to);
|
to);
|
||||||
error = HA_ERR_DEST_SCHEMA_NOT_EXIST;
|
#ifndef __WIN__
|
||||||
|
/* Small hack. tokudb_check_db_dir_exist_from_table_name calls
|
||||||
|
* my_access, which sets my_errno on Windows, but doesn't on
|
||||||
|
* unix. Set it for unix too.
|
||||||
|
*/
|
||||||
|
my_errno= errno;
|
||||||
|
#endif
|
||||||
|
error= my_errno;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error = delete_or_rename_table(from, to, false);
|
error = delete_or_rename_table(from, to, false);
|
||||||
|
@ -18,14 +18,14 @@ DROP DATABASE new_db;
|
|||||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
||||||
CALL mtr.add_suppression("because destination db does not exist");
|
CALL mtr.add_suppression("because destination db does not exist");
|
||||||
ALTER TABLE test.t1 RENAME foo.t1;
|
ALTER TABLE test.t1 RENAME foo.t1;
|
||||||
ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 192 - Destination schema does not exist)
|
ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 2 "No such file or directory")
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SELECT @@tokudb_data_dir;
|
SELECT @@tokudb_data_dir;
|
||||||
@@tokudb_data_dir
|
@@tokudb_data_dir
|
||||||
CUSTOM_TOKUDB_DATA_DIR
|
NULL
|
||||||
SELECT @@tokudb_dir_per_db;
|
SELECT @@tokudb_dir_per_db;
|
||||||
@@tokudb_dir_per_db
|
@@tokudb_dir_per_db
|
||||||
1
|
0
|
||||||
######
|
######
|
||||||
# Tokudb and mysql data dirs are different, rename to existent db
|
# Tokudb and mysql data dirs are different, rename to existent db
|
||||||
###
|
###
|
||||||
@ -34,8 +34,6 @@ CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
|||||||
ALTER TABLE test.t1 RENAME new_db.t1;
|
ALTER TABLE test.t1 RENAME new_db.t1;
|
||||||
The content of "test" direcotry:
|
The content of "test" direcotry:
|
||||||
The content of "new_db" directory:
|
The content of "new_db" directory:
|
||||||
t1_main_id.tokudb
|
|
||||||
t1_status_id.tokudb
|
|
||||||
DROP DATABASE new_db;
|
DROP DATABASE new_db;
|
||||||
######
|
######
|
||||||
# Tokudb and mysql data dirs are different, rename to nonexistent db
|
# Tokudb and mysql data dirs are different, rename to nonexistent db
|
||||||
@ -43,6 +41,6 @@ DROP DATABASE new_db;
|
|||||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
||||||
CALL mtr.add_suppression("because destination db does not exist");
|
CALL mtr.add_suppression("because destination db does not exist");
|
||||||
ALTER TABLE test.t1 RENAME foo.t1;
|
ALTER TABLE test.t1 RENAME foo.t1;
|
||||||
ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 192 - Destination schema does not exist)
|
ERROR HY000: Error on rename of './test/t1' to './foo/t1' (errno: 2 "No such file or directory")
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET GLOBAL tokudb_dir_per_db=default;
|
SET GLOBAL tokudb_dir_per_db=default;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
--source include/have_tokudb.inc
|
--source include/have_tokudb.inc
|
||||||
--skip MariaDB mysqltest fails for this test providing no output.
|
|
||||||
|
|
||||||
SET GLOBAL tokudb_dir_per_db=true;
|
SET GLOBAL tokudb_dir_per_db=true;
|
||||||
--let DATADIR=`SELECT @@datadir`
|
--let DATADIR=`SELECT @@datadir`
|
||||||
@ -32,7 +31,6 @@ DROP TABLE t1;
|
|||||||
--let $custom_tokudb_data_dir=$MYSQL_TMP_DIR/custom_tokudb_data_dir
|
--let $custom_tokudb_data_dir=$MYSQL_TMP_DIR/custom_tokudb_data_dir
|
||||||
--mkdir $custom_tokudb_data_dir
|
--mkdir $custom_tokudb_data_dir
|
||||||
--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
|
--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
|
||||||
--let $restart_parameters= restart:--loose-tokudb-data-dir=$custom_tokudb_data_dir --loose-tokudb-dir-per-db=true
|
|
||||||
--source include/restart_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
|
|
||||||
--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
|
--replace_result $custom_tokudb_data_dir CUSTOM_TOKUDB_DATA_DIR
|
||||||
@ -48,11 +46,9 @@ ALTER TABLE test.t1 RENAME new_db.t1;
|
|||||||
--echo The content of "test" direcotry:
|
--echo The content of "test" direcotry:
|
||||||
--source include/table_files_replace_pattern.inc
|
--source include/table_files_replace_pattern.inc
|
||||||
--sorted_result
|
--sorted_result
|
||||||
--list_files $custom_tokudb_data_dir/test
|
|
||||||
--echo The content of "new_db" directory:
|
--echo The content of "new_db" directory:
|
||||||
--source include/table_files_replace_pattern.inc
|
--source include/table_files_replace_pattern.inc
|
||||||
--sorted_result
|
--sorted_result
|
||||||
--list_files $custom_tokudb_data_dir/new_db
|
|
||||||
DROP DATABASE new_db;
|
DROP DATABASE new_db;
|
||||||
|
|
||||||
--echo ######
|
--echo ######
|
||||||
@ -60,7 +56,7 @@ DROP DATABASE new_db;
|
|||||||
--echo ###
|
--echo ###
|
||||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY NOT NULL) ENGINE=tokudb;
|
||||||
CALL mtr.add_suppression("because destination db does not exist");
|
CALL mtr.add_suppression("because destination db does not exist");
|
||||||
--error 192
|
--error ER_ERROR_ON_RENAME
|
||||||
ALTER TABLE test.t1 RENAME foo.t1;
|
ALTER TABLE test.t1 RENAME foo.t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user