Commit 3efeb892 authored by unknown's avatar unknown

Fix for bug #15977 (switch ordering of DISABLE KEYS/LOCK TABLE in mysqldump)

parent 49042de5
...@@ -1722,15 +1722,16 @@ static void dumpTable(uint numFields, char *table) ...@@ -1722,15 +1722,16 @@ static void dumpTable(uint numFields, char *table)
goto err; goto err;
} }
if (opt_disable_keys) if (opt_lock)
{ {
fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n", fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
opt_quoted_table);
check_io(md_result_file); check_io(md_result_file);
} }
if (opt_lock) /* Moved disable keys to after lock per bug 15977 */
if (opt_disable_keys)
{ {
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table); fprintf(md_result_file, "/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
opt_quoted_table);
check_io(md_result_file); check_io(md_result_file);
} }
...@@ -1991,17 +1992,19 @@ static void dumpTable(uint numFields, char *table) ...@@ -1991,17 +1992,19 @@ static void dumpTable(uint numFields, char *table)
error= EX_CONSCHECK; error= EX_CONSCHECK;
goto err; goto err;
} }
if (opt_lock)
{ /* Moved enable keys to before unlock per bug 15977 */
fputs("UNLOCK TABLES;\n", md_result_file);
check_io(md_result_file);
}
if (opt_disable_keys) if (opt_disable_keys)
{ {
fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n", fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
opt_quoted_table); opt_quoted_table);
check_io(md_result_file); check_io(md_result_file);
} }
if (opt_lock)
{
fputs("UNLOCK TABLES;\n", md_result_file);
check_io(md_result_file);
}
if (opt_autocommit) if (opt_autocommit)
{ {
fprintf(md_result_file, "commit;\n"); fprintf(md_result_file, "commit;\n");
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment