On Mo, 2009-02-23 at 16:21 +0000, Vladislav Vaintroub wrote:
> #At file:///G:/bzr/ts2/ based on
> revid:vvaintroub@stripped
>
> 3030 Vladislav Vaintroub 2009-02-23
> Bug#42478 : Falcon crash in Database::updateSequence
>
> The problem: when a Falcon table with autoincrement column is created
> ,Falcon will assign a sequence to table name /schema name combination.
> and use it to generate autoincrement values. When table is renamed,
> sequence is modified (table name changed). However, schema name changes
> are not taken into account when renaming.
>
> This is be a problem, because
> a) Falcon data dictionary (sequences table) is now corrupt.
> b) hash table sequences will have duplicate entries if there is
> a table with the same name and different schema. drop table may
> drop a wrong sequence.
> === added file 'mysql-test/suite/falcon/t/falcon_bug_42478.test'
> --- a/mysql-test/suite/falcon/t/falcon_bug_42478.test 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/falcon/t/falcon_bug_42478.test 2009-02-23 16:21:49 +0000
> @@ -0,0 +1,54 @@
> +--source include/have_falcon.inc
> +
> +#
> +# Bug #42478 Falcon crash in Database::updateSequence
> +#
> +# The reason for the crash is broken handling or rename
> +# cross database/schema boundaries (Falcon sequences
> +# disregard schema name on rename)
> +# This test uses rename, equal table names and different
> +# database/schema names to make the error apparent
> +
> +--echo *** Bug #42478 ***
> +
> +# ----------------------------------------------------- #
> +# --- Initialisation --- #
> +# ----------------------------------------------------- #
> +let $engine = 'Falcon';
> +eval SET @@storage_engine = $engine;
> +
> +--disable_warnings
> +DROP TABLE IF EXISTS t1;
> +--enable_warnings
Please make sure, that you start with a clean state. Add
DROP SCHEMA IF EXISTS d1;
DROP SCHEMA IF EXISTS d2;
> +
> +# ----------------------------------------------------- #
> +# --- Test --- #
> +# ----------------------------------------------------- #
> +
> +CREATE DATABASE d1;
> +CREATE DATABASE d2;
> +
> +CREATE TABLE t1 (i INT AUTO_INCREMENT, PRIMARY KEY(i));
> +RENAME TABLE t1 TO d1.t1;
> +
> +CREATE TABLE t1 (i INT AUTO_INCREMENT, PRIMARY KEY(i));
> +RENAME TABLE t1 TO d2.t1;
> +
> +INSERT INTO d1.t1 VALUES();
> +INSERT INTO d2.t1 VALUES();
> +
> +
> +# ----------------------------------------------------- #
> +# --- Check --- #
> +# ----------------------------------------------------- #
> +SHOW CREATE TABLE d1.t1;
> +SHOW CREATE TABLE d2.t1;
> +
> +# ----------------------------------------------------- #
> +# --- Final cleanup --- #
> +# ----------------------------------------------------- #
> +DROP TABLE d1.t1;
> +DROP TABLE d2.t1;
> +
> +DROP DATABASE d1;
> +DROP DATABASE d2;
>
Best,
Hakan
--
Hakan Küçükyılmaz, Senior Software Engineer DBTG/MySQL +49 160
98953296
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028 49.011, 8.376