Commit 6a71b067 authored by unknown's avatar unknown

Fixed bug #29938.

mysqldump --skip-events --all-databases dumped data of the mysqld.event table,
and during the restoration from this dump events were created in spite
of the --skip-events option.

The mysqldump client has been modified to ignore mysql.event table data
in case of --skip-events options.


client/mysqldump.c:
  Fixed bug #29938.
  The dump_table function has been modified to skip dumping of
  the mysql.event table data in case of the --skip-event mysqldump
  client option.
mysql-test/t/mysqldump.test:
  Updated test case for bug #29938.
mysql-test/r/mysqldump.result:
  Updated test case for bug #29938.
parent 0aefd73b
...@@ -3039,6 +3039,18 @@ static void dump_table(char *table, char *db) ...@@ -3039,6 +3039,18 @@ static void dump_table(char *table, char *db)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
/*
Check --skip-events flag: it is not enough to skip creation of events
discarding SHOW CREATE EVENT statements generation. The myslq.event
table data should be skipped too.
*/
if (!opt_events && !my_strcasecmp(&my_charset_latin1, db, "mysql") &&
!my_strcasecmp(&my_charset_latin1, table, "event"))
{
verbose_msg("-- Skipping data table mysql.event, --skip-events was used\n");
DBUG_VOID_RETURN;
}
result_table= quote_name(table,table_buff, 1); result_table= quote_name(table,table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
......
...@@ -4177,5 +4177,18 @@ set names latin1; ...@@ -4177,5 +4177,18 @@ set names latin1;
# Cleanup. # Cleanup.
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
# #
# BUG#29938: wrong behavior of mysqldump --skip-events
# with --all-databases
#
TRUNCATE mysql.event;
USE test;
CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
TRUNCATE mysql.event;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
#
# End of 5.1 tests # End of 5.1 tests
# #
...@@ -1755,6 +1755,22 @@ DROP DATABASE mysqldump_test_db; ...@@ -1755,6 +1755,22 @@ DROP DATABASE mysqldump_test_db;
########################################################################### ###########################################################################
--echo #
--echo # BUG#29938: wrong behavior of mysqldump --skip-events
--echo # with --all-databases
--echo #
TRUNCATE mysql.event;
USE test;
CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
SHOW EVENTS;
--exec $MYSQL_DUMP --skip-events --all-databases > $MYSQLTEST_VARDIR/tmp/bug29938.sql
TRUNCATE mysql.event;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29938.sql
SHOW EVENTS;
--echo # --echo #
--echo # End of 5.1 tests --echo # End of 5.1 tests
--echo # --echo #
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