holland-mysqldump's exclude-invalid-views does not check exception properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
holland-backup |
Fix Released
|
Critical
|
Andrew Garner |
Bug Description
Creating a bad view with the following test case will cause an uncaught exception to propagate when exclude-
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-
exclude-
# holland backup default
...
* Finding and excluding invalid views...
* Invalid and excluded views will be saved to /var/spool/
Backup failed after 0.04 seconds
Purged failed backup: default/
Released lock /etc/holland/
Uncaught exception while running command 'backup': <_mysql_
Traceback (most recent call last):
File "/usr/lib/
return self.run(
File "/usr/lib/
runner.
File "/usr/lib/
plugin.backup()
File "/usr/lib/
self._backup()
File "/usr/lib/
exclude_
File "/usr/lib/
cursor.
File "/usr/lib64/
self.
File "/usr/lib64/
raise errorclass, errorvalue
OperationalError: (1267, "Illegal mix of collations (utf8_general_
This backup would have still failed without this option set:
Executing: /usr/bin/mysqldump --defaults-
/usr/bin/
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_
Changed in holland-backup: | |
milestone: | none → 1.0.12 |
Changed in holland-backup: | |
importance: | Undecided → Critical |
status: | New → Triaged |
assignee: | nobody → Andrew Garner (muzazzi) |
Changed in holland-backup: | |
status: | Fix Committed → Fix Released |
Fixed pushed to feature branch for inclusion in v1.0.12: https:/ /github. com/holland- backup/ holland/ tree/feature/ lp_1207852_ improve_ invalid_ view_detection
Sample run with this fix:
* Finding and excluding invalid views... holland/ default/ 20131007_ 174947/ invalid_ views.sql ci,IMPLICIT) and (utf8_unicode_ ci,IMPLICIT) for operation '=' SCHEMA. VIEWS. This definition will not have an explicit ALGORITHM set.
* Invalid and excluded views will be saved to /var/spool/
* Excluding invalid view `test`.`v_foo`: [1267] Illegal mix of collations (utf8_general_
!!! SHOW CREATE VIEW failed for `test`.`v_foo`. The view likely references columns that no longer exist in the underlying tables.
!!! Reconstructing view definition `test`.`v_foo` from INFORMATION_
* Saving view definition for `test`.`v_foo`
Excluding table test.v_foo