[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-internals
Subject: [PATCH] mysqlhotcopy.sh fixes...
From: Jeremy Zawodny <jzawodn () yahoo-inc ! com>
Date: 2001-07-20 9:01:34
[Download RAW message or body]
The included patch (below my sig) fixes two problems with
mysqlhotcopy. The problems were described a message from Chris Lott
<chrisl@thethirdsector.com> to the mysql mailing list on Wed, 18 Jul
2001.
The first problem is a deprecated DBI call. The second involves
mysqlhotcopy not working right if you specify a regexp but no database
name.
I used the mysqlhotcopy from the current mysql-3.23 bk tree.
Thanks,
Jeremy
--
Jeremy D. Zawodny, <jzawodn@yahoo-inc.com>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878 Fax: (408) 349-5454 Cell: (408) 685-5936 <-- NEW
MySQL 3.23.29: up 34 days, processed 264,201,651 queries (89/sec. avg)
--- mysqlhotcopy.sh.orig Fri Jul 20 00:51:17 2001
+++ mysqlhotcopy.sh Fri Jul 20 01:49:46 2001
@@ -223,18 +223,27 @@
my $db = $rdb->{src};
eval { $dbh->do( "use $db" ); };
die "Database '$db' not accessible: $@" if ( $@ );
- my @dbh_tables = $dbh->func( '_ListTables' );
+ my @dbh_tables = $dbh->tables();
## generate regex for tables/files
- my $t_regex = $rdb->{t_regex}; ## assign temporary regex
- my $negated = $t_regex =~ tr/~//d; ## remove and count negation operator: we \
don't allow ~ in table names
- $t_regex = qr/$t_regex/; ## make regex string from user regex
+ my $t_regex;
+ my $negated;
+ if ($rdb->{t_regex}) {
+ $t_regex = $rdb->{t_regex}; ## assign temporary regex
+ $negated = $t_regex =~ tr/~//d; ## remove and count
+ ## negation operator: we
+ ## don't allow ~ in table
+ ## names
+
+ $t_regex = qr/$t_regex/; ## make regex string from
+ ## user regex
## filter (out) tables specified in t_regex
print "Filtering tables with '$t_regex'\n" if $opt{debug};
@dbh_tables = ( $negated
? grep { $_ !~ $t_regex } @dbh_tables
: grep { $_ =~ $t_regex } @dbh_tables );
+ }
## get list of files to copy
my $db_dir = "$datadir/$db";
@@ -249,10 +258,17 @@
closedir( DBDIR );
## filter (out) files specified in t_regex
- my @db_files = ( $negated
- ? grep { $db_files{$_} !~ $t_regex } keys %db_files
- : grep { $db_files{$_} =~ $t_regex } keys %db_files );
+ my @db_files;
+ if ($rdb->{t_regex}) {
+ my @db_files = ($negated
+ ? grep { $db_files{$_} !~ $t_regex } keys %db_files
+ : grep { $db_files{$_} =~ $t_regex } keys %db_files );
@db_files = sort @db_files;
+ }
+ else {
+ @db_files = keys %db_files;
+ }
+
my @index_files=();
## remove indices unless we're told to keep them
@@ -808,4 +824,8 @@
Ask Bjoern Hansen - Cleanup code to fix a few bugs and enable -w again.
Emil S. Hansen - Added resetslave and resetmaster.
+
+Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which
+resulted in nothing being copied when a regexp was specified but no
+database name(s).
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail internals-thread1288@lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe@lists.mysql.com>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic