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 
    6 # Create a range 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. 
   12    my $fname= 
"$ENV{'MYSQL_TMP_DIR'}/part_list_elem.inc";
 
   14    push (@wrlines, 
"eval create table t2 (a int) engine=\$engine\n");
 
   15    push (@wrlines, 
"     partition by range (a) (\n");
 
   16    for(my $i=0; $i<8192; $i++)
 
   19      my $pattern= 
"        PARTITION p$i VALUES LESS THAN ($j),\n";
 
   20      my $last_pattern= 
"        PARTITION p$i VALUES LESS THAN ($j)\n";
 
   23           push(@wrlines,$pattern);
 
   27           push(@wrlines,$last_pattern);
 
   31    push (@wrlines, 
"     );\n");
 
   32    open(FILE, 
">", $fname) or die;
 
   37 source $MYSQL_TMP_DIR/part_list_elem.inc;
 
   38 remove_file $MYSQL_TMP_DIR/part_list_elem.inc;
 
   41 --echo $count inserts;
 
   45 eval insert into t2 values ($count);
 
   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);
 
   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);
 
   66 delete from t2 partition (p8191);
 
   67 select * from t2 partition (p8191);
 
   68 insert into t2 partition (p8191) values (65534), (65535);
 
   69 select * from t2 partition (p8191);
 
   70 update t2 partition (p8191) set a=65533 where a= 65534;
 
   71 select * from t2 partition (p8191);
 
   73 write_file $MYSQL_TMP_DIR/data01;
 
   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);