~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/partition_not_embedded.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_partition.inc
 
2
-- source include/not_embedded.inc
 
3
--disable_warnings
 
4
DROP TABLE IF EXISTS t1, t2;
 
5
--enable_warnings
 
6
let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
7
 
 
8
#
 
9
# Bug#30102: rename table does corrupt tables with partition files on failure
 
10
#
 
11
--echo # Bug#30102 test
 
12
CREATE TABLE t1 (a INT)
 
13
PARTITION BY RANGE (a)
 
14
(PARTITION p0 VALUES LESS THAN (6),
 
15
 PARTITION `p1....................` VALUES LESS THAN (9),
 
16
 PARTITION p2 VALUES LESS THAN MAXVALUE);
 
17
# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
 
18
# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
 
19
--echo # List of files in database `test`, all original t1-files here
 
20
--list_files $MYSQLD_DATADIR/test t1*
 
21
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
 
22
--echo # Renaming to a file name where the first partition is 250 chars
 
23
--echo # and the second partition is 350 chars
 
24
# 7,7 avoids the error message, which is not deterministic.
 
25
--error 7,7
 
26
RENAME TABLE t1 TO `t2_new..............................................end`;
 
27
#                         1234567890123456789012345678901234567890123456
 
28
--echo # List of files in database `test`, should not be any t2-files here
 
29
--list_files $MYSQLD_DATADIR/test t2*
 
30
--echo # List of files in database `test`, should be all t1-files here
 
31
--list_files $MYSQLD_DATADIR/test t1*
 
32
--sorted_result
 
33
SELECT * FROM t1;
 
34
--echo # List of files in database `test`, should be all t1-files here
 
35
--list_files $MYSQLD_DATADIR/test t1*
 
36
--echo # Renaming to a file name where the first partition is 156 chars
 
37
--echo # and the second partition is 256 chars
 
38
# 7,7 avoids the error message, which is not deterministic.
 
39
--error 7,7
 
40
RENAME TABLE t1 TO `t2_............................_end`;
 
41
#                      1234567890123456789012345678
 
42
# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156
 
43
--echo # List of files in database `test`, should not be any t2-files here
 
44
--list_files $MYSQLD_DATADIR/test t2*
 
45
--echo # List of files in database `test`, should be all t1-files here
 
46
--list_files $MYSQLD_DATADIR/test t1*
 
47
--sorted_result
 
48
SELECT * FROM t1;
 
49
DROP TABLE t1;
 
50
--echo # Should not be any files left here
 
51
--list_files $MYSQLD_DATADIR/test t1*
 
52
--list_files $MYSQLD_DATADIR/test t2*
 
53
--echo # End of bug#30102 test.