Bug #39872 mysqld is restarted when execute EXPLAIN ...
Submitted: 6 Oct 2008 8:14 Modified: 7 Oct 2008 12:12
Reporter: ws lee Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:mysql5.1.27-ndb6.3.17 OS:Solaris
Assigned to: CPU Architecture:Any

[6 Oct 2008 8:14] ws lee
Description:
i have 2 data node.(NoOfReplicas=2)

mysqld is restarted when execute EXPLAIN ...
error log of this time is below.

081006 16:49:59 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388600
read_buffer_size=131072
max_used_connections=1
max_threads=500
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1101188 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

081006 16:50:00 mysqld_safe mysqld restarted
081006 16:50:00 [Note] Plugin 'BLACKHOLE' disabled by command line option
081006 16:50:00 [Note] Plugin 'InnoDB' disabled by command line option
081006 16:50:00 [Note] NDB: NodeID is 6, management server 'localhost'
081006 16:50:01 [Note] NDB[0]: no storage nodes connected (timed out)
081006 16:50:01 [Warning] NDB: server id set to zero will cause any other mysqld with bin log to log with wrong server id
081006 16:50:01 [Note] Starting Cluster Binlog Thread
081006 16:50:01 [Note] Event Scheduler: Loaded 0 events
081006 16:50:01 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.1.27-ndb-6.3.17-cluster-gpl-log'  socket: '/tmp/mysql.sock'  port: 3307  MySQL Cluster Server (GPL)
2008-10-06 16:50:04 [NdbApi] INFO     -- Flushing incomplete GCI:s < 27159/9

How to repeat:
drop table t1;

CREATE TABLE `t1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8;

drop table t2;

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;

mysql> explain SELECT t1.id FROM t1 INNER JOIN t2 ON t1.id = t2.id  WHERE t2.obj_id=1;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[6 Oct 2008 8:56] ws lee
In addition,
in my.cnf 
ndb_index_stat_enable=1

affer upper setting, please check.
[6 Oct 2008 9:51] Tomas Ulin
./mtr --mysqld=--ndb-index-stat-enable=1 --start-and-exit --debug ndb_binlog_basic

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;
mysql> explain SELECT t1.id FROM t1 INNER JOIN t2 ON t1.id = t2.id 
WHERE t2.obj_id=1;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[6 Oct 2008 11:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55436

2687 Tomas Ulin	2008-10-06
      bug #39872 - explain causes segv
[6 Oct 2008 11:04] Tomas Ulin
fixed in 6.2.16 and 6.3.19
[7 Oct 2008 12:12] Jon Stephens
Documented bug fix in the NDB-6.216 and NDB-6.3.19 changelogs as follows:

        Executing EXPLAIN SELECT on an NDBCLUSTER table could cause mysqld to
        crash.
[8 Oct 2008 12:28] Jon Stephens
Correct version number for ndb-6.2 fix is 6.2.16.
[12 Dec 2008 23:29] Bugs System
Pushed into 6.0.7-alpha  (revid:tomas.ulin@sun.com-20081006110104-e983qm89ggl9cotv) (version source revid:tomas.ulin@sun.com-20081015121427-mqe9vyomt1jroewp) (pib:5)