Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (39 sloc) 1.866 kB
"""Perform InnoDB recovery against a MySQL data directory"""
import os
import time
import signal
import logging
from cStringIO import StringIO
from subprocess import Popen, STDOUT, list2cmdline
from holland.core.exceptions import BackupError
from _mysqld import locate_mysqld_exe, generate_server_config, MySQLServer
LOG = logging.getLogger(__name__)
class InnodbRecoveryAction(object):
def __init__(self, mysqld_config):
self.mysqld_config = mysqld_config
if 'datadir' not in mysqld_config:
raise BackupError("datadir must be set for InnodbRecovery")
def __call__(self, event, snapshot_fsm, snapshot):"Starting InnoDB recovery")
mysqld_exe = locate_mysqld_exe(self.mysqld_config)"Bootstrapping with %s", mysqld_exe)
mycnf_path = os.path.join(self.mysqld_config['datadir'],
self.mysqld_config['log-error'] = 'innodb_recovery.log'
my_conf = generate_server_config(self.mysqld_config,
mysqld = MySQLServer(mysqld_exe, my_conf)
while mysqld.poll() is None:
if signal.SIGINT in snapshot_fsm.sigmgr.pending:
time.sleep(0.5)"%s has stopped", mysqld_exe)
if mysqld.returncode != 0:
datadir = self.mysqld_config['datadir']
for line in open(os.path.join(datadir, 'innodb_recovery.log'), 'r'):
LOG.error("%s", line.rstrip())
raise BackupError("%s exited with non-zero status (%s) during "
"InnoDB recovery" % (mysqld_exe, mysqld.returncode))
else:"%s ran successfully", mysqld_exe)
Jump to Line
Something went wrong with that request. Please try again.