holland-coredev team mailing list archive
-
holland-coredev team
-
Mailing list archive
-
Message #00392
[Bug 1207852] Re: holland-mysqldump's exclude-invalid-views does not check exception properly
** Changed in: holland-backup
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Holland
Build, which is subscribed to holland-backup.
https://bugs.launchpad.net/bugs/1207852
Title:
holland-mysqldump's exclude-invalid-views does not check exception
properly
Status in holland-backup:
Fix Released
Bug description:
Creating a bad view with the following test case will cause an
uncaught exception to propagate when exclude-invalid-views is enabled:
DROP TABLE IF EXISTS foo;
CREATE TABLE foo (id int, data varchar(40)) character set = utf8 collate utf8_general_ci;
DROP VIEW IF EXISTS v_foo;
CREATE VIEW v_foo AS SELECT CONVERT(data USING utf8) = data FROM foo;
SHOW FIELDS FROM v_foo;
ALTER TABLE foo CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SHOW FIELDS FROM v_foo;
# grep exclude-invalid-views /etc/holland/backupsets/default.conf
exclude-invalid-views = yes
# holland backup default
...
* Finding and excluding invalid views...
* Invalid and excluded views will be saved to /var/spool/holland/default/20130802_134443/invalid_views.sql
Backup failed after 0.04 seconds
Purged failed backup: default/20130802_134443
Released lock /etc/holland/backupsets/default.conf
Uncaught exception while running command 'backup': <_mysql_exceptions.OperationalError instance at 0x2b9e0718eab8>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/holland/core/command/command.py", line 209, in dispatch
return self.run(self.optparser.prog, opts, *args)
File "/usr/lib/python2.4/site-packages/holland/commands/backup.py", line 102, in run
runner.backup(name, config, opts.dry_run)
File "/usr/lib/python2.4/site-packages/holland/core/backup/base.py", line 124, in backup
plugin.backup()
File "/usr/lib/python2.4/site-packages/holland/backup/mysqldump/plugin.py", line 177, in backup
self._backup()
File "/usr/lib/python2.4/site-packages/holland/backup/mysqldump/plugin.py", line 196, in _backup
exclude_invalid_views(self.schema, self.client, definitions_path)
File "/usr/lib/python2.4/site-packages/holland/backup/mysqldump/plugin.py", line 428, in exclude_invalid_views
cursor.execute('SHOW FIELDS FROM `%s`.`%s`' %
File "/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1267, "Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='")
This backup would have still failed without this option set:
Executing: /usr/bin/mysqldump --defaults-file=/var/spool/holland/default/20130802_135550/my.cnf --flush-privileges --max-allowed-packet=128M --lock-all-tables --all-databases
/usr/bin/mysqldump[26470]: mysqldump: Couldn't execute 'show create table `v_foo`': Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' (1267)
Internally there are a few problems here:
* Holland's view exclusion is missing a few cases where an invalid
view should be excluded. At least errorcode 1267 should be added to
the exclusion list.
* holland is not trapping errors cleaning from exclude_invalid_views()
so SQL errors will propagate unchecked.
To manage notifications about this bug go to:
https://bugs.launchpad.net/holland-backup/+bug/1207852/+subscriptions
References