Bug #42752 Error when creating Falcon temporary table with a key
Submitted: 11 Feb 2009 7:55 Modified: 26 May 2010 17:47
Reporter: Dmitry Lenev Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.10-bzr-debug OS:Linux (SUSE 10.0)
Assigned to: Olav Sandstå CPU Architecture:Any
Tags: F_HANDLER
Triage: Triaged: D2 (Serious)

[11 Feb 2009 7:55] Dmitry Lenev
Description:
Attempt to create temporary Falcon table with a key fails. This does not happen all the time, but is totally repeatable in PB or when the test below is run under MTR2. See how-to-repeat for details.

How to repeat:
# Script for 'mysqltest' tool which reproduces the problem.
--source include/have_falcon.inc
set storage_engine= Falcon;
let $engine_type= Falcon;

--disable_warnings
drop table if exists t2;
--enable_warnings
# Emits "ERROR 1005: Can't create table 'test.t2' (errno: 124)"
create temporary table t2 (s1 int, key(s1));
[11 Feb 2009 8:35] Sveta Smirnova
Thank you for the report.

Verified as described. Bug is not repeatable with version 6.0.8
[25 Apr 2009 2:42] Olav Sandstå
This failure was introduced into the falcon-team tree by the following merge:

revno: 2995
committer: Hakan Kuecuekyilmaz <hky@sun.com>
branch nick: mysql-6.0-falcon-team
timestamp: Tue 2009-02-03 21:54:37 +0100

This was a down-merge from mysql-6.0->mysql6.0-falcon->mysql-6.0-falcon-team. It contains the new MTR2 version. 

So this regression seems to be triggered by changes in how to test is run or the test environment. More investigations to follow.
[28 Apr 2009 1:22] Olav Sandstå
The bug is highlighted by a change in MTR2. With MTR1 the following "mySqlName" is passed into StorageInterface::create:

  /home/olav/mysql/develop/olav-2994/mysql-test/var/tmp/#sql23ff_1_0

while with MTR2 the "mySqlName" is:

 /home/olav/mysql/develop/olav-2995/mysql-test/var/tmp/mysqld.1/#sql2d05_2_0

Using these two, Falcon uses a schemaName = TMP in the first case and schemaName = MYSQLD.1 in the second case.

The failure occurs when Falcon tries to create an index on the table by constructing the following SQL statement:

 create index "#SQL2D05_2_0$S1" on MYSQLD.1."#SQL2D05_2_0" ("S1")

When Falcon parses this statement the following error is created internally in Falcon:

  syntax error on line 1
  create index "#SQL2D05_2_0$S1" on MYSQLD.1."#SQL2D05_2_0" ("S1")
  ^ expected name list got .1

In above SQL string everything except the schema name is "quoted". The quoting occurs in the following code in StorageInterface::createIndex() in ha_falcon.cpp:

  gen.gen("create %sindex \"%s\" on %s.\"%s\" ", unique, indexDesc.name, schemaName, tableName);

BTW: removing the "regression" tag since this is an exiting bug and not a regression in Falcon.
[30 Apr 2009 8:35] 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/73089

2696 Olav.Sandstaa@sun.com	2009-04-30
      Fix for Bug#42752 Error when creating Falcon temporary table with a key
      
      The cause for this bug was that the schema name contained a "." (like: 
      mysql.1) and when creating an index using this schema name in the create
      index statement the schema name was un-qouted which lead to the Falcon
      parser issuing an error.
      
      The fix adds qoutes around the schema name in Falcon's create index
      statements.
      
      A test case for the bug is included.