Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Created April 30, 2013 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoku0825/5487061 to your computer and use it in GitHub Desktop.
Save yoku0825/5487061 to your computer and use it in GitHub Desktop.
MySQL 5.5.30のmysqldumpに当てるパッチ。
*** client/mysqldump.c.org 2013-01-16 16:35:17.000000000 +0900
--- client/mysqldump.c 2013-04-10 14:21:27.334773435 +0900
***************
*** 1,5 ****
--- 1,6 ----
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013 yoku0825. in modified parts based MySQL 5.5.30.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 38,44 ****
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
! #define DUMP_VERSION "10.13"
#include <my_global.h>
#include <my_sys.h>
--- 39,45 ----
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
! #define DUMP_VERSION "10.13-modified"
#include <my_global.h>
#include <my_sys.h>
***************
*** 300,306 ****
"global read lock is only taken a short time at the beginning of the dump "
"- don't forget to read about --single-transaction below). In all cases "
"any action on logs will happen at the exact moment of the dump."
! "Option automatically turns --lock-tables off.",
&opt_slave_data, &opt_slave_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
{"events", 'E', "Dump events.",
--- 301,309 ----
"global read lock is only taken a short time at the beginning of the dump "
"- don't forget to read about --single-transaction below). In all cases "
"any action on logs will happen at the exact moment of the dump."
! "Option automatically turns --lock-tables off."
! "If you give both of --master-data[=1 or 2] and --dump-slave[=1 or 2], "
! "it is forced to behaver --master-data=2 and --dump-slave=2(force to comment out both CHANGE MASTER TO). ",
&opt_slave_data, &opt_slave_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
{"events", 'E', "Dump events.",
***************
*** 387,393 ****
"global read lock is only taken a short time at the beginning of the dump; "
"don't forget to read about --single-transaction below). In all cases, "
"any action on logs will happen at the exact moment of the dump. "
! "Option automatically turns --lock-tables off.",
&opt_master_data, &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
--- 390,398 ----
"global read lock is only taken a short time at the beginning of the dump; "
"don't forget to read about --single-transaction below). In all cases, "
"any action on logs will happen at the exact moment of the dump. "
! "Option automatically turns --lock-tables off."
! "If you give both of --master-data[=1 or 2] and --dump-slave[=1 or 2], "
! "it is forced to behaver --master-data=2 and --dump-slave=2(force to comment out both CHANGE MASTER TO). ",
&opt_master_data, &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
***************
*** 613,618 ****
--- 618,631 ----
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
+ puts("This mysqldump is modified by yoku0825 based on mysqldump in MySQL 5.5.30.");
+ puts("Copyright (c) 2013, yoku0825 in modified parts.\n");
+ puts(" - Using master-data with dump-slave is allowed at same time.");
+ puts(" If you give both of master-data and dump-slave,");
+ puts(" it is forced to behave master-data=2 and dump-slave=2(force to comment out both CHANGE MASTER TO).");
+ puts(" - Adding FLUSH TABLES WITH READ LOCK in dump-slave behavier. See Bugs #65035.");
+ puts(" - Void STOP SQL_THREAD at dump-slave with single-transaction. See Bugs #65035.");
+ puts(" - Modified deprecated SET OPTION SQL_QUOTE_SHOW_CREATE = 1. See Bugs #67507.\n");
puts("Dumping structure and contents of MySQL databases and tables.");
short_usage_sub();
print_defaults("my",load_default_groups);
***************
*** 950,956 ****
if (opt_slave_data)
{
opt_lock_all_tables= !opt_single_transaction;
- opt_master_data= 0;
opt_delete_master_logs= 0;
}
--- 963,968 ----
***************
*** 966,973 ****
if (opt_master_data)
{
opt_lock_all_tables= !opt_single_transaction;
- opt_slave_data= 0;
}
if (opt_single_transaction || opt_lock_all_tables)
lock_tables= 0;
if (enclosed && opt_enclosed)
--- 978,987 ----
if (opt_master_data)
{
opt_lock_all_tables= !opt_single_transaction;
}
+ if (opt_master_data && opt_slave_data)
+ opt_master_data= opt_slave_data= 2;
+
if (opt_single_transaction || opt_lock_all_tables)
lock_tables= 0;
if (enclosed && opt_enclosed)
***************
*** 2480,2486 ****
verbose_msg("-- Retrieving table structure for table %s...\n", table);
len= my_snprintf(query_buff, sizeof(query_buff),
! "SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
if (!create_options)
strmov(query_buff+len,
--- 2494,2500 ----
verbose_msg("-- Retrieving table structure for table %s...\n", table);
len= my_snprintf(query_buff, sizeof(query_buff),
! "SET SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
if (!create_options)
strmov(query_buff+len,
***************
*** 5199,5205 ****
verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET
! sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
#endif
--- 5213,5219 ----
verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET
! sprintf(insert_pat,"SET SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
#endif
***************
*** 5458,5467 ****
if (!path)
write_header(md_result_file, *argv);
! if (opt_slave_data && do_stop_slave_sql(mysql))
goto err;
! if ((opt_lock_all_tables || opt_master_data ||
(opt_single_transaction && flush_logs)) &&
do_flush_tables_read_lock(mysql))
goto err;
--- 5472,5481 ----
if (!path)
write_header(md_result_file, *argv);
! if (opt_slave_data && !opt_single_transaction && do_stop_slave_sql(mysql))
goto err;
! if ((opt_lock_all_tables || opt_master_data || opt_slave_data ||
(opt_single_transaction && flush_logs)) &&
do_flush_tables_read_lock(mysql))
goto err;
***************
*** 5470,5476 ****
Flush logs before starting transaction since
this causes implicit commit starting mysql-5.5.
*/
! if (opt_lock_all_tables || opt_master_data ||
(opt_single_transaction && flush_logs) ||
opt_delete_master_logs)
{
--- 5484,5490 ----
Flush logs before starting transaction since
this causes implicit commit starting mysql-5.5.
*/
! if (opt_lock_all_tables || opt_master_data || opt_slave_data ||
(opt_single_transaction && flush_logs) ||
opt_delete_master_logs)
{
***************
*** 5529,5535 ****
}
/* if --dump-slave , start the slave sql thread */
! if (opt_slave_data && do_start_slave_sql(mysql))
goto err;
/* add 'START SLAVE' to end of dump */
--- 5543,5549 ----
}
/* if --dump-slave , start the slave sql thread */
! if (opt_slave_data && !opt_single_transaction && do_start_slave_sql(mysql))
goto err;
/* add 'START SLAVE' to end of dump */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment