Bug #22972 Falcon: Partitioned table with pending transaction leads to strange error
Submitted: 4 Oct 2006 5:52 Modified: 9 Jan 2008 14:29
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:6.0 OS:Linux (Linux 32-bit)
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: error message alter pending transaction

[4 Oct 2006 5:52] Hakan Küçükyılmaz
Description:
Running Linux 32-bit, change set 1.2364, 2006-10-03.

Partitioned table with pending transaction leads to strange error

How to repeat:
Connection 1:
CREATE TABLE t1 (a int) PARTITION BY LIST (a) (PARTITION p1 VALUES in (1));
SET @@autocommit = 0;
START TRANSACTION;

Connection2:
SET @@autocommit = 0;
START TRANSACTION;
INSERT INTO t1 VALUES (1);

Connection 1:
[07:48] root@test>DROP TABLE t1;
ERROR 1051 (42S02): Unknown table 't1'

[07:48] root@test>show create table t1;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                         |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE "t1" (
  "a" int(11) DEFAULT NULL
) ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = Falcon) */ |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

[07:48] root@test>DROP TABLE t1;
ERROR 1051 (42S02): Unknown table 't1'

Connection 2:
COMMIT;

CONNECTION 1:
[07:49] root@test>DROP TABLE t1;
Query OK, 0 rows affected (0.11 sec)

Suggested fix:
Trying to drop table with pending transaction should give error message like:
ERROR 1296 (HY000): Got error 156 'table test.T1#P#P1 has uncommitted updates and
can't be dropped' from Falcon.
[27 Feb 2007 15:44] MySQL Verification Team
Hi Hakan,

I was unable to repeat this bug with latest source. Could you please
try to test again. Thanks in advance.
[27 Mar 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[28 Mar 2007 0:07] Hakan Küçükyılmaz
I am still able to reproduce this:

Connection 1:
[02:05] root@test>CREATE TABLE t1 (a int) PARTITION BY LIST (a) (PARTITION p1 VALUES in (1));
Query OK, 0 rows affected (1.56 sec)

[02:05] root@test>SET @@autocommit = 0;
Query OK, 0 rows affected (0.00 sec)

[02:05] root@test>START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

Connection 2:
[02:05] root@test>SET @@autocommit = 0;
Query OK, 0 rows affected (0.00 sec)

[02:05] root@test>START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

[02:05] root@test>INSERT INTO t1 VALUES (1);
Query OK, 1 row affected (0.01 sec)

Connection 1:
[02:05] root@test>DROP TABLE t1;
ERROR 1051 (42S02): Unknown table 't1'

But show create table works:

[02:05] root@test>show create table t1;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                         |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE "t1" (
  "a" int(11) DEFAULT NULL
) ENGINE=Falcon DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = Falcon) */ |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.33 sec)

Best regards, Hakan
[17 Apr 2007 13:03] Hakan Küçükyılmaz
Miguel,

I still can reproduce this issue. I am running transaction isolation READ-COMMITTED. Maybe you can try again?
[17 Apr 2007 13:49] MySQL Verification Team
Ok. Now I was able to repeat:
T1>DROP TABLE t1;
ERROR 1051 (42S02): Unknown table 't1'
T1>
[7 Jun 2007 15:21] Kevin Lewis
The error code that occurs when 'drop table' is issued while transactional changes are pending is;
	ERROR 1051 (42S02): Unknown table 't1'
This is provided to us by mysql_rm_table_part2() in sql/sql_table.cc and it occurs regardless of what error Falcon chooses to return.  Falcon can report that the moon is green and this same error will occur. 

The server ought to be changed here to recognize a lock conflict.  It also should have a default case when it does not recognize the storage engine code that is more general and propagates the storage engine code and text.
[19 Jun 2007 16:43] Hakan Küçükyılmaz
Related to Bug#989
[2 Jul 2007 15:26] Calvin Sun
Wrong error code. Change to P3.
[2 Nov 2007 16:17] Calvin Sun
note: bug#24024 is made a dup of this one. Please verify 24024 also when fixing this one.
[20 Nov 2007 1:45] Hakan Küçükyılmaz
Error still happens, even without a partitioned table.

How to repeat:

Connection 1:
[02:47] root@(none)>create schema test; use test;
Query OK, 1 row affected (0.00 sec)

Database changed

[02:47] root@test>CREATE TABLE t1 (a int) Engine Falcon;                                                                           Query OK, 0 rows affected (0.65 sec)

[02:48] root@test>SET @@autocommit = 0;
Query OK, 0 rows affected (0.00 sec)

[02:48] root@test>START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

Connection 2:
[02:48] root@test>SET @@autocommit = 0;
Query OK, 0 rows affected (0.00 sec)

[02:48] root@test>START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

[02:48] root@test>INSERT INTO t1 VALUES (1);
Query OK, 1 row affected (0.00 sec)

Connection 1:
[02:48] root@test>DROP TABLE t1;
ERROR 1051 (42S02): Unknown table 't1'
[28 Nov 2007 14:05] 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/38700

ChangeSet@1.2695, 2007-11-28 18:07:24+04:00, svoj@mysql.com +5 -0
  BUG#22972 - Falcon: Partitioned table with pending transaction leads to
              strange error
  
  Falcon cannot drop a table with pending transaction and error
  message is misleading.
  
  With this fix Falcon returns descriptive warning.
[28 Nov 2007 15:33] Kevin Lewis
The patch looks good to me from the Falcon side. Since there are two reviewers, Sergei can change this to patch approved.
[3 Dec 2007 17:15] Bugs System
Pushed into 6.0.4-alpha
[9 Jan 2008 14:29] Paul DuBois
Noted in 6.0.4 changelog.

Falcon cannot drop a table for which there is a pending transaction,
but the error message for such attempts was misleading.
[9 Sep 2008 12:38] John Embretsen
Note that the error message is still misleading. The improvement was that Falcon now issues a warning with a proper description of the situation.

Is there another bug logged against the server for this issue?

If not, should there be one, or should this bug be reopened? After all, category is "Server: Errors"...

(See also Bug#22183 and Bug#24024.)