2687 Tomas Ulin 2008-10-06
bug #39872 - explain causes segv
modified:
mysql-test/suite/ndb/r/ndb_basic.result
mysql-test/suite/ndb/t/ndb_basic.test
sql/ha_ndbcluster.cc
2686 Jonas Oreland 2008-10-04
ndb - fix two testcase issues
1) lingering mysqlslap database in ndb_alter_table_onlin2
2) interaction with ndb_restore -e in rpl_ndb_apply_status
Both of these bugs was exposed when changing order of tests run
modified:
mysql-test/suite/ndb/r/ndb_alter_table_online2.result
mysql-test/suite/ndb/t/ndb_alter_table_online2.test
mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result
mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test
=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result 2008-04-09 19:43:15 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result 2008-10-06 11:01:04 +0000
@@ -923,4 +923,24 @@ create table if not exists t1 (a int not
create table t2 like t1;
rename table t1 to t10, t2 to t20;
drop table t10,t20;
+#
+# bug #39872 - explain causes segv
+# (ndb_index_stat_enable=1 must be set to trigger bug)
+#
+set ndb_index_stat_enable=1;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=utf8;
+CREATE TABLE `t2` (
+`id` int(11) NOT NULL,
+`obj_id` int(11) DEFAULT NULL,
+UNIQUE KEY `id` (`id`),
+KEY `obj_id` (`obj_id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=utf8;
+# here we used to segv
+explain SELECT t1.id FROM t1 INNER JOIN t2 ON t1.id = t2.id WHERE t2.obj_id=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const
tables
+drop table t1, t2;
End of 5.1 tests
=== modified file 'mysql-test/suite/ndb/t/ndb_basic.test'
--- a/mysql-test/suite/ndb/t/ndb_basic.test 2007-11-08 09:24:31 +0000
+++ b/mysql-test/suite/ndb/t/ndb_basic.test 2008-10-06 11:01:04 +0000
@@ -858,4 +858,23 @@ create table t2 like t1;
rename table t1 to t10, t2 to t20;
drop table t10,t20;
+--echo #
+--echo # bug #39872 - explain causes segv
+--echo # (ndb_index_stat_enable=1 must be set to trigger bug)
+--echo #
+set ndb_index_stat_enable=1;
+CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=utf8;
+CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `obj_id` int(11) DEFAULT NULL,
+ UNIQUE KEY `id` (`id`),
+ KEY `obj_id` (`obj_id`)
+) ENGINE=ndbcluster DEFAULT CHARSET=utf8;
+--echo # here we used to segv
+explain SELECT t1.id FROM t1 INNER JOIN t2 ON t1.id = t2.id WHERE t2.obj_id=1;
+drop table t1, t2;
+
--echo End of 5.1 tests
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2008-10-02 15:53:21 +0000
+++ b/sql/ha_ndbcluster.cc 2008-10-06 11:01:04 +0000
@@ -3811,6 +3811,14 @@ int ha_ndbcluster::rnd_init(bool scan)
int ha_ndbcluster::close_scan()
{
+ /*
+ workaround for bug #39872 - explain causes segv
+ - rnd_end/close_scan is called on unlocked table
+ - should be fixed in server code, but this will
+ not be done until 6.0 as it is too intrusive
+ */
+ if (m_thd_ndb == NULL)
+ return 0;
NdbTransaction *trans= m_thd_ndb->trans;
int error;
DBUG_ENTER("close_scan");
| Thread |
|---|
| • bzr push into mysql-5.1 branch (tomas.ulin:2686 to 2687) Bug#39872 | Tomas Ulin | 6 Oct |