replicator/lib/ruby/xtrabackup.rb
def cleanup_xtrabackup_storage
    # Loop over each of the Tungsten backup storage files
    tungsten_storage_files = Pathname.new(@options[:tungsten_backups]).children.collect{
      |child|
      child.to_s
    }

    # Loop over each of the Xtrabackup storage directories
    Pathname.new(@options[:directory]).children.each{
      |xtrabackup_dir|
      basename = xtrabackup_dir.basename.to_s
      unless basename =~ /^full/ || basename =~ /^incr/
        next
      end

      regex = Regexp.new("store-[0-9]+-#{basename}")

      tungsten_storage_matches = tungsten_storage_files.select{
        |tungsten_storage_name|
        (tungsten_storage_name =~ regex)
      }    
      if tungsten_storage_matches.length == 0
        # There aren't any matching files in the Tungsten backups directory
        TU.cmd_result("rm -r #{xtrabackup_dir.to_s}")
      end
    }
  end
# Cleanup xtrabackup snapshots that no longer have a matching entry in 
# the Tungsten backups directory.  If the Xtrabackup directory does not have 
# a file in the Tungsten backups directory with a matching filename, we will 
# remove the Xtrabackup snapshot
Cleanup xtrabackup snapshots that no longer have a matching entry in
the Tungsten backups directory.  If the Xtrabackup directory does not have
a file in the Tungsten backups directory with a matching filename, we will
remove the Xtrabackup snapshot
Cleanup xtrabackup snapshots that no longer have a matching entry in the Tungsten backups directory . If the Xtrabackup directory does not have a file in the Tungsten backups directory with a matching filename we will remove the Xtrabackup snapshot
def cleanup_xtrabackup_storage
    tungsten_storage_files = Pathname.new(@options[:tungsten_backups]).children.collect{
      |child|
      child.to_s
    }
    Pathname.new(@options[:directory]).children.each{
      |xtrabackup_dir|
      basename = xtrabackup_dir.basename.to_s
      unless basename =~ /^full/ || basename =~ /^incr/
        next
      end
      regex = Regexp.new("store-[0-9]+-#{basename}")
      tungsten_storage_matches = tungsten_storage_files.select{
        |tungsten_storage_name|
        (tungsten_storage_name =~ regex)
      }    
      if tungsten_storage_matches.length == 0
        TU.cmd_result("rm -r #{xtrabackup_dir.to_s}")
      end
    }
  end
def cleanup_xtrabackup_storage tungsten_storage_files = Pathname . new ( @options [ :tungsten_backups ] ) . children . collect { | child | child . to_s } Pathname . new ( @options [ :directory ] ) . children . each { | xtrabackup_dir | basename = xtrabackup_dir . basename . to_s unless basename =~ / ^full / || basename =~ / ^incr / next end regex = Regexp . new ( "store-[0-9]+-#{basename}" ) tungsten_storage_matches = tungsten_storage_files . select { | tungsten_storage_name | ( tungsten_storage_name =~ regex ) } if tungsten_storage_matches . length == 0 TU . cmd_result ( "rm -r #{xtrabackup_dir.to_s}" ) end } end
Cleanup xtrabackup snapshots that no longer have a matching entry in
the Tungsten backups directory.
Cleanup xtrabackup snapshots that no longer have a matching entry in the Tungsten backups directory .
# Loop over each of the Tungsten backup storage files # Loop over each of the Xtrabackup storage directories # There aren't any matching files in the Tungsten backups directory