Below is the list of changes that have just been committed into a local
5.1 repository of patg. When patg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2023 06/01/06 13:48:02 patg@stripped +3 -0
ha_partition.cc:
WL# 2682
1. Just free the whole hash, no need for iterator (the code did miss deleting
subpartitions)
2. Make sure to get index of subpartiton if no subpartition elements
partition_select.test:
WL# 2682
New subpartition tests
partition_select.result:
WL# 2682
New results with subpartition tests
sql/ha_partition.cc
1.29 06/01/06 13:47:11 patg@stripped +6 -11
WL# 2682
1. Just free the whole hash, no need for iterator (the code did miss deleting
subpartitions)
2. Make sure to get index of subpartiton if no subpartition elements
mysql-test/t/partition_select.test
1.3 06/01/06 13:47:11 patg@stripped +14 -0
WL# 2682
New subpartition tests
mysql-test/r/partition_select.result
1.3 06/01/06 13:47:11 patg@stripped +120 -0
WL# 2682
New results with subpartition tests
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: patg
# Host: govinda.site
# Root: /home/patg/mysql-build/mysql-5.1-wl2682
--- 1.28/sql/ha_partition.cc 2006-01-06 08:08:32 -08:00
+++ 1.29/sql/ha_partition.cc 2006-01-06 13:47:11 -08:00
@@ -1044,22 +1044,18 @@
int ha_partition::close(void)
{
+ int i;
handler **file;
+ partition_element *part_elem;
List_iterator_fast <partition_element> part_it(m_part_info->partitions);
DBUG_ENTER("ha_partition::close");
delete_queue(&queue);
bitmap_free(&(m_part_info->used_partitions));
file= m_file;
- do
- {
- partition_element *part_elem= part_it++;
- /* this line causes the server to bomb on shutdown*/
- //VOID(hash_delete(&(m_part_info->partition_names), (byte*)part_it++));
- /* this line doesn't seem to free the hash!!! */
- VOID(hash_delete(&(m_part_info->partition_names), (byte*)part_elem));
- (*file)->close();
- } while (*(++file));
+ do { (*file)->close(); } while (*(++file));
+ hash_free(&(m_part_info->partition_names));
+
DBUG_RETURN(0);
}
@@ -1198,7 +1194,7 @@
DBUG_PRINT("info", ("selected partition %s is in table", partition_name));
- if (is_sub_partitioned(m_part_info))
+ if (is_sub_partitioned(m_part_info) && (el->subpartitions.elements > 0))
{
List_iterator<partition_element> sub_part_it(el->subpartitions);
partition_element *sub_el;
@@ -3483,7 +3479,6 @@
this doesn't seem to free m_part_info->partition_names,
need to know how to make sure this happens
*/
- my_free((gptr) &(m_part_info->partition_names), MYF(0));
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&partition_mutex);
--- 1.2/mysql-test/r/partition_select.result 2006-01-06 08:06:02 -08:00
+++ 1.3/mysql-test/r/partition_select.result 2006-01-06 13:47:11 -08:00
@@ -200,3 +200,123 @@
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
INSERT INTO `t4` SELECT * FROM `t2`;
INSERT INTO `t4` SELECT * FROM `t2` ORDER BY id;
+CREATE TABLE `t5` (
+id int(32),
+name varchar(64),
+purchased date)
+PARTITION BY RANGE( YEAR(purchased) )
+SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
+PARTITION p0 VALUES LESS THAN (1990) (
+SUBPARTITION s0,
+SUBPARTITION s1
+),
+PARTITION p1 VALUES LESS THAN (2000) (
+SUBPARTITION s2,
+SUBPARTITION s3
+),
+PARTITION p2 VALUES LESS THAN MAXVALUE (
+SUBPARTITION s4,
+SUBPARTITION s5
+)
+);
+INSERT INTO `t5` VALUES (1, 'aaaaaaa', '2006-01-05 00:00:00');
+INSERT INTO `t5` VALUES (2, 'bbbbbbb', '2005-08-05 00:00:00');
+INSERT INTO `t5` VALUES (3, 'ccccccc', '1985-08-07 00:00:00');
+INSERT INTO `t5` VALUES (4, 'ddddddd', '2000-01-01 00:00:00');
+INSERT INTO `t5` VALUES (5, 'eeeeeee', '1999-12-01 00:00:00');
+INSERT INTO `t5` VALUES (6, 'fffffff', '2003-11-12 00:00:00');
+INSERT INTO `t5` VALUES (7, 'ggggggg', '1990-01-05 00:00:00');
+INSERT INTO `t5` VALUES (8, 'hhhhhhh', '1978-01-05 00:00:00');
+INSERT INTO `t5` VALUES (9, 'iiiiiii', '1979-01-05 00:00:00');
+INSERT INTO `t5` VALUES (10, 'jjjjjjj', '1992-01-05 00:00:00');
+INSERT INTO `t5` VALUES (11, 'kkkkkkk', '1993-01-05 00:00:00');
+INSERT INTO `t5` VALUES (12, 'mmmmmmm', '1994-01-05 00:00:00');
+INSERT INTO `t5` VALUES (13, 'nnnnnnn', '1989-01-05 00:00:00');
+INSERT INTO `t5` VALUES (14, 'ooooooo', '1983-12-05 00:00:00');
+INSERT INTO `t5` VALUES (15, 'ppppppp', '1986-06-05 00:00:00');
+INSERT INTO `t5` VALUES (16, 'qqqqqqq', '1974-04-11 00:00:00');
+INSERT INTO `t5` VALUES (17, 'qqqqqqq', '1960-03-15 00:00:00');
+INSERT INTO `t5` VALUES (18, 'sssssss', '1950-09-23 00:00:00');
+INSERT INTO `t5` VALUES (19, 'ttttttt', '1999-08-02 00:00:00');
+INSERT INTO `t5` VALUES (20, 'uuuuuuu', '1994-05-28 00:00:00');
+SELECT * FROM `t5`;
+id name purchased
+8 hhhhhhh 1978-01-05
+13 nnnnnnn 1989-01-05
+14 ooooooo 1983-12-05
+18 sssssss 1950-09-23
+3 ccccccc 1985-08-07
+9 iiiiiii 1979-01-05
+15 ppppppp 1986-06-05
+16 qqqqqqq 1974-04-11
+17 qqqqqqq 1960-03-15
+5 eeeeeee 1999-12-01
+12 mmmmmmm 1994-01-05
+4 ddddddd 2000-01-01
+7 ggggggg 1990-01-05
+10 jjjjjjj 1992-01-05
+11 kkkkkkk 1993-01-05
+19 ttttttt 1999-08-02
+20 uuuuuuu 1994-05-28
+2 bbbbbbb 2005-08-05
+6 fffffff 2003-11-12
+1 aaaaaaa 2006-01-05
+SELECT * FROM `t5` PARTITION(p0) ORDER BY id;
+id name purchased
+3 ccccccc 1985-08-07
+8 hhhhhhh 1978-01-05
+9 iiiiiii 1979-01-05
+13 nnnnnnn 1989-01-05
+14 ooooooo 1983-12-05
+15 ppppppp 1986-06-05
+16 qqqqqqq 1974-04-11
+17 qqqqqqq 1960-03-15
+18 sssssss 1950-09-23
+SELECT * FROM `t5` PARTITION(s0) ORDER BY id;
+id name purchased
+8 hhhhhhh 1978-01-05
+13 nnnnnnn 1989-01-05
+14 ooooooo 1983-12-05
+18 sssssss 1950-09-23
+SELECT * FROM `t5` PARTITION(s1) ORDER BY id;
+id name purchased
+3 ccccccc 1985-08-07
+9 iiiiiii 1979-01-05
+15 ppppppp 1986-06-05
+16 qqqqqqq 1974-04-11
+17 qqqqqqq 1960-03-15
+SELECT * FROM `t5` PARTITION(p1) ORDER BY id;
+id name purchased
+4 ddddddd 2000-01-01
+5 eeeeeee 1999-12-01
+7 ggggggg 1990-01-05
+10 jjjjjjj 1992-01-05
+11 kkkkkkk 1993-01-05
+12 mmmmmmm 1994-01-05
+19 ttttttt 1999-08-02
+20 uuuuuuu 1994-05-28
+SELECT * FROM `t5` PARTITION(s2) ORDER BY id;
+id name purchased
+5 eeeeeee 1999-12-01
+12 mmmmmmm 1994-01-05
+SELECT * FROM `t5` PARTITION(s3) ORDER BY id;
+id name purchased
+4 ddddddd 2000-01-01
+7 ggggggg 1990-01-05
+10 jjjjjjj 1992-01-05
+11 kkkkkkk 1993-01-05
+19 ttttttt 1999-08-02
+20 uuuuuuu 1994-05-28
+SELECT * FROM `t5` PARTITION(p2) ORDER BY id;
+id name purchased
+1 aaaaaaa 2006-01-05
+2 bbbbbbb 2005-08-05
+6 fffffff 2003-11-12
+SELECT * FROM `t5` PARTITION(s4) ORDER BY id;
+id name purchased
+2 bbbbbbb 2005-08-05
+6 fffffff 2003-11-12
+SELECT * FROM `t5` PARTITION(s5) ORDER BY id;
+id name purchased
+1 aaaaaaa 2006-01-05
+drop table t1,t2,t3,t4,t5;
--- 1.2/mysql-test/t/partition_select.test 2006-01-06 08:06:04 -08:00
+++ 1.3/mysql-test/t/partition_select.test 2006-01-06 13:47:11 -08:00
@@ -128,3 +128,17 @@
INSERT INTO `t5` VALUES (19, 'ttttttt', '1999-08-02 00:00:00');
INSERT INTO `t5` VALUES (20, 'uuuuuuu', '1994-05-28 00:00:00');
+SELECT * FROM `t5`;
+SELECT * FROM `t5` PARTITION(p0) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s0) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s1) ORDER BY id;
+SELECT * FROM `t5` PARTITION(p1) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s2) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s3) ORDER BY id;
+SELECT * FROM `t5` PARTITION(p2) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s4) ORDER BY id;
+SELECT * FROM `t5` PARTITION(s5) ORDER BY id;
+
+--disable_warnings
+drop table t1,t2,t3,t4,t5;
+--enable_warnings
| Thread |
|---|
| • bk commit into 5.1 tree (patg:1.2023) | Patrick Galbraith | 6 Jan |