--- mysqlhotcopy 2006-10-20 21:39:53.000000000 -0700 +++ mysqlhotcopy.disp 2006-12-06 17:27:23.000000000 -0800 @@ -75,6 +75,7 @@ Usage: $0 db_name[./table_regex/] [new_d --resetslave reset the master.info once all tables are locked --tmpdir=# temporary directory (instead of $opt_tmpdir) --record_log_pos=# record slave and master status in specified db.table + --display_log_pos output the binarly log and position to stdout --chroot=# base directory of chroot jail in which mysqld operates Try \'perldoc $0\' for more complete documentation @@ -115,6 +116,7 @@ GetOptions( \%opt, "suffix=s", "checkpoint=s", "record_log_pos=s", + "display_log_pos", "flushlog", "resetmaster", "resetslave", @@ -444,7 +446,7 @@ foreach my $rdb ( @db_desc ) { # read lock all the tables we'll be copying # in order to get a consistent snapshot of the database -if ( $opt{checkpoint} || $opt{record_log_pos} ) { +if ( $opt{checkpoint} || $opt{record_log_pos} || $opt{display_log_pos} ) { # convert existing READ lock on checkpoint and/or log_pos table into WRITE lock foreach my $table ( grep { defined } ( $opt{checkpoint}, $opt{record_log_pos} ) ) { $hc_locks .= ", $table WRITE" @@ -475,6 +477,11 @@ else { $dbh->do( "RESET MASTER" ) if ( $opt{resetmaster} ); $dbh->do( "RESET SLAVE" ) if ( $opt{resetslave} ); + if ( $opt{display_log_pos} ) { + display_log_pos( $dbh ); + $dbh->do("FLUSH TABLES /*!32323 $hc_tables */"); + } + if ( $opt{record_log_pos} ) { record_log_pos( $dbh, $opt{record_log_pos} ); $dbh->do("FLUSH TABLES /*!32323 $hc_tables */"); @@ -740,6 +747,13 @@ sub retire_directory { } } +sub display_log_pos { + my ( $dbh ) = @_; + my ($file,$position) = get_row( $dbh, "show master status" ); + die "master status is undefined" if !defined $file || !defined $position; + print "Binary Log File is $file at position $position\n"; +} + sub record_log_pos { my ( $dbh, $table_name ) = @_;