Bug #30444 5.0 mysqldump silently allows wrong backup to be taken against a 4.0 database
Submitted: 15 Aug 2007 16:33 Modified: 24 Oct 2007 19:56
Reporter: Mark Leith Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Backup Severity:S2 (Serious)
Version:5.0.33+ OS:Any
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Tags: regression

[15 Aug 2007 16:33] Mark Leith
It appears that the fix for Bug #19660 will cause silent corruption against a 4.0 database if used with the --single-transaction and --master-data options.

Please note the comment above where the fix was applied in mysqldump.c:

    We use BEGIN for old servers. --single-transaction --master-data will fail
    on old servers, but that's ok as it was already silently broken (it didn't
    do a consistent read, so better tell people frankly, with the error).

    We want the first consistent read to be used for all tables to dump so we
    need the REPEATABLE READ level (not anything lower, for example READ
    COMMITTED would give one new consistent read per dumped table).


The comment is still the same, but doesn't reflect the code anymore. mysqldump really ought to warn or exit if you attempt this combo against a 4.0 database, as it used to.

How to repeat:
mysqldump --single-transaction --master-data against a 4.0 database. 

Suggested fix:
Add a warning that this will cause inconsistencies when running against a 4.0 database.
[2 Oct 2007 19:35] Timothy Smith
Code is OK.  Instead of "read may not be consistent!", it might be better to say "backup may not be consistent across all tables" or similar.  White space looks a bit funky, may just be cut-n-paste artifacts.
[4 Oct 2007 6:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:


ChangeSet@1.2675, 2007-10-04 08:27:03+02:00, tnurnberg@sin.intern.azundris.com +1 -0
  Bug #30444: 5.0 mysqldump silently allows wrong backup to be taken against a 4.0 database
  The combination of --single-transaction and --master-data requires
  mysqld 4.1 on. When trying this against an older server, print
  diagnostic, then, if --force is not given, abort.
  No test-case given since it would require a mysqld < 4.1.
[4 Oct 2007 23:01] Tatiana Azundris Nuernberg
pushed to 4.1.24, 5.0.52, 5.1 maint trees
[18 Oct 2007 21:34] Bugs System
Pushed into 5.1.23-beta
[18 Oct 2007 21:37] Bugs System
Pushed into 5.0.52
[18 Oct 2007 21:37] Bugs System
Pushed into 4.1.24
[24 Oct 2007 19:56] Paul DuBois
Noted in 4.1.24, 5.0.52, 5.1.23 changelogs.

Versions of mysqldump from MySQL 4.1 or higher tried to use START
TRANSACTION WITH CONSISTENT SNAPSHOT if the --single-transaction and
--master-data options were given, even with servers older than 4.1
that do not support consistent snapshots.