[MySQL-zrm/el5] Add patch to enable exclude-pattern with logical backups

Orion Poplawski orion at fedoraproject.org
Fri Apr 4 14:58:43 UTC 2014


commit 5b9b95b0ead66fa5defd24124630305c8fda8a7e
Author: Orion Poplawski <orion at nwra.com>
Date:   Fri Apr 4 08:58:35 2014 -0600

    Add patch to enable exclude-pattern with logical backups

 MySQL-zrm-exclude.patch |   63 +++++++++++++++++++++++++++++++++++++++++++++++
 MySQL-zrm.spec          |    9 ++++++-
 2 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/MySQL-zrm-exclude.patch b/MySQL-zrm-exclude.patch
new file mode 100644
index 0000000..3b23e40
--- /dev/null
+++ b/MySQL-zrm-exclude.patch
@@ -0,0 +1,63 @@
+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)\n at pdbs\n";
++        $index_msg = "logical-databases=@pdbs\n";
+     }
+     my $ntp = &checkIfNonTrans( @pdbs );
+     if($isMyDumper){
diff --git a/MySQL-zrm.spec b/MySQL-zrm.spec
index f3213fe..c124ae9 100644
--- a/MySQL-zrm.spec
+++ b/MySQL-zrm.spec
@@ -1,6 +1,6 @@
 Name:           MySQL-zrm
 Version:        3.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        MySQL backup manager
 
 Group:          Applications/System
@@ -13,6 +13,9 @@ Patch1:         MySQL-zrm-2.2.0-quiet.patch
 # Abort if out of space on restore
 # https://forums.zmanda.com/showthread.php?5347-mysql-zrm-restore-does-not-check-for-running-out-of-disk-space&p=17076#post17076
 Patch2:         MySQL-zrm-tmpwrite.patch
+# Enable exclude-pattern with logical backups
+# https://forums.zmanda.com/showthread.php?5371-Support-exclude-patter-for-logical-backups-exclude-information_schema
+Patch3:         MySQL-zrm-exclude.patch
 
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 BuildArch:      noarch
@@ -36,6 +39,7 @@ server.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 # we should use modules from repo
@@ -96,6 +100,9 @@ rm -rf %{buildroot}
 %config(noreplace) %{_sysconfdir}/mysql-zrm/*
 
 %changelog
+* Thu Apr 3 2014 Orion Poplawski <orion at cora.nwra.com> - 3.0-3
+- Add patch to enable exclude-pattern with logical backups
+
 * Wed Mar 19 2014 Orion Poplawski <orion at cora.nwra.com> - 3.0-2
 - Abort if out of space on restore
 


More information about the scm-commits mailing list