Bug #31293 create logfile group/tablespace returns OK with warning when engine=myisam
Submitted: 29 Sep 2007 16:57 Modified: 13 Oct 2010 15:13
Reporter: Matthew Montgomery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.1.22-ndb-6.3.2-telco-log OS:Any
Assigned to: CPU Architecture:Any

[29 Sep 2007 16:57] Matthew Montgomery
Description:
mysqld returns OK status with a warning from CREATE LOGFILE GROUP... ENGINE=MYISAM and CREATE TABLESPACE... ENGINE=MYISAM; 

How to repeat:
mysql> select @@storage_engine; 
+------------------+
| @@storage_engine |
+------------------+
| MyISAM           | 
+------------------+
1 row in set (0.00 sec)

mysql> create logfile group ndb_lg1 add undofile 'ndb_undo1' initial_size=32M; 
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings; 
+-------+------+------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                        |
+-------+------+------------------------------------------------------------------------------------------------+
| Error | 1475 | Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' | 
+-------+------+------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

This should not return OK but should show the warning as error.

mysql> create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

This should returns an error which is good but it should be error code 1475

Suggested fix:
Make "Error" level code appear as error instead of Warning.
[29 Sep 2007 16:58] MySQL Verification Team
mysql> create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings; 
+-------+------+------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                        |
+-------+------+------------------------------------------------------------------------------------------------+
| Error | 1475 | Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' |
+-------+------+------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
[29 Sep 2007 17:15] MySQL Verification Team
This extends to DROP TABLESPACE and DROP LOGFILE GROUP

mysql> drop tablespace ndb_ts1; 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

This should not be considered a syntax error.  @@storage_engine should be used in this case.

mysql> drop tablespace ndb_ts1 engine=myisam; 
Query OK, 0 rows affected, 1 warning (0.00 sec)
[18 Oct 2007 10:14] Sveta Smirnova
Thank you for the report.

Verified inconsisntence between documentation and current server behaviour.

1. http://dev.mysql.com/doc/refman/5.1/en/create-logfile-group.html:

> CREATE LOGFILE GROUP logfile_group
> ...
>   ENGINE [=] engine_name

Engine listed as required part of query, but is not required really.

> The ENGINE parameter determines the storage engine to be used by this log file > group, with engine being the name of the storage engine. In MySQL 5.1. engine > must be one of the values NDB or NDBCLUSTER.

If one say "must" user can think error must occurs instead of warning.

For CREATE TABLESPACE same inconsistence between engine value and warning instead of error.
[7 May 2009 12:22] Jon Olav Hauglid
Tried to replicate this bug using the mysql-6.0-runtime tree.

mysql> select @@storage_engine; 
+------------------+
| @@storage_engine |
+------------------+
| MyISAM           | 
+------------------+
1 row in set (0.00 sec)

mysql> create logfile group ndb_lg1 add undofile 'ndb_undo1' initial_size=32M; 
ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'

So it seems this has already been fixed.

mysql> create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at line 1

According to the reference manual, this seems like the correct behaviour since the ENGINE parameter is not optional. Should we change this?

mysql> create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at line 1

If ENGINE is added, we get the correct error.
[7 May 2009 12:27] Jon Olav Hauglid
I managed to add the wrong error message for the final statement:

mysql> create tablespace ndb_ts1 add datafile 'ndb_ts1.dat' use logfile group ndb_lg1 engine=myisam;
ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
mysql> Aborted
[7 May 2009 13:24] Jon Olav Hauglid
More testing - still mysql-6.0-runtime tree and engine=myisam

I have tested create/alter/drop logfile group/tablespace with different combinations of clauses.

They all have report error messages in the following way.
With no extra clauses added, they all report syntax error (1064).
From the reference manual, ENGINE= is listed as required, so this makes sense.

If ENGINE= or any other clause is added, you get: 
ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
Error message says 'create option' regardless of create/alter/drop.

Note that the syntax error disappears even if any other (optional) clause is added. E.g. create logfile group test add undofile 'undo.dat' wait;
does not give syntax error, but ERROR 1478 even if ENGINE= is listed as required while WAIT is not.

So while the reporting of ERROR 1478 seems appropriate, the syntax error checking does not.
[8 May 2009 8:33] 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/73643

2772 Jon Olav Hauglid	2009-05-08
      Bug #31293 create logfile group/tablespace returns OK with warning 
                  when engine=myisam
            
      Bug title slightly misleading. The problem was that syntax 
      errors (1064) were mistakenly generated for the following statements:
      CREATE TABLESPACE
      ALTER TABLESPACE
      DROP TABLESPACE
      CREATE LOGFILE GROUP
      ALTER LOGFILE GROUP
      DROP LOGFILE GROUP
      
      These statments used without any extra clauses gave syntax errors. 
      Adding one or more clauses would remove the syntax error, even if 
      those clauses are all defined as optional. The fix changes the 
      grammar to accept statements without extra clauses so that the 
      above statments give the proper error message used with engine=myisam:
      ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the 
      create option 'TABLESPACE or LOGFILE GROUP'
      
      Note that the ENGINE clause was optional before this fix even if this
      does not match the current version of the reference manual where it
      is marked as required.
      
      Test parser_bug31293 added. Contains various statements that should
      give error 1478, but before gave syntax error.
[8 May 2009 13:34] 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/73654

