1SET GLOBAL tokudb_dir_per_db=ON;
2CREATE PROCEDURE create_table()
3BEGIN
4CREATE TABLE test.t1 (
5a INT
6) ENGINE = TokuDB
7PARTITION BY RANGE (a)
8(PARTITION p100 VALUES LESS THAN (100) ENGINE = TokuDB,
9PARTITION p_to_del VALUES LESS THAN (200) ENGINE = TokuDB,
10PARTITION p300 VALUES LESS THAN (300) ENGINE = TokuDB,
11PARTITION p400 VALUES LESS THAN (400) ENGINE = TokuDB
12);
13END|
14### Create partitioned table
15CALL create_table();
16## Looking for *.tokudb files in data_dir
17## Looking for *.tokudb files in data_dir/test
18t1_P_p100_main_id.tokudb
19t1_P_p100_status_id.tokudb
20t1_P_p300_main_id.tokudb
21t1_P_p300_status_id.tokudb
22t1_P_p400_main_id.tokudb
23t1_P_p400_status_id.tokudb
24t1_P_p_to_del_main_id.tokudb
25t1_P_p_to_del_status_id.tokudb
26### Stop server
27### Remove 'main' file of one of the partitions
28### Start server
29### Make sure 'main' partition file is deleted
30## Looking for *.tokudb files in data_dir
31## Looking for *.tokudb files in data_dir/test
32t1_P_p100_main_id.tokudb
33t1_P_p100_status_id.tokudb
34t1_P_p300_main_id.tokudb
35t1_P_p300_status_id.tokudb
36t1_P_p400_main_id.tokudb
37t1_P_p400_status_id.tokudb
38t1_P_p_to_del_status_id.tokudb
39### Make sure the table still exists
40SHOW TABLES;
41Tables_in_test
42t1
43### Drop table
44DROP TABLE t1;
45### Make sure the table is dropped
46SHOW TABLES;
47Tables_in_test
48### Check what files still exist after DROP TABLE
49## Looking for *.tokudb files in data_dir
50## Looking for *.tokudb files in data_dir/test
51### Remove the rest of the files
52### Make sure there are no tokudb files
53## Looking for *.tokudb files in data_dir
54## Looking for *.tokudb files in data_dir/test
55### Create the same table once more
56CALL create_table();
57## Looking for *.tokudb files in data_dir
58## Looking for *.tokudb files in data_dir/test
59t1_P_p100_main_id.tokudb
60t1_P_p100_status_id.tokudb
61t1_P_p300_main_id.tokudb
62t1_P_p300_status_id.tokudb
63t1_P_p400_main_id.tokudb
64t1_P_p400_status_id.tokudb
65t1_P_p_to_del_main_id.tokudb
66t1_P_p_to_del_status_id.tokudb
67### Restore state
68DROP TABLE t1;
69DROP PROCEDURE create_table;
70SET GLOBAL tokudb_dir_per_db=default;
71