Bug #16437 mysqlhotcopy rsync support
Submitted: 12 Jan 2006 5:01
Reporter: [ name withheld ] Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:4.0.24-10sarge1 OS:Linux (Debian "sarge" 3.1)
Assigned to: CPU Architecture:Any
Tags: Contribution

[12 Jan 2006 5:01] [ name withheld ]
Description:
mysqlhotcopy really supports two methods right now: "cp" and "scp". However, they ways some utilities are built could allow more. In fact, I've been able to hack in support for rsync really by just corrupting mysqlhotcopy in accepting it, without any special other provisions.

So here it is, rsync support... it really helps when you sync the database to another mysql server for safety fallback, without the hassle of having to setup full replication. Big tables are a breeze to copy, benefiting from the usual astronomic speed improvements of rsync. 

How to repeat:
n/a.

Suggested fix:
Let's hope this form doesn't screw up formatting too much.. Anyways the patch is so trivial it could just be applied as is.

--- /usr/bin/mysqlhotcopy.orig  2006-01-11 23:41:08.000000000 -0500
+++ /usr/bin/mysqlhotcopy       2006-01-11 23:51:49.000000000 -0500
@@ -364,7 +364,7 @@
        $rdb->{target} = "$tgt_dirname";
       }
     }
-    elsif ($opt{method} =~ /^scp\b/)
+    elsif ($opt{method} =~ /^scp\b/ || $opt{method} =~ /^rsync\b/)
     {   # we have to trust scp to hit the target
        foreach my $rdb ( @db_desc ) {
            $rdb->{target} = "$tgt_dirname/$rdb->{src}";
@@ -421,7 +421,7 @@
        if ( $opt{dryrun} ) {
            print "mkdir $tgt_dirpath, 0750\n";
        }
-       elsif ($opt{method} =~ /^scp\b/) {
+       elsif ($opt{method} =~ /^scp\b/ || $opt{method} =~ /^rsync\b/) {
            ## assume it's there?
            ## ...
        }
@@ -595,7 +595,7 @@
         copy($file, $target."/".basename($file));
       }
     }
-    elsif ($method =~ /^s?cp\b/)  # cp or scp with optional flags
+    elsif ($method =~ /^s?cp\b/ || $method =~ /^rsync\b/)  # cp or scp with optional flags
     {  
        my $cp = $method;
        # add option to preserve mod time etc of copied files