PDA

View Full Version : Support exclude-patter for logical backups, exclude information_schema



orion
April 3rd, 2014, 04:03 PM
This patch enables exclude-pattern to work with logical backups, excludes information_schema by default via enumAllDatabases() (paving the way for excluding performance_schema as well), and cleans up some nearby code.


diff -up MySQL-zrm-3.0/usr/bin/mysql-zrm-backup.exclude MySQL-zrm-3.0/usr/bin/mysql-zrm-backup
--- MySQL-zrm-3.0/usr/bin/mysql-zrm-backup.exclude 2013-08-26 14:45:36.000000000 -0600
+++ MySQL-zrm-3.0/usr/bin/mysql-zrm-backup 2014-04-03 17:02:13.648882414 -0600
@@ -1584,7 +1584,7 @@ sub doLogicalFullBackup()
&printStartPhase( "Creating logical backup\n" );
}
my $params;
- my $mydumperparams;
+ my $mydumperparams = "";
my $msg = "";
my $dbs = "";
my $index_msg = "";
@@ -1611,15 +1611,9 @@ sub doLogicalFullBackup()
$index_msg = "logical-databases=".$inputs{"databases"}."\n";
if($isMyDumper){
my @mdbs = split " ", $inputs{"databases"};
- my $str ="";
- foreach(@mdbs){
- $str.="$_|";
- }
- $str =~ s/\|$//;
- $mydumperparams = "--regex '^(".$str.")'";
+ $mydumperparams = "--regex '^(".join("|", @mdbs).")'";
}
} else {
- $params = "--all-databases ";
@pdbs = &enumAllDatabases();
if( defined $inputs{"exclude-pattern"} ){
my $ln = @pdbs;
@@ -1629,28 +1623,18 @@ sub doLogicalFullBackup()
&printAndDie( "Nothing to backup after exclude-pattern is applied\n" );
}
# handle the all-databases with ZRM exclude filter
- my $str = "";
if($isMyDumper){
if($ln > $l){
- foreach(@pdbs){
- $str.="$_|";
- }
- $str =~ s/\|$//;
- $mydumperparams = "--regex '^(".$str.")'";
- }else{
- $mydumperparams = "";
+ $mydumperparams = "--regex '^(".join("|", @pdbs).")'";
}
- }
+ }
}
+ $params = "--databases @pdbs";
if( $verbose ){
&printLog( "backup of the following databases will be done @pdbs\n" );
}
- $msg = "Logical backup done for the following database(s)\n";
- foreach( @pdbs ) {
- $dbs = $dbs.$_." ";
- }
- $msg = $msg.$dbs."\n";
- $index_msg = "logical-databases=".$dbs."\n";
+ $msg = "Logical backup done for the following database(s)\[email protected]\n";
+ $index_msg = "[email protected]\n";
}
my $ntp = &checkIfNonTrans( @pdbs );
if($isMyDumper){

saleck
August 25th, 2018, 11:23 AM
orion - it's 2018 and this problem still persists (at least on Debian with version 3.0.0). Thank you very much for this patch, it saved us days of research why our backups have become so large after ZRM upgrade.