Skip to content
Snippets Groups Projects
Commit 48c1f33c authored by Andy Yates's avatar Andy Yates
Browse files

Adding the ability to flush the target

parent 91e4e7e9
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ sub short_usage { ...@@ -23,7 +23,7 @@ sub short_usage {
print <<SHORT_USAGE_END; print <<SHORT_USAGE_END;
Usage: Usage:
$0 --pass=XXX \\ $0 --pass=XXX \\
\t[--noflush] [--nocheck] \\ \t[--noflush] [--nocheck] [--notargetflush]\\
\t[--noopt] [--noinnodb] [--skip_views] [--force] \\ \t[--noopt] [--noinnodb] [--skip_views] [--force] \\
\t[ --only_tables=XXX,YYY | --skip_tables=XXX,YYY ] \\ \t[ --only_tables=XXX,YYY | --skip_tables=XXX,YYY ] \\
\t[ input_file | \t[ input_file |
...@@ -76,6 +76,9 @@ Command line switches: ...@@ -76,6 +76,9 @@ Command line switches:
index data onto disk. This may be a time consuming index data onto disk. This may be a time consuming
operation for very large tables. The --noopt flag operation for very large tables. The --noopt flag
disables the optimization. disables the optimization.
--notargetflush (Optional)
Skips table flushing on the target machine.
--noinnodb (Optional) --noinnodb (Optional)
Skip the copy of any InnoDB table encountered. Skip the copy of any InnoDB table encountered.
...@@ -191,11 +194,13 @@ my $opt_optimize = 1; # Optimize the tables by default. ...@@ -191,11 +194,13 @@ my $opt_optimize = 1; # Optimize the tables by default.
my $opt_force = 0; # Do not reuse existing staging directory by default. my $opt_force = 0; # Do not reuse existing staging directory by default.
my $opt_skip_views = 0; # Process views by default my $opt_skip_views = 0; # Process views by default
my $opt_innodb = 1; # Don't skip InnoDB by default my $opt_innodb = 1; # Don't skip InnoDB by default
my $opt_flushtarget = 1;
my $opt_tmpdir; my $opt_tmpdir;
my ( $opt_source, $opt_target ); my ( $opt_source, $opt_target );
if ( !GetOptions( 'pass=s' => \$opt_password, if ( !GetOptions( 'pass=s' => \$opt_password,
'flush!' => \$opt_flush, 'flush!' => \$opt_flush,
'flushtarget!' => \$opt_flushtarget,
'check!' => \$opt_check, 'check!' => \$opt_check,
'opt!' => \$opt_optimize, 'opt!' => \$opt_optimize,
'force!' => \$opt_force, 'force!' => \$opt_force,
...@@ -930,6 +935,13 @@ TABLE: ...@@ -930,6 +935,13 @@ TABLE:
$spec->{'status'} = $spec->{'status'} =
sprintf( "SUCCESS: cleanup of '%s' may be needed", $staging_dir ); sprintf( "SUCCESS: cleanup of '%s' may be needed", $staging_dir );
} }
# Flush tables on target.
if ($opt_flushtarget) {
print("FLUSHING TABLES ON TARGET...\n");
my $ddl = sprintf('FLUSH TABLES %s', join(q{, }, @tables));
$target_dbh->do($ddl);
}
} ## end foreach my $spec (@todo) } ## end foreach my $spec (@todo)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment