Bug #18777 Mysqlhotcopy does not copy all the direc
Submitted: 4 Apr 2006 16:45 Modified: 2 Aug 2006 18:06
Reporter: Kevin Mannion Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.21-BK, 4.0.28-BK, 4.0.21 OS:Linux (linux - debian)
Assigned to: Iggy Galarza CPU Architecture:Any

[4 Apr 2006 16:45] Kevin Mannion
Description:
Mysqlhotcopy does not copy all of the directories from a raid set when the number of tables is greater than ten. The raid directories are numbered using hexadecimals but mysqlhotcopy only copies directories numbered with decimals. 

How to repeat:
Use mysqlhotcopy with raid table split into more than 10 tables.

Suggested fix:
I believe this is the offending piece of code found at line 799 of the perl code.

 sub get_raid_dirs {
    my ( $r_files ) = @_;

    my %dirs = ();
    foreach my $f ( @$r_files ) {
	if ( $f =~ m:^(\d\d)/: ) {
	    $dirs{$1} = 1;
	}
    }
    return sort keys %dirs;
}

As you can see the regular expression is for decimal values only. It should read ([a-fA-F0-9][a-fA-F0-9]) to work properly.
[5 Apr 2006 12:55] Valeriy Kravchuk
Thank you for a problem report. Please, send the ls -l result for your data directory. Can you try to repeat with a newer version of MySQL, 4.0.26?
[18 Apr 2006 17:10] Kevin Mannion
Because of my work environment I cannot test on another version.
I have provided an ls -l of the source data directory and the resutling copy.
These are from different dates but the resulsts are the same.

A file is attached but the main differences follow.

Here is ls -l of source data directory

total 76792
drwx------  2 mysql edds      4096 Apr  5 10:44 00/
drwx------  2 mysql edds      4096 Apr  5 10:44 01/
drwx------  2 mysql edds      4096 Apr  5 10:44 02/
drwx------  2 mysql edds      4096 Apr  5 10:44 03/
drwx------  2 mysql edds      4096 Apr  5 10:44 04/
drwx------  2 mysql edds      4096 Apr  5 10:44 05/
drwx------  2 mysql edds      4096 Apr  5 10:44 06/
drwx------  2 mysql edds      4096 Apr  5 10:44 07/
drwx------  2 mysql edds      4096 Apr  5 10:44 08/
drwx------  2 mysql edds      4096 Apr  5 10:44 09/
drwx------  2 mysql edds      4096 Apr  5 10:44 0a/
drwx------  2 mysql edds      4096 Apr  5 10:44 0b/
drwx------  2 mysql edds      4096 Apr  5 10:44 0c/
drwx------  2 mysql edds      4096 Apr  5 10:44 0d/
drwx------  2 mysql edds      4096 Apr  5 10:44 0e/
drwx------  2 mysql edds      4096 Apr  5 10:44 0f/
drwx------  2 mysql edds      4096 Apr  5 10:44 10/
drwx------  2 mysql edds      4096 Apr  5 10:44 11/
drwx------  2 mysql edds      4096 Apr  5 10:44 12/
drwx------  2 mysql edds      4096 Apr  5 10:44 13/
drwx------  2 mysql edds      4096 Apr  5 10:44 14/
drwx------  2 mysql edds      4096 Apr  5 10:44 15/
drwx------  2 mysql edds      4096 Apr  5 10:44 16/
drwx------  2 mysql edds      4096 Apr  5 10:44 17/
drwx------  2 mysql edds      4096 Apr  5 10:44 18/
drwx------  2 mysql edds      4096 Apr  5 10:44 19/
drwx------  2 mysql edds      4096 Apr  5 10:44 1a/
drwx------  2 mysql edds      4096 Apr  5 10:44 1b/
drwx------  2 mysql edds      4096 Apr  5 10:44 1c/
drwx------  2 mysql edds      4096 Apr  5 10:44 1d/
drwx------  2 mysql edds      4096 Apr  5 10:44 1e/
drwx------  2 mysql edds      4096 Apr  5 10:44 1f/

Here is an ls -l of the copy
total 79332
drwxr-x---  2 mysql edds      4096 Feb 14 10:10 00/
drwxr-x---  2 mysql edds      4096 Feb 14 10:10 01/
drwxr-x---  2 mysql edds      4096 Feb 14 10:11 02/
drwxr-x---  2 mysql edds      4096 Feb 14 10:11 03/
drwxr-x---  2 mysql edds      4096 Feb 14 10:11 04/
drwxr-x---  2 mysql edds      4096 Feb 14 10:11 05/
drwxr-x---  2 mysql edds      4096 Feb 14 10:12 06/
drwxr-x---  2 mysql edds      4096 Feb 14 10:12 07/
drwxr-x---  2 mysql edds      4096 Feb 14 10:12 08/
drwxr-x---  2 mysql edds      4096 Feb 14 10:12 09/
drwxr-x---  2 mysql edds      4096 Feb 14 10:13 10/
drwxr-x---  2 mysql edds      4096 Feb 14 10:13 11/
drwxr-x---  2 mysql edds      4096 Feb 14 10:13 12/
drwxr-x---  2 mysql edds      4096 Feb 14 10:14 13/
drwxr-x---  2 mysql edds      4096 Feb 14 10:14 14/
drwxr-x---  2 mysql edds      4096 Feb 14 10:14 15/
drwxr-x---  2 mysql edds      4096 Feb 14 10:14 16/
drwxr-x---  2 mysql edds      4096 Feb 14 10:15 17/
drwxr-x---  2 mysql edds      4096 Feb 14 10:15 18/
drwxr-x---  2 mysql edds      4096 Feb 14 10:15 19/
[18 Apr 2006 17:11] Kevin Mannion
ls -l of source and copy

Attachment: data.txt (text/plain), 9.37 KiB.

[2 Jun 2006 15:32] Valeriy Kravchuk
This code:

sub get_raid_dirs {
    my ( $r_files ) = @_;

    my %dirs = ();
    foreach my $f ( @$r_files ) {
        if ( $f =~ m:^(\d\d)/: ) {
            $dirs{$1} = 1;
        }
    }
    return sort keys %dirs;
}

is still used in latest 4.0.28-BK, 4.1.21-BK, 5.0.23-BK, and 5.1.12-BK. It is a bug, obviously, for versions 4.0 and 4.1, as they support RAID.
[26 Jul 2006 16:35] 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/9610
[31 Jul 2006 11:09] Magnus BlÄudd
Very good!
[2 Aug 2006 18:06] Paul DuBois
Noted in 4.0.28 changelog.

mysqlhotcopy did not copy RAID directories with names that contained
non-decimal hex digits. (It copied only directories containing the
characters 0 through 9 and ignored those containing a through f.)
[3 Oct 2006 20:02] Chad MILLER
Available in 5.0.26.
[4 Oct 2006 13:57] Chad MILLER
Available in 4.1.22.