| Bug #24870 | mysqlhotcopy cannot display binary log position to STDOUT | ||
|---|---|---|---|
| Submitted: | 7 Dec 2006 1:46 | Modified: | 21 May 2009 1:54 |
| Reporter: | Matt Cowger | Email Updates: | |
| Status: | Open | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S4 (Feature request) |
| Version: | 5.0 | OS: | Linux (Linux) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | BINARY, Contribution, log, master, mysqlhotcopy, replication, slave | ||
[7 Dec 2006 1:46]
Matt Cowger
Patch
Attachment: display_log_pos.patch (application/octet-stream, text), 1.99 KiB.
[7 Dec 2006 1:47]
Matt Cowger
Patchfile uploaded.
[21 May 2009 0:08]
Masood Mortazavi
Matt - Are you still interested in pursuing this? Obviously, it has been marked as a "feature request" which means it will not be found suitable for integration into 5.0 even if, as a feature, it makes sense. In the meantime, you might want to review this page: http://forge.mysql.com/wiki/Contributing_Code ... and review the paper work as well ...
[21 May 2009 1:54]
Matt Cowger
I dont use MySQL anymore, and as such have no real desire to pursue this further. The patch I've included above is hereby released into the public domain, and you are welcome to do with it what you please.

Description: Often, having mysqlhopy display the current log position to standard out would be useful for preparing new slaves for a master. It currently can only write this data to a table, not STDOUT How to repeat: Simply run mysqlhotcopy Suggested fix: Patch to enable this feature: --- 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 ) = @_;