mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
BUG#7967 Fix mysqlhotcopy --record-log-position
BitKeeper/etc/ignore: Added scripts/mysqlhotcopy.sh.rej to the ignore list scripts/mysqlhotcopy.sh: BUG#7967 Use fetchrow_hashref() when parsing SHOW SLAVE STATUS so that --record-log-pos option will work with all versions from 3.23 forward and will not break again in the future if additional columns are added.
This commit is contained in:
@@ -746,9 +746,15 @@ sub record_log_pos {
|
||||
my ($file,$position) = get_row( $dbh, "show master status" );
|
||||
die "master status is undefined" if !defined $file || !defined $position;
|
||||
|
||||
my ($master_host, undef, undef, undef, $log_file, $log_pos )
|
||||
= get_row( $dbh, "show slave status" );
|
||||
|
||||
my $row_hash = get_row_hash( $dbh, "show slave status" );
|
||||
my ($master_host, $log_file, $log_pos );
|
||||
if ( $dbh->{mysql_serverinfo} =~ /^3\.23/ ) {
|
||||
($master_host, $log_file, $log_pos )
|
||||
= @{$row_hash}{ qw / Master_Host Log_File Pos / };
|
||||
} else {
|
||||
($master_host, $log_file, $log_pos )
|
||||
= @{$row_hash}{ qw / Master_Host Master_Log_File Read_Master_Log_Pos / };
|
||||
}
|
||||
my $hostname = hostname();
|
||||
|
||||
$dbh->do( qq{ replace into $table_name
|
||||
@@ -773,6 +779,14 @@ sub get_row {
|
||||
return $sth->fetchrow_array();
|
||||
}
|
||||
|
||||
sub get_row_hash {
|
||||
my ( $dbh, $sql ) = @_;
|
||||
|
||||
my $sth = $dbh->prepare($sql);
|
||||
$sth->execute;
|
||||
return $sth->fetchrow_hashref();
|
||||
}
|
||||
|
||||
sub scan_raid_dir {
|
||||
my ( $r_db_files, $data_dir, @raid_dir ) = @_;
|
||||
|
||||
|
Reference in New Issue
Block a user