summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authortnurnberg@sin.intern.azundris.com <>2007-10-04 08:27:03 +0200
committertnurnberg@sin.intern.azundris.com <>2007-10-04 08:27:03 +0200
commitc623e73e8f8479c0d921025c7fcae1eb8ebd8b27 (patch)
treed1c90504adb3af4d65377229aa62f4c33a8afc93 /client
parent7dbf738f4ab8b892bcc5d7249807e45baa8b9fd8 (diff)
downloadmariadb-git-c623e73e8f8479c0d921025c7fcae1eb8ebd8b27.tar.gz
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 START TRANSACTION WITH CONSISTENT SNAPSHOT which is available from 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.
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 3bf9fff1b86..a2a03334ba3 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2428,6 +2428,18 @@ static int start_transaction(MYSQL *mysql_con)
need the REPEATABLE READ level (not anything lower, for example READ
COMMITTED would give one new consistent read per dumped table).
*/
+ if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data)
+ {
+ fprintf(stderr, "-- %s: the combination of --single-transaction and "
+ "--master-data requires a MySQL server version of at least 4.1 "
+ "(current server's version is %s). %s\n",
+ ignore_errors ? "Warning" : "Error",
+ mysql_con->server_version ? mysql_con->server_version : "unknown",
+ ignore_errors ? "Continuing due to --force, backup may not be consistent across all tables!" : "Aborting.");
+ if (!ignore_errors)
+ exit(EX_MYSQLERR);
+ }
+
return (mysql_query_with_error_report(mysql_con, 0,
"SET SESSION TRANSACTION ISOLATION "
"LEVEL REPEATABLE READ") ||