Bug #44725 mysqlhotcopy fails to backup databases with two letter names
Submitted: 7 May 2009 17:35 Modified: 7 May 2009 18:55
Reporter: Singer Wang Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.0 OS:Any
Assigned to: CPU Architecture:Any

[7 May 2009 17:35] Singer Wang
Description:
If a MySQL database/schema name is exactly two letter long, then mysqlhotcopy will fail to backup
database. See the example below (ab is the database name).

--(Thu:20090507:1328)-(0:$)--
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)--
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- ls -l /var/lib/mysql/
total 28736
drwxr-xr-x 2 mysql mysql     4096 May  7 13:24 ab
drwxr-xr-x 2 mysql mysql     4096 May  7 13:27 cacti
-rw-rw---- 1 mysql mysql 18874368 May  7 13:27 ibdata1
-rw-rw---- 1 mysql mysql  5242880 May  7 13:27 ib_logfile0
-rw-rw---- 1 mysql mysql  5242880 May  3 00:35 ib_logfile1
drwx------ 2 mysql mysql     4096 May  3 00:35 mysql
srwxrwxrwx 1 mysql mysql        0 May  7 13:24 mysql.sock
drwx------ 2 mysql mysql     4096 May  3 00:35 test
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- ls -l /var/lib/mysql/ab/
total 24
-rwxr-xr-x 1 mysql mysql 8560 May  7 13:24 abc.frm
-rwxr-xr-x 1 mysql mysql   42 May  7 13:24 abc.MYD
-rwxr-xr-x 1 mysql mysql 1024 May  7 13:26 abc.MYI
-rwxr-xr-x 1 mysql mysql   65 May  7 13:24 db.opt
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- ls -l /var/lib/mysql/cacti/
total 24
-rwxr-xr-x 1 mysql mysql 8558 May  7 13:27 ab.frm
-rwxr-xr-x 1 mysql mysql   21 May  7 13:28 ab.MYD
-rwxr-xr-x 1 mysql mysql 1024 May  7 13:28 ab.MYI
-rwxr-xr-x 1 mysql mysql   65 May  7 13:27 db.opt
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)--
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- mysqlhotcopy --user=root ab /home/wang/
Locked 1 tables in 0 seconds.
Flushed tables (`ab`.`abc`) in 0 seconds.
Copying 4 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 1 tables (4 files) in 0 seconds (0 seconds overall).
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- mysqlhotcopy --user=root cacti /home/wang/
Locked 1 tables in 0 seconds.
Flushed tables (`cacti`.`ab`) in 0 seconds.
Copying 4 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 1 tables (4 files) in 0 seconds (0 seconds overall).
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1328)-(0:$)-- ls -l ab/
total 0
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1329)-(0:$)-- ls -l cacti/
total 24
-rwxr-xr-x 1 wang users 8558 May  7 13:27 ab.frm
-rwxr-xr-x 1 wang users   21 May  7 13:28 ab.MYD
-rwxr-xr-x 1 wang users 1024 May  7 13:28 ab.MYI
-rwxr-xr-x 1 wang users   65 May  7 13:27 db.opt
--(wang@picon)-(/home/wang)--
--(Thu:20090507:1329)-(0:$)--

I belive the this is happening because mysqlhotcopy thinks tables in two letter database/schema names are
RAID MyISAM tables and trying to deal with them as RAID tables. In fact these are not RAID tables at all (and
RAID MyISAM was removed in 5.0)

How to repeat:
- Create a database/schema (called aa) with a two letter name in MySQL and populate with MyISAM tables
- Create a database/schema (called aa) with a three letter name in MySQL and populate with MyISAM tables

- run mysqlhotcopy with database aa: mysqlhotcopy --user=user --password=password aa [DESTINATION]
- run mysqlhotcopy with database aaa: mysqlhotcopy --user=user --password=password aab [DESTINATION]

for database aa, it will copy NO files
for database aaa, it will work properly
[7 May 2009 17:50] Jim Winstead
This looks like a duplicate of Bug #28460, which was fixed in 5.0.68.
[7 May 2009 18:55] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicate of bug #28460