1--source include/have_rocksdb.inc
2--source include/have_debug.inc
3
4--let $_server_id= `SELECT @@server_id`
5
6create table t1 (pk int primary key) engine=rocksdb;
7
8# Create a .frm file without a matching table
9--exec cp $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test/t1#sql-test.frm
10
11--source include/restart_mysqld.inc
12
13show tables;
14
15# MariaDB produces a warning:
16call mtr.add_suppression('Invalid .old.. table or database name .t1#sql-test.');
17
18# This will append '#sql-test' to the end of new name
19set session debug_dbug="+d,gen_sql_table_name";
20rename table t1 to t2;
21set session debug_dbug= "-d,gen_sql_table_name";
22
23show tables;
24
25# Remove the corresponding .frm files
26--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test *t1*.frm
27--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test *t2*.frm
28
29# Restart the server with a table registered in RocksDB but does not have a .frm file
30--source include/restart_mysqld.inc
31
32show tables;
33
34# try to recreate a table with the same name
35create table t2 (pk int primary key) engine=rocksdb;
36
37show tables;
38
39drop table t2;
40