Browse files

only check innodb consistency if have_innodb = YES

  • Loading branch information...
1 parent 20dff97 commit 2f842382d608f4aad61fc6b573e92af0f5955a15 @abg abg committed Jan 10, 2013
View
68 plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/plugin/mysqldump/util.py
@@ -26,8 +26,6 @@ def setup_actions(snapshot, config, client, datadir, spooldir, plugin):
* MySQL locking
* Recording MySQL replication
"""
- pathinfo = MySQLPathInfo.from_mysql(client)
- check_innodb(pathinfo)
if config['mysql-lvm']['lock-tables']:
extra_flush = config['mysql-lvm']['extra-flush-tables']
@@ -44,40 +42,44 @@ def setup_actions(snapshot, config, client, datadir, spooldir, plugin):
if not mysqld_config['tmpdir']:
mysqld_config['tmpdir'] = tempfile.gettempdir()
- ib_log_size = client.show_variable('innodb_log_file_size')
- if ib_log_size:
- mysqld_config['innodb-log-file-size'] = ib_log_size
+ if client.show_variable('have_innodb') == 'YES':
+ pathinfo = MySQLPathInfo.from_mysql(client)
+ check_innodb(pathinfo)
- ibd_home_dir = pathinfo.innodb_data_home_dir
- if ibd_home_dir:
- # innodb_data_home_dir is set to something
- ibd_home_dir = pathinfo.remap_path(pathinfo.get_innodb_datadir(),
- snapshot.mountpoint)
- mysqld_config['innodb-data-home-dir'] = ibd_home_dir
- LOG.info("Remapped innodb-data-home-dir from %s to %s for snapshot",
- pathinfo.get_innodb_datadir(), ibd_home_dir)
+ ib_log_size = client.show_variable('innodb_log_file_size')
+ if ib_log_size:
+ mysqld_config['innodb-log-file-size'] = ib_log_size
- ibd_file_path = pathinfo.innodb_data_file_path
- if ibd_file_path:
- ibd_file_path = pathinfo.remap_tablespaces(snapshot.mountpoint)
- mysqld_config['innodb-data-file-path'] = ibd_file_path
- if ibd_file_path != pathinfo.innodb_data_file_path:
- LOG.info("Remapped innodb-data-file-path from %s to %s for snapshot",
- pathinfo.innodb_data_file_path, ibd_file_path)
- if not ibd_home_dir:
- LOG.info("Remapped one or more tablespaces but "
- "innodb-data-home-dir is not set. Setting "
- "innodb-data-home-dir = '' to support absolute "
- "tablespace paths on snapshot.")
- mysqld_config['innodb-data-home-dir'] = ""
+ ibd_home_dir = pathinfo.innodb_data_home_dir
+ if ibd_home_dir:
+ # innodb_data_home_dir is set to something
+ ibd_home_dir = pathinfo.remap_path(pathinfo.get_innodb_datadir(),
+ snapshot.mountpoint)
+ mysqld_config['innodb-data-home-dir'] = ibd_home_dir
+ LOG.info("Remapped innodb-data-home-dir from %s to %s for snapshot",
+ pathinfo.get_innodb_datadir(), ibd_home_dir)
- ib_logdir = pathinfo.innodb_log_group_home_dir
- if ib_logdir and ib_logdir != './':
- ib_logdir = pathinfo.remap_path(pathinfo.get_innodb_logdir(),
- snapshot.mountpoint)
- mysqld_config['innodb-log-group-home-dir'] = ib_logdir
- LOG.info("Remapped innodb-log-group-home-dir from %s to %s for snapshot",
- pathinfo.get_innodb_logdir(), ib_logdir)
+ ibd_file_path = pathinfo.innodb_data_file_path
+ if ibd_file_path:
+ ibd_file_path = pathinfo.remap_tablespaces(snapshot.mountpoint)
+ mysqld_config['innodb-data-file-path'] = ibd_file_path
+ if ibd_file_path != pathinfo.innodb_data_file_path:
+ LOG.info("Remapped innodb-data-file-path from %s to %s for snapshot",
+ pathinfo.innodb_data_file_path, ibd_file_path)
+ if not ibd_home_dir:
+ LOG.info("Remapped one or more tablespaces but "
+ "innodb-data-home-dir is not set. Setting "
+ "innodb-data-home-dir = '' to support absolute "
+ "tablespace paths on snapshot.")
+ mysqld_config['innodb-data-home-dir'] = ""
+
+ ib_logdir = pathinfo.innodb_log_group_home_dir
+ if ib_logdir and ib_logdir != './':
+ ib_logdir = pathinfo.remap_path(pathinfo.get_innodb_logdir(),
+ snapshot.mountpoint)
+ mysqld_config['innodb-log-group-home-dir'] = ib_logdir
+ LOG.info("Remapped innodb-log-group-home-dir from %s to %s for snapshot",
+ pathinfo.get_innodb_logdir(), ib_logdir)
act = MySQLDumpDispatchAction(plugin, mysqld_config)
snapshot.register('post-mount', act, priority=100)
View
19 plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/plugin/raw/util.py
@@ -25,15 +25,16 @@ def setup_actions(snapshot, config, client, snap_datadir, spooldir):
* Recording MySQL replication
"""
mysql = connect_simple(config['mysql:client'])
- try:
- pathinfo = MySQLPathInfo.from_mysql(mysql)
- finally:
- mysql.close()
- try:
- check_innodb(pathinfo, ensure_subdir_of_datadir=True)
- except BackupError:
- if not config['mysql-lvm']['force-innodb-backup']:
- raise
+ if mysql.show_variable('have_innodb') == 'YES':
+ try:
+ pathinfo = MySQLPathInfo.from_mysql(mysql)
+ finally:
+ mysql.close()
+ try:
+ check_innodb(pathinfo, ensure_subdir_of_datadir=True)
+ except BackupError:
+ if not config['mysql-lvm']['force-innodb-backup']:
+ raise
if config['mysql-lvm']['lock-tables']:
extra_flush = config['mysql-lvm']['extra-flush-tables']

0 comments on commit 2f84238

Please sign in to comment.