Bug #52225 Alterting table with special characters in database or tablename crashes server
Submitted: 19 Mar 2010 16:21 Modified: 5 May 2010 7:23
Reporter: pedro oriani Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-5.1-telco-7.0 OS:Linux
Assigned to: Jonas Oreland CPU Architecture:Any
Tags: 5.1.41-ndb-7.0.13-cluster-gpl

[19 Mar 2010 16:21] pedro oriani
Description:
got crash after alterting charset

100319 17:11:44 [Note] NDB Binlog: RENAME Event: REPL$www@002etest/test
100319 17:12:39 [ERROR] NDB: programming error, no lock taken while running query ALTER TABLE `www.test`.`test` CHARACTER SET utf8 COLLATE utf8_general_ci. Message: ha_ndbcluster::create
100319 17:12:39 - mysqld got signal 6 ;
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=16777216
read_buffer_size=131072
max_used_connections=3
max_threads=151
threads_connected=3
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 345924 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x905fd78
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0xb09e8dfc thread_stack 0x20000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x3a)[0x85e738a]
/usr/local/mysql/bin/mysqld(handle_segfault+0x383)[0x824e1e3]
[0xb7fc8400]
/lib/i686/cmov/libc.so.6(abort+0x188)[0xb7df9018]
/usr/local/mysql/bin/mysqld(_Z38ndbcluster_no_global_schema_lock_abortP3THDPKc+0x5f)[0x841852f]
/usr/local/mysql/bin/mysqld(_ZN13ha_ndbcluster6createEPKcP8st_tableP24st_ha_create_information+0x2d4)[0x840e084]
/usr/local/mysql/bin/mysqld(_Z15ha_create_tableP3THDPKcS2_S2_P24st_ha_create_informationb+0x166)[0x834f5c6]
/usr/local/mysql/bin/mysqld(_Z16rea_create_tableP3THDPKcS2_S2_P24st_ha_create_informationR4ListI12Create_fieldEjP6st_keyP7handler+0xed)[0x8312abd]
/usr/local/mysql/bin/mysqld(_Z26mysql_create_table_no_lockP3THDPKcS2_P24st_ha_create_informationP10Alter_infobj+0xb3c)[0x83659dc]
/usr/local/mysql/bin/mysqld(_Z18mysql_create_tableP3THDPKcS2_P24st_ha_create_informationP10Alter_infobj+0x200)[0x8366010]
/usr/local/mysql/bin/mysqld(_Z22create_temporary_tableP3THDP8st_tablePcS3_P24st_ha_create_informationP10Alter_infob+0xc0)[0x8367400]
/usr/local/mysql/bin/mysqld(_Z17mysql_alter_tableP3THDPcS1_P24st_ha_create_informationP10TABLE_LISTP10Alter_infojP8st_orderb+0xe76)[0x836c156]
/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THD+0x9662)[0x82683a2]
/usr/local/mysql/bin/mysqld(_Z11mysql_parseP3THDPKcjPS2_+0x15b)[0x826942b]
/usr/local/mysql/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xe25)[0x826a345]
/usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0xe7)[0x826ae67]
/usr/local/mysql/bin/mysqld(handle_one_connection+0x25c)[0x825847c]
/lib/i686/cmov/libpthread.so.0[0xb7fac4c0]
/lib/i686/cmov/libc.so.6(clone+0x5e)[0xb7eac6de]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x9061728 = ALTER TABLE `www.test`.`test` CHARACTER SET utf8 COLLATE utf8_general_ci
thd->thread_id=4
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
create database `www.test`;
CREATE TABLE `www.test`.`test` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `test` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
ALTER TABLE `www.test`.`test` ENGINE = ndbcluster;
ALTER TABLE `www.test`.`test` CHARACTER SET utf8 COLLATE utf8_general_ci;
[22 Mar 2010 20:16] Sveta Smirnova
Thank you for the report.

Verified as described.
[3 May 2010 12:20] Jonas Oreland
Hi Sveta,

I've now tried repeating this for 10 minutes, wo/ succeeding ?
Both on 63-bzr, 70-bzr and 7.0.13

But,
- I used myisam instead of innodb, could you check if this makes a difference?
- Also I only tried debug compiled, what did you try ?

/Jonas
[4 May 2010 6:04] Sveta Smirnova
Jonas,

just tested with MyISAM and latest 7.1 from bzr. Still repeatable for me.

I use following test case for MTR:

$cat bug52225.test 
--source include/have_ndb.inc
#--source include/have_innodb.inc

create database `www.test`;
CREATE TABLE `www.test`.`test` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `test` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
ALTER TABLE `www.test`.`test` ENGINE = ndbcluster;
ALTER TABLE `www.test`.`test` CHARACTER SET utf8 COLLATE utf8_general_ci;
[4 May 2010 7:24] Jonas Oreland
now i got it...
[4 May 2010 7:32] Jonas Oreland
the problem is not charset related, but the fact the database-name contains
'.' it seems, renaming database from `www.test` to `wwwtest` make testcase pass.
[4 May 2010 7:34] Jonas Oreland
also, when using the database name `www.test`, add column, rename column, drop column all crash the same way.
[4 May 2010 10:18] Wojciech Bajorek
I just hit the same bug on 7.0.13 however in my case database name is not with "." but with "-".

When I removed this character from db name I'm able to do the changes on db without unexpected node restart.
[4 May 2010 13:03] 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/107315

3190 Jonas Oreland	2010-05-04
      bug#53409 (part of bug#52225) - fix arguments to mysql_frm_type, pass filename instead of tablename, this as cluster uses table_type for further processing
[4 May 2010 13:11] 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/107319

3191 Jonas Oreland	2010-05-04
      ndb - bug#52225
        in addition to fixing bug#53409, also handle tab/db-name vs. filename
        consistently wrt to replication (events)
        (for now settle on using tab/db-name instead of filename...which might
         actually be incorrect, but now it's atleast consistent)
[4 May 2010 13:27] Bugs System
Pushed into 5.1.44-ndb-7.0.15 (revid:jonas@mysql.com-20100504131650-so3jj5b5vqa8dfss) (version source revid:jonas@mysql.com-20100504131650-so3jj5b5vqa8dfss) (merge vers: 5.1.44-ndb-7.0.15) (pib:16)
[4 May 2010 13:28] Bugs System
Pushed into 5.1.44-ndb-6.3.34 (revid:jonas@mysql.com-20100504130906-vsp23m8380itegak) (version source revid:jonas@mysql.com-20100504130906-vsp23m8380itegak) (merge vers: 5.1.44-ndb-6.3.34) (pib:16)
[4 May 2010 14:02] Jonas Oreland
pushed to 6.3.34, 7.0.15 and 7.1.4
[5 May 2010 7:19] Jon Stephens
Documented in the NDB-6.3.34, 7.0.15, and 7.1.4 changelogs, as follows:

      ALTER TABLE did not work correctly where the name of the table, 
      the database, or both contained special characters, causing the 
      MySQL server to crash.

      See also BUG#53409, BUG#14959.

Closed.
[6 Jan 2011 8:46] 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/128052

3229 Tatiana Azundris Nurnberg	2011-01-06
      Bug#53409: Alter table can't rename a view with special characters
      Bug#14959
      Bug#52225
      
      Add missing test case for regular (non-NDB) server.
      We now try to handle database names with periods etc. correctly in ALTER.
     @ mysql-test/r/rename.result
        test
     @ mysql-test/t/rename.test
        test