Bug #53241 innodb_plugin (1.0.7 at 5.1.46) doesn't pass innodb.test of innodb_plugin-1.0.6
Submitted: 28 Apr 2010 9:51 Modified: 3 May 2010 18:58
Reporter: Yasufumi Kinoshita Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:5.1.46 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[28 Apr 2010 9:51] Yasufumi Kinoshita
Description:
mysql-5.1.46 using bundled innodb_plugin (1.0.7) doesn't pass innodb.test of 1.0.6

overwrite t/innodb.test and r/innodb.result with the files in innodb_plugin-1.0.6.tar.gz

===
main.innodb                              [ fail ]
        Test ended at 2010-04-28 18:41:07

CURRENT_TEST: main.innodb
mysqltest: At line 432: query 'alter table t1 drop index sca_pic, add index (sca_pic, cat_code)' failed: 1280: Incorrect index name 'sca_pic'
====

It may be side effect of the fix of Bug #49838

How to repeat:
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null;
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';

alter table t1 drop index sca_pic, add index (sca_pic, cat_code);

Suggested fix:
Is it change of the specification?

If "drop index" and "add index" for the same name are given to "alter table" at the same time,
"drop table" is prior to be executed?

If so, it should be documented to the manual explicitly.

Thank you.
[28 Apr 2010 20:16] Sveta Smirnova
Thank you for the report.

Verified as described.
[29 Apr 2010 14:08] Mikhail Izioumtchenko
This appears to be related to bug#51451, see the comments in 5.1.46 version
of the test like this:

# this should be fixed by MySQL (see Bug #51451)
# now that http://bugs.mysql.com/49838 is fixed the following ALTER does
# copy the table instead of failing
# --error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';
...
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);

Technically speaking, a product not passing an old version of the test 
is hardly a bug. Bug#51451 is closed as a duplicate of Bug#49838.
We have two choices here: 
1. declare it not a bug
2. make it a duplicate or replacement of bug#51451 which complains that
in ALTER ... DROP ... ADD mysql executes ADD first while 
it could be more natural to execute the clauses in the order they appear
in ALTER. 

In the latter case the fix should be in MySQL code so I switch the category
to DDL.
[3 May 2010 19:00] Omer Barnir
Duplicate of bug#51451
Problem is caused by the actions in the alter not being performed in the order they are listed (Add done before the drop - causing the error message).
[1 Jul 2010 6:48] Ben Krug
I don't think this is a duplicate.  Why does it happen on 5.1.46, when the mentioned duplicate bugs were supposedly fixed in 5.1.46?

See bug # 54927 for more detail on what is causing this exactly.