#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-40278/mysql-pe-wl2687-merge/ based on revid:alfranio.correia@stripped
3509 Alfranio Correia 2009-09-08 [merge]
merge mysql-pe --> mysql-pe-wl2687
added:
mysql-test/r/subselect4.result
mysql-test/t/subselect4.test
modified:
include/my_handler.h
mysql-test/include/mix1.inc
mysql-test/r/distinct.result
mysql-test/r/innodb_mysql.result
mysql-test/r/myisam.result
mysql-test/r/partition_innodb.result
mysql-test/suite/binlog/t/binlog_tmp_table.test
mysql-test/t/distinct.test
mysql-test/t/myisam.test
mysql-test/t/partition_innodb.test
sql/ha_partition.cc
sql/sql_select.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/include/row0mysql.h
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisam/myisamdef.h
=== modified file 'include/my_handler.h'
--- a/include/my_handler.h 2008-11-12 15:23:22 +0000
+++ b/include/my_handler.h 2009-07-30 15:15:27 +0000
@@ -123,8 +123,29 @@ extern void my_handler_error_unregister(
this amount of bytes.
*/
#define portable_sizeof_char_ptr 8
+
+/**
+ Return values of index_cond_func_xxx functions.
+
+ 0=ICP_NO_MATCH - index tuple doesn't satisfy the pushed index condition (the
+ engine should discard the tuple and go to the next one)
+ 1=ICP_MATCH - index tuple satisfies the pushed index condition (the engine
+ should fetch and return the record)
+ 2=ICP_OUT_OF_RANGE - index tuple is out range that we're scanning, e.g. this
+ if we're scanning "t.key BETWEEN 10 AND 20" and got a
+ "t.key=21" tuple (the engine should stop scanning and return
+ HA_ERR_END_OF_FILE right away).
+*/
+
+typedef enum icp_result {
+ ICP_NO_MATCH,
+ ICP_MATCH,
+ ICP_OUT_OF_RANGE
+} ICP_RESULT;
+
#ifdef __cplusplus
}
#endif
+
#endif /* _my_handler_h */
=== modified file 'mysql-test/include/mix1.inc'
--- a/mysql-test/include/mix1.inc 2009-07-28 14:16:37 +0000
+++ b/mysql-test/include/mix1.inc 2009-09-08 08:06:49 +0000
@@ -1554,3 +1554,27 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Bug#43600: Incorrect type conversion caused wrong result.
+--echo #
+CREATE TABLE t1 (
+ a int NOT NULL
+) engine= innodb;
+
+CREATE TABLE t2 (
+ a int NOT NULL,
+ b int NOT NULL,
+ filler char(100) DEFAULT NULL,
+ KEY a (a,b)
+) engine= innodb;
+
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
+
+explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+
+drop table t1,t2;
+--echo # End of test case for the bug#43600
+
=== modified file 'mysql-test/r/distinct.result'
--- a/mysql-test/r/distinct.result 2009-05-10 16:35:06 +0000
+++ b/mysql-test/r/distinct.result 2009-09-08 08:33:46 +0000
@@ -763,4 +763,34 @@ a b d c
1 2 0 2
1 2 0 3
DROP TABLE t1;
+#
+# Bug #46159: simple query that never returns
+#
+SET @old_max_heap_table_size = @@max_heap_table_size;
+SET @@max_heap_table_size = 16384;
+SET @old_sort_buffer_size = @@sort_buffer_size;
+SET @@sort_buffer_size = 32804;
+CREATE TABLE t1(c1 int, c2 VARCHAR(20));
+INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
+c1 c2 COUNT(*)
+1 1 2
+2 2 1
+3 1 2
+4 4 1
+SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
+c2
+1
+5
+DROP TABLE t1;
+SET @@sort_buffer_size = @old_sort_buffer_size;
+SET @@max_heap_table_size = @old_max_heap_table_size;
End of 5.1 tests
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2009-07-31 19:46:24 +0000
+++ b/mysql-test/r/innodb_mysql.result 2009-09-08 08:06:49 +0000
@@ -1764,6 +1764,33 @@ id select_type table type possible_keys
2 DERIVED t1 index c3,c2 c2 14 NULL 5
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#43600: Incorrect type conversion caused wrong result.
+#
+CREATE TABLE t1 (
+a int NOT NULL
+) engine= innodb;
+CREATE TABLE t2 (
+a int NOT NULL,
+b int NOT NULL,
+filler char(100) DEFAULT NULL,
+KEY a (a,b)
+) engine= innodb;
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
+explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+1 SIMPLE t2 ref a a 4 test.t1.a 1 Using where
+select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+a a b filler
+0 0 1 filler
+1 1 1 filler
+2 2 1 filler
+3 3 1 filler
+4 4 1 filler
+drop table t1,t2;
+# End of test case for the bug#43600
drop table if exists t1, t2, t3;
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result 2009-08-04 19:50:51 +0000
+++ b/mysql-test/r/myisam.result 2009-09-08 08:06:49 +0000
@@ -2285,3 +2285,30 @@ h+0 d + 0 e g + 0
1 1 4 0
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#43600: Incorrect type conversion caused wrong result.
+#
+CREATE TABLE t1 (
+a int NOT NULL
+) engine= myisam;
+CREATE TABLE t2 (
+a int NOT NULL,
+b int NOT NULL,
+filler char(100) DEFAULT NULL,
+KEY a (a,b)
+) engine= myisam;
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
+explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index condition
+select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+a a b filler
+0 0 1 filler
+1 1 1 filler
+2 2 1 filler
+3 3 1 filler
+4 4 1 filler
+drop table t1,t2;
+# End of test case for the bug#43600
=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result 2008-12-13 11:02:16 +0000
+++ b/mysql-test/r/partition_innodb.result 2009-09-08 09:51:31 +0000
@@ -1,4 +1,18 @@
drop table if exists t1;
+create table t1 (a int not null,
+b datetime not null,
+primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+partition p1 values less than (to_days('2009-02-01')),
+partition p2 values less than (to_days('2009-03-01')),
+partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
PARTITION BY RANGE(id) (
PARTITION p0 VALUES LESS THAN (5),
=== added file 'mysql-test/r/subselect4.result'
--- a/mysql-test/r/subselect4.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/subselect4.result 2009-09-03 15:03:46 +0000
@@ -0,0 +1,30 @@
+#
+# Bug #46791: Assertion failed:(table->key_read==0),function unknown
+# function,file sql_base.cc
+#
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES (1,1),(2,2);
+CREATE TABLE t3 LIKE t1;
+# should have 1 impossible where and 2 dependent subqueries
+EXPLAIN
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+# should not crash the next statement
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+1
+1
+# should not crash: the crash is caused by the previous statement
+SELECT 1;
+1
+1
+DROP TABLE t1,t2,t3;
+End of 5.0 tests.
=== modified file 'mysql-test/suite/binlog/t/binlog_tmp_table.test'
--- a/mysql-test/suite/binlog/t/binlog_tmp_table.test 2009-09-07 07:25:08 +0000
+++ b/mysql-test/suite/binlog/t/binlog_tmp_table.test 2009-09-08 09:01:37 +0000
@@ -32,8 +32,6 @@ connect (master,127.0.0.1,root,,test,$MA
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
RESET MASTER;
-reset master;
-
create table foo (a int);
flush logs;
=== modified file 'mysql-test/t/distinct.test'
--- a/mysql-test/t/distinct.test 2008-10-29 17:40:17 +0000
+++ b/mysql-test/t/distinct.test 2009-09-08 08:33:46 +0000
@@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #46159: simple query that never returns
+--echo #
+
+# Set max_heap_table_size to the minimum value so that GROUP BY table in the
+# SELECT query below gets converted to MyISAM
+SET @old_max_heap_table_size = @@max_heap_table_size;
+SET @@max_heap_table_size = 16384;
+
+# Set sort_buffer_size to the mininum value so that remove_duplicates() calls
+# remove_dup_with_compare()
+SET @old_sort_buffer_size = @@sort_buffer_size;
+SET @@sort_buffer_size = 32804;
+
+CREATE TABLE t1(c1 int, c2 VARCHAR(20));
+INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
+# Now we just need to pad the table with random data so we have enough unique
+# values to force conversion of the GROUP BY table to MyISAM
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
+
+# First rows of the GROUP BY table that will be processed by
+# remove_dup_with_compare()
+SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
+
+# The actual test case
+SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
+
+# Cleanup
+
+DROP TABLE t1;
+SET @@sort_buffer_size = @old_sort_buffer_size;
+SET @@max_heap_table_size = @old_max_heap_table_size;
+
--echo End of 5.1 tests
=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test 2009-07-29 10:25:07 +0000
+++ b/mysql-test/t/myisam.test 2009-09-08 08:06:49 +0000
@@ -1536,3 +1536,27 @@ SELECT h+0, d + 0, e, g + 0 FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Bug#43600: Incorrect type conversion caused wrong result.
+--echo #
+CREATE TABLE t1 (
+ a int NOT NULL
+) engine= myisam;
+
+CREATE TABLE t2 (
+ a int NOT NULL,
+ b int NOT NULL,
+ filler char(100) DEFAULT NULL,
+ KEY a (a,b)
+) engine= myisam;
+
+insert into t1 values (0),(1),(2),(3),(4);
+insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B;
+
+explain select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+select * from t1, t2 where t2.a=t1.a and t2.b + 1;
+
+drop table t1,t2;
+--echo # End of test case for the bug#43600
+
=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test 2008-12-13 11:02:16 +0000
+++ b/mysql-test/t/partition_innodb.test 2009-09-08 09:51:31 +0000
@@ -6,6 +6,23 @@ drop table if exists t1;
--enable_warnings
#
+# Bug#47029: Crash when reorganize partition with subpartition
+#
+create table t1 (a int not null,
+ b datetime not null,
+ primary key (a,b))
+engine=innodb
+partition by range (to_days(b))
+subpartition by hash (a)
+subpartitions 2
+( partition p0 values less than (to_days('2009-01-01')),
+ partition p1 values less than (to_days('2009-02-01')),
+ partition p2 values less than (to_days('2009-03-01')),
+ partition p3 values less than maxvalue);
+alter table t1 reorganize partition p1,p2 into
+( partition p2 values less than (to_days('2009-03-01')));
+drop table t1;
+#
# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
# with partitions
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
=== added file 'mysql-test/t/subselect4.test'
--- a/mysql-test/t/subselect4.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/subselect4.test 2009-09-03 15:03:46 +0000
@@ -0,0 +1,32 @@
+# General purpose bug fix tests go here : subselect.test too large
+
+
+--echo #
+--echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown
+--echo # function,file sql_base.cc
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 VALUES (1,1),(2,2);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 VALUES (1,1),(2,2);
+CREATE TABLE t3 LIKE t1;
+
+--echo # should have 1 impossible where and 2 dependent subqueries
+EXPLAIN
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+
+--echo # should not crash the next statement
+SELECT 1 FROM t1
+WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
+ORDER BY count(*);
+
+--echo # should not crash: the crash is caused by the previous statement
+SELECT 1;
+
+DROP TABLE t1,t2,t3;
+
+
+--echo End of 5.0 tests.
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2009-09-04 04:12:46 +0000
+++ b/sql/ha_partition.cc 2009-09-08 09:51:31 +0000
@@ -708,6 +708,7 @@ int ha_partition::rename_partitions(THD
if (m_is_sub_partitioned)
{
List_iterator<partition_element> sub_it(part_elem->subpartitions);
+ j= 0;
do
{
sub_elem= sub_it++;
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-09-04 08:14:01 +0000
+++ b/sql/sql_select.cc 2009-09-08 09:51:31 +0000
@@ -2200,12 +2200,8 @@ JOIN::optimize()
}
}
- /*
- If this join belongs to an uncacheable subquery save
- the original join
- */
- if (select_lex->uncacheable && !is_top_level_join() &&
- init_save_join_tab())
+ /* If this join belongs to an uncacheable query save the original join */
+ if (select_lex->uncacheable && init_save_join_tab())
DBUG_RETURN(-1); /* purecov: inspected */
}
@@ -19237,7 +19233,10 @@ static int remove_dup_with_compare(THD *
if (error)
{
if (error == HA_ERR_RECORD_DELETED)
- continue;
+ {
+ error= file->rnd_next(record);
+ continue;
+ }
if (error == HA_ERR_END_OF_FILE)
break;
goto err;
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2009-08-18 11:04:32 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2009-09-08 08:06:49 +0000
@@ -63,7 +63,7 @@ static bool innodb_inited = 0;
static handlerton *innodb_hton_ptr;
C_MODE_START
-static my_bool index_cond_func_innodb(void *arg);
+static uint index_cond_func_innodb(void *arg);
C_MODE_END
@@ -8563,9 +8563,12 @@ ha_rows ha_innobase::multi_range_read_in
C_MODE_START
-/* Index condition check function to be called from within Innobase */
+/*
+ Index condition check function to be called from within Innobase.
+ See note on ICP_RESULT for return values description.
+*/
-static my_bool index_cond_func_innodb(void *arg)
+static uint index_cond_func_innodb(void *arg)
{
ha_innobase *h= (ha_innobase*)arg;
if (h->end_range)
@@ -8573,7 +8576,7 @@ static my_bool index_cond_func_innodb(vo
if (h->compare_key2(h->end_range) > 0)
return 2; /* caller should return HA_ERR_END_OF_FILE already */
}
- return (my_bool)h->pushed_idx_cond->val_int();
+ return test(h->pushed_idx_cond->val_int());
}
C_MODE_END
=== modified file 'storage/innobase/include/row0mysql.h'
--- a/storage/innobase/include/row0mysql.h 2009-07-28 14:16:37 +0000
+++ b/storage/innobase/include/row0mysql.h 2009-09-08 08:06:49 +0000
@@ -524,7 +524,7 @@ struct mysql_row_templ_struct {
#define ROW_PREBUILT_ALLOCATED 78540783
#define ROW_PREBUILT_FREED 26423527
-typedef my_bool (*index_cond_func_t)(void *param);
+typedef uint (*index_cond_func_t)(void *param);
/* A struct for (sometimes lazily) prebuilt structures in an Innobase table
handle used within MySQL; these are used to save CPU time. */
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-08-04 19:50:51 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-09-08 08:06:49 +0000
@@ -1504,15 +1504,15 @@ int ha_myisam::delete_row(const uchar *b
C_MODE_START
-my_bool index_cond_func_myisam(void *arg)
+ICP_RESULT index_cond_func_myisam(void *arg)
{
ha_myisam *h= (ha_myisam*)arg;
if (h->end_range)
{
if (h->compare_key2(h->end_range) > 0)
- return 2; /* caller should return HA_ERR_END_OF_FILE already */
+ return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
}
- return (my_bool)h->pushed_idx_cond->val_int();
+ return (ICP_RESULT) test(h->pushed_idx_cond->val_int());
}
C_MODE_END
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h 2009-08-03 17:47:05 +0000
+++ b/storage/myisam/ha_myisam.h 2009-09-08 08:06:49 +0000
@@ -35,7 +35,7 @@ extern TYPELIB myisam_recover_typelib;
extern ulong myisam_recover_options;
C_MODE_START
-my_bool index_cond_func_myisam(void *arg);
+ICP_RESULT index_cond_func_myisam(void *arg);
C_MODE_END
class ha_myisam: public handler
@@ -167,7 +167,7 @@ public:
Item *idx_cond_push(uint keyno, Item* idx_cond);
private:
DsMrr_impl ds_mrr;
- friend my_bool index_cond_func_myisam(void *arg);
+ friend ICP_RESULT index_cond_func_myisam(void *arg);
};
#if !defined(EMBEDDED_LIBRARY) && defined(HAVE_MYISAM_PHYSICAL_LOGGING)
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2009-08-03 17:47:05 +0000
+++ b/storage/myisam/myisamdef.h 2009-09-08 08:06:49 +0000
@@ -253,8 +253,7 @@ typedef struct st_mi_isam_share
my_bool MI_LOG_OPEN_stored_in_physical_log;
} MYISAM_SHARE;
-
-typedef my_bool (*index_cond_func_t)(void *param);
+typedef ICP_RESULT (*index_cond_func_t)(void *param);
/** Information local to the table's instance */
struct st_myisam_info
Attachment: [text/bzr-bundle]
| Thread |
|---|
| • bzr commit into mysql-pe branch (alfranio.correia:3509) | Alfranio Correia | 8 Sep |