mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Bug#26121 mysqldump includes LOCK TABLES general_log WRITE
- Giving the directive '--all-databases' to mysqldump caused an attempt to lock and dump log tables which don't support this operation. - With this patch the log tables are excluded from the set of databases tables to dump. client/mysqldump.c: - Ignore log tables which can't be locked. mysql-test/t/mysqldump.test: Added test
This commit is contained in:
parent
c1020aa4c6
commit
393e2aa9d5
2 changed files with 19 additions and 4 deletions
|
@ -818,11 +818,15 @@ static int get_options(int *argc, char ***argv)
|
||||||
(hash_get_key) get_table_key,
|
(hash_get_key) get_table_key,
|
||||||
(hash_free_key) free_table_ent, 0))
|
(hash_free_key) free_table_ent, 0))
|
||||||
return(EX_EOM);
|
return(EX_EOM);
|
||||||
/* Don't copy cluster internal log tables */
|
/* Don't copy internal log tables */
|
||||||
if (my_hash_insert(&ignore_table,
|
if (my_hash_insert(&ignore_table,
|
||||||
(byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
|
(byte*) my_strdup("mysql.apply_status", MYF(MY_WME))) ||
|
||||||
my_hash_insert(&ignore_table,
|
my_hash_insert(&ignore_table,
|
||||||
(byte*) my_strdup("mysql.schema", MYF(MY_WME))))
|
(byte*) my_strdup("mysql.schema", MYF(MY_WME))) ||
|
||||||
|
my_hash_insert(&ignore_table,
|
||||||
|
(byte*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
|
||||||
|
my_hash_insert(&ignore_table,
|
||||||
|
(byte*) my_strdup("mysql.slow_log", MYF(MY_WME))))
|
||||||
return(EX_EOM);
|
return(EX_EOM);
|
||||||
|
|
||||||
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
|
@ -3291,8 +3295,12 @@ static int dump_all_tables_in_db(char *database)
|
||||||
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
|
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
|
||||||
for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
|
for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
|
||||||
{
|
{
|
||||||
dynstr_append(&query, quote_name(table, table_buff, 1));
|
char *end= strmov(afterdot, table);
|
||||||
dynstr_append(&query, " READ /*!32311 LOCAL */,");
|
if (include_table(hash_key,end - hash_key))
|
||||||
|
{
|
||||||
|
dynstr_append(&query, quote_name(table, table_buff, 1));
|
||||||
|
dynstr_append(&query, " READ /*!32311 LOCAL */,");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
|
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
|
||||||
DB_error(mysql, "when using LOCK TABLES");
|
DB_error(mysql, "when using LOCK TABLES");
|
||||||
|
|
|
@ -1546,6 +1546,13 @@ drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop database mysqldump_test_db;
|
drop database mysqldump_test_db;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#26121 mysqldump includes LOCK TABLES general_log WRITE
|
||||||
|
#
|
||||||
|
--exec $MYSQL_DUMP --all-databases > $MYSQLTEST_VARDIR/tmp/bug26121.sql
|
||||||
|
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug26121.sql
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug26121.sql
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.1 tests
|
--echo # End of 5.1 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
Loading…
Add table
Reference in a new issue