summaryrefslogtreecommitdiff
path: root/client/mysqldump.c
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-04-03 21:19:12 +0300
committerunknown <monty@narttu.mysql.fi>2003-04-03 21:19:12 +0300
commit6b8e2938f21c508f67ec141256d1ffc77a935851 (patch)
tree2559697c56918e4fd2af81f84fcce0ea24dc60d4 /client/mysqldump.c
parentfb9a939416165321ff4f8b9dae29363671b84de9 (diff)
parentdba3a0b03181126cfc46048396b96e5cd768fe5a (diff)
downloadmariadb-git-6b8e2938f21c508f67ec141256d1ffc77a935851.tar.gz
Merge with 4.0
BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-libmysqld.def~6ca0fa0537a3431c: Auto merged BitKeeper/deleted/.del-mysql.xdc: Delete: netware/mysql.xdc BitKeeper/deleted/.del-mysqld.xdc~1befdfee55e31716: Auto merged BitKeeper/deleted/.del-nwbootstrap~f3bc723dad4ed7e: Auto merged BitKeeper/deleted/.del-nwconfigure~86da352b5e031ed9: Auto merged client/mysql.cc: Auto merged include/my_pthread.h: Auto merged libmysqld/examples/Makefile.am: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/t/backup.test: Auto merged mysql-test/t/myisam.test: Auto merged mysys/default.c: Auto merged mysys/my_init.c: Auto merged mysys/my_pthread.c: Auto merged mysys/thr_mutex.c: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/ha_myisam.cc: Auto merged sql/log.cc: Auto merged sql-bench/crash-me.sh: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_show.cc: Auto merged strings/my_vsnprintf.c: Auto merged sql/sql_parse.cc: Merge with 4.0 (Ignore not existing tables with DROP TEMPOARAY TABLE on slave) mysql-test/r/rpl_loaddata.result: Auto merged
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r--client/mysqldump.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 9d7a904a45a..b5e596ba072 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/
-#define DUMP_VERSION "10.1"
+#define DUMP_VERSION "10.2"
#include <my_global.h>
#include <my_sys.h>
@@ -79,7 +79,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
- tty_password=0,opt_single_transaction=0;
+ opt_delete_master_logs=0, tty_password=0,
+ opt_single_transaction=0;
static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
@@ -153,6 +154,9 @@ static struct my_option my_long_options[] =
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
(gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
+ {"delete-master-logs", OPT_DELETE_MASTER_LOGS,
+ "Delete logs on master after backup. This will automagically enable --first-slave.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K',
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
(gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -354,15 +358,20 @@ static void write_footer(FILE *sql_file)
} /* write_footer */
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
- switch(optid) {
+ switch (optid) {
case OPT_MASTER_DATA:
opt_master_data=1;
opt_first_slave=1;
break;
+ case OPT_DELETE_MASTER_LOGS:
+ opt_delete_master_logs=1;
+ opt_first_slave=1;
+ break;
case 'p':
if (argument)
{
@@ -1590,6 +1599,11 @@ int main(int argc, char **argv)
if (opt_first_slave)
{
+ if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER"))
+ {
+ my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
+ MYF(0), mysql_error(sock));
+ }
if (opt_master_data)
{
if (mysql_query(sock, "SHOW MASTER STATUS") ||
@@ -1611,9 +1625,6 @@ int main(int argc, char **argv)
mysql_free_result(master);
}
}
- if (mysql_query(sock, "FLUSH MASTER"))
- my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
- MYF(0), mysql_error(sock));
if (mysql_query(sock, "UNLOCK TABLES"))
my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s",
MYF(0), mysql_error(sock));