Commit 3efeb892 authored by unknown's avatar unknown
Browse files

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

parent 49042de5
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -1722,15 +1722,16 @@ static void dumpTable(uint numFields, char *table)
      goto err;
    }

    if (opt_disable_keys)
    if (opt_lock)
    {
      fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
	      opt_quoted_table);
      fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
      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);
    }

@@ -1991,17 +1992,19 @@ static void dumpTable(uint numFields, char *table)
      error= EX_CONSCHECK;
      goto err;
    }
    if (opt_lock)
    {
      fputs("UNLOCK TABLES;\n", md_result_file);
      check_io(md_result_file);
    }

    /* Moved enable keys to before unlock per bug 15977 */
    if (opt_disable_keys)
    {
      fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
	      opt_quoted_table);
      check_io(md_result_file);
    }
    if (opt_lock)
    {
      fputs("UNLOCK TABLES;\n", md_result_file);
      check_io(md_result_file);
    }
    if (opt_autocommit)
    {
      fprintf(md_result_file, "commit;\n");
+34 −52

File changed.

Preview size limit exceeded, changes collapsed.