Hi Ramil,
The patch is OK, it works for the selects with WHERE now.
But I have done some more testing on the corner cases (see attached test
and result files) that shows some minor problems (should at least be
documented). I will discuss these with Mikael on Thursday, before we
approve the patch for pushing.
The problems are:
- Can still insert maximum value if numeric maximum value is the last
range. (should only work if LESS THAN MAXVALUE)
- Cannot have both numeric maximum value and MAXVALUE string as ranges
(Same value, but different meaning)
Also please take the test case coding guidelines into considerations for
your next test case (SQL keywords in UPPER case. Yes, I know there are
lots of lower case tests :-)
http://dev.mysql.com/doc/mysqltest/en/tutorial-coding-guidelines.html
Regards Mattias
ramil@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 5.1 repository of ram. When ram 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@stripped, 2007-11-21 10:05:41+04:00, ramil@stripped +3 -0
> Fix for bug #29258: Partitions: search fails for maximum unsigned bigint
>
> Problem: looking for a matching partition we miss the fact that the maximum
> allowed value is in the PARTITION p LESS THAN MAXVALUE.
>
> Fix: consider the maximum value as a supermum.
Typo: supremum
>
> mysql-test/r/partition.result@stripped, 2007-11-21 10:05:39+04:00, ramil@stripped +7
> -0
> Fix for bug #29258: Partitions: search fails for maximum unsigned bigint
> - test result.
>
> mysql-test/t/partition.test@stripped, 2007-11-21 10:05:39+04:00, ramil@stripped +10
> -0
> Fix for bug #29258: Partitions: search fails for maximum unsigned bigint
> - test case.
>
> sql/sql_partition.cc@stripped, 2007-11-21 10:05:39+04:00, ramil@stripped +7 -1
> Fix for bug #29258: Partitions: search fails for maximum unsigned bigint
> - In case of PARTITION p VALUES LESS THAN MAXVALUE consider the
> maximium value as a supremum.
>
> diff -Nrup a/mysql-test/r/partition.result b/mysql-test/r/partition.result
> --- a/mysql-test/r/partition.result 2007-11-16 17:07:54 +04:00
> +++ b/mysql-test/r/partition.result 2007-11-21 10:05:39 +04:00
> @@ -1297,4 +1297,11 @@ create table t1
> partition by key(s1) partitions 3;
> insert into t1 values (null,null);
> drop table t1;
> +create table t1(a bigint unsigned) partition by range(a)
> +(partition p1 values less than MAXVALUE);
> +insert into t1 values (18446744073709551614),(18446744073709551615);
> +select * from t1 where a=18446744073709551615;
> +a
> +18446744073709551615
> +drop table t1;
> End of 5.1 tests
> diff -Nrup a/mysql-test/t/partition.test b/mysql-test/t/partition.test
> --- a/mysql-test/t/partition.test 2007-11-16 17:07:55 +04:00
> +++ b/mysql-test/t/partition.test 2007-11-21 10:05:39 +04:00
> @@ -1541,4 +1541,14 @@ while ($cnt)
> --enable_query_log
>
> drop table t1;
> +
> +#
> +# Bug #29258: Partitions: search fails for maximum unsigned bigint
> +#
> +create table t1(a bigint unsigned) partition by range(a)
> + (partition p1 values less than MAXVALUE);
> +insert into t1 values (18446744073709551614),(18446744073709551615);
> +select * from t1 where a=18446744073709551615;
> +drop table t1;
> +
> --echo End of 5.1 tests
> diff -Nrup a/sql/sql_partition.cc b/sql/sql_partition.cc
> --- a/sql/sql_partition.cc 2007-11-16 17:07:55 +04:00
> +++ b/sql/sql_partition.cc 2007-11-21 10:05:39 +04:00
> @@ -2941,7 +2941,13 @@ uint32 get_partition_id_range_for_endpoi
> }
> if (left_endpoint)
> {
> - if (part_func_value >= range_array[loc_part_id])
> + longlong bound= range_array[loc_part_id];
> + /*
> + In case of PARTITION p VALUES LESS THAN MAXVALUE
> + the maximum value is in the current partition.
> + */
> + if (part_func_value > bound ||
> + (!part_info->defined_max_value && part_func_value == bound))
> loc_part_id++;
> }
> else
>
--
Mattias Jonsson, Software Engineer
MySQL AB, www.mysql.com
Are you MySQL certified? www.mysql.com/certification
Attachment: [application/x-gzip] bug29258.tests.tgz