1--source include/have_rocksdb.inc
2--source include/have_debug.inc
3
4--let $_server_id= `SELECT @@server_id`
5CREATE TABLE t1 (pk int primary key) ENGINE=ROCKSDB;
6
7# Create a .frm file without a matching table
8--exec cp $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test/t1#sql-test.frm
9
10# Restart the server with a .frm file exist but that table is not registered in RocksDB
11--source include/restart_mysqld.inc
12
13# This will append '#sql-test' to the end of new name
14set session debug="+d,gen_sql_table_name";
15rename table t1 to t2;
16set session debug= "-d,gen_sql_table_name";
17
18# Remove the corresponding .frm files
19--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test *t1*.frm
20--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.$_server_id/data/test *t2*.frm
21
22# Restart the server with a table registered in RocksDB but does not have a .frm file
23--source include/restart_mysqld.inc
24
25# Test can not drop table t2 as starting MyRocks with no .frm file causes
26# MyRocks to remove the tables metadata from its internal dictionary. So an
27# attempt to restart again with the .frm file back in place will result in an
28# error on startup and failure of the plugin to load.
29