Debian Codegraph @

mysql-test/suite/max_parts/inc/partition_max_parts_list.inc

raw
1 # Need more as 16k open files per process (ulimit -n) on Unix systems.
2 --source include/have_partition_open_file_limit.inc
3 ##### max rows to be inserted
4 let $maxrows=65535;
5
6 # Create a list partitioned table with 8192 partitions.
7 # The CREATE will be written into a temporary file ($MYSQL_TMP_DIR/part_list_elem.inc).
8 # After inserting the content of the file it will be removed.
9 perl;
10 use strict;
11 use warnings;
12 my $fname= "$ENV{'MYSQL_TMP_DIR'}/part_list_elem.inc";
13 my @wrlines;
14 push (@wrlines, "eval create table t2 (a int) engine=\$engine\n");
15 push (@wrlines, " partition by list (a) (\n");
16 for(my $i=0; $i<8192; $i++)
17 {
18 my $j= $i*4;
19 if ($i<8191)
20 {
21 my $pattern= " PARTITION p$i VALUES IN (".$j++.",".$j++.",".$j++.",".$j++."),\n";
22 push(@wrlines,$pattern);
23 }
24 else
25 {
26 my $last_pattern= " PARTITION p$i VALUES IN (".$j++.",".$j++.",".$j++.",".$j++.")\n";
27 push(@wrlines,$last_pattern);
28 }
29
30 }
31 push (@wrlines, " );\n");
32 open(FILE, ">", $fname) or die;
33 print FILE @wrlines;
34 close FILE;
35 EOF
36
37 source $MYSQL_TMP_DIR/part_list_elem.inc;
38 remove_file $MYSQL_TMP_DIR/part_list_elem.inc;
39
40 let $count= 32767;
41 --echo $count inserts;
42 --disable_query_log
43 while ($count)
44 {
45 eval insert into t2 values ($count);
46 dec $count;
47 }
48 --enable_query_log
49 select count(*) from t2;
50 select count(*) from t2 partition (p0);
51 select count(*) from t2 partition (p10);
52 select count(*) from t2 partition (p100);
53 select count(*) from t2 partition (p1000);
54 select count(*) from t2 partition (p4000);
55 select count(*) from t2 partition (p8000);
56 select count(*) from t2 partition (p8191);
57
58 select * from t2 partition (p0);
59 select * from t2 partition (p10);
60 select * from t2 partition (p100);
61 select * from t2 partition (p1000);
62 select * from t2 partition (p4000);
63 select * from t2 partition (p8000);
64 select * from t2 partition (p8191);
65
66 delete from t2 partition (p8191);
67 select * from t2 partition (p8191);
68 insert into t2 partition (p8191) values (32766),(32767);
69 select * from t2 partition (p8191);
70 update t2 partition (p8191) set a=32765 where a= 32766;
71 select * from t2 partition (p8191);
72
73 write_file $MYSQL_TMP_DIR/data01;
74 32766,
75 32764,
76 EOF
77 replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
78 eval load data infile '$MYSQL_TMP_DIR/data01' into table t2 partition (p8191) fields terminated by ',';
79 remove_file $MYSQL_TMP_DIR/data01;
80 select * from t2 partition (p8191);
81
82 drop table t2;
83