summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/log_tables.result10
-rw-r--r--mysql-test/t/log_tables.test19
-rw-r--r--sql/sql_rename.cc6
3 files changed, 32 insertions, 3 deletions
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index f8321520880..fcde09db7c5 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -899,6 +899,16 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
+use mysql;
+drop table if exists renamed_general_log;
+drop table if exists renamed_slow_log;
+RENAME TABLE general_log TO renamed_general_log;
+ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
+RENAME TABLE slow_log TO renamed_slow_log;
+ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log'
+use test;
+flush tables with read lock;
+unlock tables;
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 076f2e8bc3b..af6c34dec37 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -1027,6 +1027,25 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
+#
+# Bug #47924 main.log_tables times out sporadically
+#
+
+use mysql;
+# Should result in error
+--disable_warnings
+drop table if exists renamed_general_log;
+drop table if exists renamed_slow_log;
+--enable_warnings
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE general_log TO renamed_general_log;
+--error ER_CANT_RENAME_LOG_TABLE
+RENAME TABLE slow_log TO renamed_slow_log;
+
+use test;
+flush tables with read lock;
+unlock tables;
+
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index e85e730db5b..df7054c94d0 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -99,7 +99,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
*/
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name,
ren_table->table_name);
- DBUG_RETURN(1);
+ goto err;
}
}
else
@@ -112,7 +112,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
*/
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), ren_table->table_name,
ren_table->table_name);
- DBUG_RETURN(1);
+ goto err;
}
else
{
@@ -130,7 +130,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
else
my_error(ER_CANT_RENAME_LOG_TABLE, MYF(0), rename_log_table[1],
rename_log_table[1]);
- DBUG_RETURN(1);
+ goto err;
}
}