summaryrefslogtreecommitdiff
path: root/storage/tokudb/mysql-test/tokudb/t/dir_per_db.test
blob: 64745cb049c4ef586647bb8de59f5b4204286859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
source include/have_tokudb.inc;

SET @orig_tokudb_dir_per_db=@@global.tokudb_dir_per_db;

--let $DB= test
--let $DATADIR= `select @@datadir`
--let $i= 2

while ($i) {
  --dec $i
  --echo ########
  --echo #  tokudb_dir_per_db = $i
  --echo ########
  --eval SET GLOBAL tokudb_dir_per_db= $i
  --echo ########
  --echo #  CREATE
  --echo ########
  CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL) ENGINE=tokudb;
  INSERT INTO t1 SET b = 10;
  INSERT INTO t1 SET b = 20;
  SELECT b FROM t1 ORDER BY a;
  CREATE INDEX b ON t1 (b);
  CREATE INDEX ab ON t1 (a,b);
  --source dir_per_db_show_table_files.inc
  --echo ########
  --echo #  RENAME
  --echo ########
  RENAME TABLE t1 TO t2;
  SELECT b FROM t2 ORDER BY a;
  --source dir_per_db_show_table_files.inc
  --echo ########
  --echo #  DROP
  --echo ########
  DROP TABLE t2;
  --source dir_per_db_show_table_files.inc
}

--echo ########
--echo #  CREATE on tokudb_dir_per_db = 0 and RENAME on tokudb_dir_per_db = 1 and vice versa
--echo ########

--let $i= 2

while ($i) {
  --dec $i
  --let $inv_i= (1 - $i);
  --echo ########
  --echo #  tokudb_dir_per_db = $inv_i
  --echo ########
  --eval SET GLOBAL tokudb_dir_per_db= $inv_i
  --echo ########
  --echo #  CREATE
  --echo ########
  CREATE TABLE t1 (a INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, b INT(10) UNSIGNED NOT NULL) ENGINE=tokudb;
  INSERT INTO t1 SET b = 10;
  INSERT INTO t1 SET b = 20;
  SELECT b FROM t1 ORDER BY a;
  CREATE INDEX b ON t1 (b);
  CREATE INDEX ab ON t1 (a,b);
  --source dir_per_db_show_table_files.inc
  --echo ########
  --echo #  tokudb_dir_per_db = $i
  --echo ########
  --eval SET GLOBAL tokudb_dir_per_db= $i
  --echo ########
  --echo #  RENAME
  --echo ########
  RENAME TABLE t1 TO t2;
  SELECT b FROM t2 ORDER BY a;
  --source dir_per_db_show_table_files.inc
  --echo ########
  --echo #  DROP
  --echo ########
  DROP TABLE t2;
  --source dir_per_db_show_table_files.inc
}


# test case for TDB-72 : Can not rename table in database with non alphanum
# characters in its name.
CREATE DATABASE `a::a@@`;
CREATE TABLE `a::a@@`.`t1` (a INT) ENGINE=TOKUDB;
CREATE DATABASE `!@#$%^&*()`;
ALTER TABLE `a::a@@`.`t1` RENAME `!@#$%^&*()`.`t1`;

DROP TABLE `!@#$%^&*()`.`t1`;
DROP DATABASE `!@#$%^&*()`;
DROP DATABASE `a::a@@`;

# cleanup
SET GLOBAL tokudb_dir_per_db=@orig_tokudb_dir_per_db;