~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
--source include/have_innodb.inc
2
--source include/have_partition.inc
3
--vertical_results
4
let $engine_type= 'innodb';
5
6
######## Creat Table Section #########
7
use test;
8
9
eval CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
10
                           dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
11
                           fkid MEDIUMINT, filler VARCHAR(255),
12
                           PRIMARY KEY(id)) ENGINE=$engine_type
13
                                PARTITION BY RANGE(id)
14
                                SUBPARTITION BY hash(id) subpartitions 2
15
                                (PARTITION pa3 values less than (42),
16
                                 PARTITION pa6 values less than (60),
17
                                 PARTITION pa7 values less than (70),
18
                                 PARTITION pa8 values less than (80),
19
                                 PARTITION pa9 values less than (90),
20
                                 PARTITION pa10 values less than (100),
21
                                 PARTITION pa11 values less than MAXVALUE);
22
23
######## Create SPs, Functions, Views and Triggers Section ##############
24
25
delimiter |;
26
27
CREATE PROCEDURE test.proc_part()
28
BEGIN
29
   DECLARE ins_count INT DEFAULT 1000;
30
   DECLARE del_count INT;
31
   DECLARE cur_user VARCHAR(255);
32
   DECLARE local_uuid VARCHAR(255);
33
   DECLARE local_time TIMESTAMP;
34
35
   SET local_time= NOW();
36
   SET cur_user= CURRENT_USER();
37
   SET local_uuid= UUID();
38
39
   WHILE ins_count > 0 DO
40
     INSERT INTO test.part_tbl VALUES (NULL, NOW(), USER() , UUID(),
41
                                   ins_count,'Going to test MBR for MySQL');
42
     SET ins_count = ins_count - 1;
43
   END WHILE;
44
   SELECT MAX(id) FROM test.part_tbl INTO del_count;
45
   WHILE del_count > 0 DO
46
     DELETE FROM test.part_tbl WHERE id = del_count;
47
     select count(*) as internal_count, del_count  -- these two lines are for
48
     FROM test.part_tbl;                           -- debug to show the problem
49
     SET del_count = del_count - 2;
50
   END WHILE;
51
END|
52
53
delimiter ;|
54
55
############ Finish Setup Section ###################
56
57
############ Test Section ###################
58
--horizontal_results
59
60
CALL test.proc_part();
61
62
select count(*) as Part from test.part_tbl;
63
64
###### CLEAN UP SECTION ##############
65
66
DROP PROCEDURE test.proc_part;
67
DROP TABLE test.part_tbl;
68