2772 Jon Olav Hauglid	2009-05-08
      Bug #31293 create logfile group/tablespace returns OK with warning 
      when engine=myisam
            
      Bug title slightly misleading. The problem was that syntax 
      errors (1064) were mistakenly generated for the following statements:
      CREATE TABLESPACE
      ALTER TABLESPACE
      DROP TABLESPACE
      CREATE LOGFILE GROUP
      ALTER LOGFILE GROUP
      DROP LOGFILE GROUP
      
      These statments used without any extra clauses gave syntax errors. 
      Adding one or more clauses would remove the syntax error, even if 
      those clauses are all defined as optional. The fix changes the 
      grammar to accept statements without extra clauses so that the 
      above statments give the proper error message used with engine=myisam:
      ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the 
      create option 'TABLESPACE or LOGFILE GROUP'
      
      Note that the ENGINE clause was optional before this fix even if this
      does not match the current version of the reference manual where it
      is marked as required. The manual should therefore be updated marking
      the ENGINE clause as optional for all statements listed above.
      
      Parser.test appended with a test of various statements that should
      give error 1478 ER_ILLEGAL_HA_CREATE_OPTION, but before gave syntax error.
[16 May 2009 8:41] Bugs System
Pushed into 6.0.12-alpha (revid:alik@sun.com-20090516083402-0avycdy7w6dnn0tv) (version source revid:serg@mysql.com-20090512164111-jz224w5781lhe7wd) (merge vers: 6.0.12-alpha) (pib:6)
[27 May 2009 14:39] Jon Stephens
Set category to Cluster so this will appear in my queue -- I'll return to DDL when I close.
[27 May 2009 17:31] Jon Stephens
Documented in the 6.0.12 changelog as follows:

        The following statements generated an incorrect and confusing
        error message when used with ENGINE=MyISAM:

        CREATE TABLESPACE 
        ALTER TABLESPACE 
        DROP TABLESPACE
        CREATE LOGFILE GROUP
        ALTER LOGFILE GROUP
        DROP LOGFILE GROUP

        Such statements now fail with Error 1478: Table storage engine
        'MyISAM' does not support the create option 'TABLESPACE or
        LOGFILE GROUP'.
[27 May 2009 17:41] Jon Stephens
Hi,

I'm setting this bug back to Open, and asking that it be backported to recent Cluster trees (6.3/7.0+).

Reason: These statements currently are useful only with NDBCLUSTER tables, so if they're used incorrectly, a Cluster user should be given an accurate error message.

Thanks!
[10 Mar 2010 15:34] Jon Olav Hauglid
The patch from this bug has not been backported from 6.0 yet
as it depends on the fix for bug#31110 .
[15 Mar 2010 14:53] 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/103275

3128 Jon Olav Hauglid	2010-03-15
      Backport of:
          ------------------------------------------------------------
          revno: 2617.31.30
          committer: Jon Olav Hauglid <jon.hauglid@sun.com>
          branch nick: mysql-6.0-runtime-bugged
          timestamp: Fri 2009-05-08 15:34:08 +0200
          message:
            Bug #31293 create logfile group/tablespace returns OK with warning 
            when engine=myisam
                  
            Bug title slightly misleading. The problem was that syntax 
            errors (1064) were mistakenly generated for the following statements:
            CREATE TABLESPACE
            ALTER TABLESPACE
            DROP TABLESPACE
            CREATE LOGFILE GROUP
            ALTER LOGFILE GROUP
            DROP LOGFILE GROUP
            
            These statments used without any extra clauses gave syntax errors. 
            Adding one or more clauses would remove the syntax error, even if 
            those clauses are all defined as optional. The fix changes the 
            grammar to accept statements without extra clauses so that the 
            above statments give the proper error message used with engine=myisam:
            ERROR 1478 (HY000): Table storage engine 'MyISAM' does not support the 
            create option 'TABLESPACE or LOGFILE GROUP'
            
            Note that the ENGINE clause was optional before this fix even if this
            does not match the current version of the reference manual where it
            is marked as required. The manual should therefore be updated marking
            the ENGINE clause as optional for all statements listed above.
            
            Parser.test appended with a test of various statements that should
            give error 1478 ER_ILLEGAL_HA_CREATE_OPTION, but before gave syntax error.
[15 Mar 2010 15:14] Jon Olav Hauglid
Backported from 6.0 to mysql-next-mr-bugfixing (Ver 5.6.99-m4).
[24 Mar 2010 8:14] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100324081249-yfwol7qtcek6dh7w) (version source revid:alik@sun.com-20100324081113-kc7x1iytnplww91u) (merge vers: 6.0.14-alpha) (pib:16)
[24 Mar 2010 8:17] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100324081159-5b8juv8ldiqwce8v) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (pib:16)
[6 Apr 2010 11:57] Jon Stephens
Still waiting for this to show up in 5.1/5.1-telco.
[4 Aug 2010 8:02] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:18] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100324081105-y72rautcea375zxm) (merge vers: 5.6.99-m4) (pib:18)
[5 Aug 2010 7:47] Jon Stephens
Setting back to open and asking that this fix along with fix for BUG#31110 be merged to Cluster.

See my previous comment about this.

Note also that 

(a) this bug was originally reported in Cluster/6.3 nearly three years ago

(b) a fix has been available for over a year now

(c) this fix is still not available in the product where it was originally reported.

(1) + (2) + (3) = FAIL.

'Nuff said.

Changed lead to BOcklin and asking that this fix be merged to telco trees ASAP.