Method: Backup::Database::MySQL#perform!

Defined in:
lib/backup/database/mysql.rb

#perform!Object

Performs the mysqldump or innobackupex command and outputs the dump file in the dump_path using dump_filename.

<trigger>/databases/MySQL[-<database_id>].[sql|tar][.gz]


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/backup/database/mysql.rb', line 77

def perform!
  super

  pipeline = Pipeline.new
  dump_ext = sql_backup? ? 'sql' : 'tar'

  pipeline << sudo_option(sql_backup? ? mysqldump : innobackupex)

  model.compressor.compress_with do |command, ext|
    pipeline << command
    dump_ext << ext
  end if model.compressor

  pipeline << "#{ utility(:cat) } > " +
      "'#{ File.join(dump_path, dump_filename) }.#{ dump_ext }'"

  pipeline.run
  if pipeline.success?
    log!(:finished)
  else
    raise Error, "Dump Failed!\n" + pipeline.error_messages
  end
end