Bug #28460 mysqlhotcopy silently skips a database with two alphanumerics name
Submitted: 16 May 2007 2:31 Modified: 25 Feb 2008 19:42
Reporter: Roc Zhou Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.22, 5.0, 5.1 OS:Any
Assigned to: Timothy Smith CPU Architecture:Any
Triage: D2 (Serious) / R2 (Low) / E1 (None/Negligible)

[16 May 2007 2:31] Roc Zhou
Description:
If there is a database named "cd", mysqlhotcopy can backup it, and still report that it has been copied, but the dir is empty.

I tried this on several hosts, and the problem remains. My system is RHEL4, mysql-4.1.22.

How to repeat:
[root@docs mysql]# mysqlhotcopy -u root -h 127.0.0.1 cd /tmp
Locked 70 tables in 0 seconds.
Flushed tables (`cd`.`agent_bill`, `cd`.`agent_lic`, `cd`.`agent_price`, `cd`.`agent_products`, `cd`.`agent_type`, `cd`.`agents`, `cd`.`ali_admin`, `cd`.`ali_lic`, `cd`.`ali_log`, `cd`.`ali_order`, `cd`.`ci_clients`, `cd`.`ci_contact`, `cd`.`ci_roles`, `cd`.`ci_urllist`, `cd`.`ci_user_role`, `cd`.`ci_users`, `cd`.`client_log`, `cd`.`client_rec`, `cd`.`free_domain_cache`, `cd`.`free_domain_visit`, `cd`.`hostlist`, `cd`.`httpclient`, `cd`.`lic_admin`, `cd`.`lic_area`, `cd`.`lic_awoke`, `cd`.`lic_awoke_act`, `cd`.`lic_awoke_origin`, `cd`.`lic_commisionchange`, `cd`.`lic_domain_5107`, `cd`.`lic_domain_his`, `cd`.`lic_downpub`, `cd`.`lic_downsite`, `cd`.`lic_feedback`, `cd`.`lic_hosts`, `cd`.`lic_order`, `cd`.`lic_orderaccounts`, `cd`.`lic_paylist`, `cd`.`lic_productlist`, `cd`.`lic_reguser`, `cd`.`lic_reguser_old`, `cd`.`lic_reqlist`, `cd`.`lic_reqlist_old`, `cd`.`lic_servicereturns`, `cd`.`lic_tags`, `cd`.`lic_tags_domain`, `cd`.`lic_union`, `cd`.`lic_union_old`, `cd`.`lic_userproduct`, `cd`.`lic_userservice`, `cd`.`openshop`, `cd`.`openuser`, `cd`.`paypal_campaign_amount`, `cd`.`paypal_campaign_domain`, `cd`.`paypal_campaign_reg`, `cd`.`paypal_campaign_voteslog`, `cd`.`referer_log`, `cd`.`skype`, `cd`.`skype_count`, `cd`.`skype_info`, `cd`.`srv_man`, `cd`.`srv_tickets`, `cd`.`temp_url`, `cd`.`templates`, `cd`.`union_bill`, `cd`.`union_bill_Old`, `cd`.`updatesql`, `cd`.`updatesql_formal`, `cd`.`updatesql_general`, `cd`.`versionprogram`, `cd`.`versiontemplate`) in 0 seconds.
Copying 213 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 70 tables (213 files) in 0 seconds (0 seconds overall).
[root@docs mysql]# ls /tmp/cd/
[16 May 2007 7:47] Sveta Smirnova
Thank you for the report.

Verified as described.
[14 Jun 2007 20:56] Sveta Smirnova
Bug #29082 was marked as duplicate of this one. Bug #29082 contains information bug occurs for all 2-letters-named databases, not only 'cd'
[14 Jun 2007 23:11] Bill Marrs
I'm the one who created Bug #29082 (sorry for the dupe).

This bug had a more serious effect for me.  All of my database names are two-letters (it's our standard).  So, this bug resulted in our backup scripts not creating backups of all our databases.  This went on for a month before anyone noticed.  Fortunately, we noticed and have edited our copy of mysqlhotcopy to correct the problem.

I tracked the bug down to an assumption that mysqlhotcopy makes for identifying raid files.  As I understand the code, any pathname containing just 2 alphanumerics as a component of the path will be skipped.  

This bug is a regression.  mysqlhotcopy had worked great for me for a few years, but when I upgraded to 5.0.37, it started doing this silent skipping.  I assume the raid code was added somewhat recently, between 5.0.21 and 5.0.37, and that caused the bug. 

I posted a suggested fix in the other bug (it's kind of a wild guess, I don't really understand the raid code).  It would be good if the person who added the raid code to mysqlhotcopy could see this.
[14 Jun 2007 23:22] Bill Marrs
Is there a way to alter this bug's subject line?

The current subject ('A database named "cd" can't be mysqlhotcopy') doesn't really cover the full problem.  It's any two alphanumerics.  Also, it's not the mysqlhotcopy can't do it, it's that mysqlhotcopy silently skips the critical file copy step without giving any error.  Thus, it tricked our backups into thinking nothing was wrong.
[14 Jun 2007 23:32] Miguel Solorzano
Changed Synopsis under request.
[23 Jul 2007 11:42] Sveta Smirnova
Bug #29972 was marked as duplicate of this one.
[15 Nov 2007 15:18] Dmitry Shaposhnik
Bump. Any workaround or fix? It's an half-year old bug!
[16 Jan 2008 16:55] Pavel Pushkarev
There is a workaround fix:

change
my @non_raid = map { "'$_'" } grep { ! m:/$raid_dir_regex/[^/]+$: } @$files;
to
my @non_raid = map { "'$_'" } @$files;

It's a hack and it may break something on two_letter_raid_drives.
I do not know what that raid patch really means. Probably, the better
way is to change the inside regex to 
m:^/$raid_dir_regex/[^/]+$:
but the simpler the better :)
[25 Jan 2008 3:22] Jim Winstead
Because the RAID feature was dropped in MySQL 5.0, we should probably just rip out all of this RAID stuff from mysqlhotcopy, too.
[18 Feb 2008 18:49] 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/42513

ChangeSet@1.2580, 2008-02-18 11:48:33-07:00, tsmith@ramayana.hindu.god +1 -0
  Bug #28460  mysqlhotcopy silently skips a database with two alphanumerics name
  
  Remove code from mysqlhotcopy which deals with the so-called "RAID"
  feature of older MyISAM.
[25 Feb 2008 15:58] Bugs System
Pushed into 5.1.24-rc
[25 Feb 2008 16:04] Bugs System
Pushed into 5.0.58
[25 Feb 2008 16:04] Bugs System
Pushed into 6.0.5-alpha
[25 Feb 2008 19:42] Paul Dubois
Noted in 5.0.58, 5.1.24, 6.0.5 changelogs.

mysqlhotcopy silently skipped databases with names consisting of two
alphanumeric characters.
[30 Mar 2008 9:08] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11.
[7 May 2009 18:55] Sveta Smirnova
Bug #44725 was marked as duplicate of this one.