Bug #8867 ALTER TABLE RENAME strips symlinked .MYI filename partially
Submitted: 1 Mar 2005 15:13 Modified: 6 Apr 2006 17:12
Reporter: Eugene Vedistchev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:4.0.18, 4.1.7 OS:FreeBSD (FreeBSD 4.9, FreeBSD 5.3)
Assigned to: CPU Architecture:Any

[1 Mar 2005 15:13] Eugene Vedistchev
Description:
ALTER TABLE RENAME strips symlinked .MYI filename with colon(:) partially.

How to repeat:
1. Create MyISAM table with index(.MYI) located in another location:

CREATE TABLE  testflows ( router_id    TINYINT   UNSIGNED NOT NULL, 
                in_if_id     MEDIUMINT UNSIGNED NOT NULL, 
                out_if_id    MEDIUMINT UNSIGNED NOT NULL, 
                timestamp    DATETIME           NOT NULL, 
                src_addr     INT       UNSIGNED NOT NULL, 
                dst_addr     INT       UNSIGNED NOT NULL, 
                d_pkts   INT UNSIGNED NOT NULL, 
                d_octets INT UNSIGNED NOT NULL,
		protocol     MEDIUMINT UNSIGNED NOT NULL, 
                src_port     MEDIUMINT UNSIGNED NOT NULL,
                dst_port     MEDIUMINT UNSIGNED NOT NULL,
                src_as       MEDIUMINT UNSIGNED NOT NULL,
                dst_as       MEDIUMINT UNSIGNED NOT NULL)
                 INDEX DIRECTORY='/mnt/disk1/index';

ls -la /var/db/mysql/netflow/testflow*

-rw-rw----  1 mysql  mysql            0 Mar  1 16:52 testflows.MYD
lrwxrwx--x  1 mysql  mysql           30 Mar  1 16:52 testflows.MYI -> /mnt/disk1/index/testflows.MYI
-rw-rw----  1 mysql  mysql         8940 Mar  1 16:52 testflows.frm

2.  ALTER TABLE `testflows` RENAME `testflows-20050301-14:07:10`;

ls -la /var/db/mysql/netflow/testflow*

-rw-rw----  1 mysql  mysql            0 Mar  1 16:52 testflows-20050301-14:07:10.MYD
lrwxrwx--x  1 mysql  mysql           23 Mar  1 16:52 testflows-20050301-14:07:10.MYI -> /mnt/disk1/index/10.MYI
-rw-rw----  1 mysql  mysql         8940 Mar  1 16:52 testflows-20050301-14:07:10.frm

The testflows files  renamed, but index filename is stripped.

I've to rotate these files daily in same  time and all of them got same filename:

-rw-rw----  1 mysql  mysql    631519965 Feb 15 00:51 flows-20050215-01:25:00.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 15 01:25 flows-20050215-01:25:00.MYI -> /mnt/disk1/index/00.MYI
-rw-rw----  1 mysql  mysql         8940 Feb 14 01:25 flows-20050215-01:25:00.frm
-rw-rw----  1 mysql  mysql    601769106 Feb 16 00:51 flows-20050216-01:25:00.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 16 01:25 flows-20050216-01:25:00.MYI -> /mnt/disk1/index/00.MYI
-rw-rw----  1 mysql  mysql         8940 Feb 15 01:25 flows-20050216-01:25:00.frm
-rw-rw----  1 mysql  mysql    585248512 Feb 17 00:51 flows-20050217-01:25:00.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 17 01:25 flows-20050217-01:25:00.MYI -> /mnt/disk1/index/00.MYI
-rw-rw----  1 mysql  mysql         8940 Feb 16 01:25 flows-20050217-01:25:00.frm
-rw-rw----  1 mysql  mysql    551591718 Feb 18 00:51 flows-20050218-01:25:01.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 18 01:25 flows-20050218-01:25:01.MYI -> /mnt/disk1/index/01.MYI
-rw-rw----  1 mysql  mysql         8940 Feb 17 01:25 flows-20050218-01:25:01.frm
-rw-rw----  1 mysql  mysql    559918661 Feb 19 00:51 flows-20050219-01:25:00.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 19 01:25 flows-20050219-01:25:00.MYI -> /mnt/disk1/index/00.MYI
-rw-rw----  1 mysql  mysql         8940 Feb 18 01:25 flows-20050219-01:25:00.frm
-rw-rw----  1 mysql  mysql    380746342 Feb 20 00:51 flows-20050220-01:25:00.MYD
lrwxrwx--x  1 mysql  mysql           23 Feb 20 01:25 flows-20050220-01:25:00.MYI -> /mnt/disk1/index/00.MYI

Suggested fix:
I've searched Bug Database but it doesn't show any similar problem. Also note that if perform this task without symlinked index - all will be correct.
[1 Mar 2005 19:10] Eugene Vedistchev
Corrected MySQL versions.