summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2020-06-15 13:40:50 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2020-06-24 14:37:54 +0300
commit97f7d4a9b4da77cb79699a0ea873e4a0e628e8a3 (patch)
treeec6b0d3ddc3707e32dcfff4e91f9f9d81dd35e96
parente3104c4a8c6b97bbc295a2ec7802c30c51fb7801 (diff)
downloadmariadb-git-97f7d4a9b4da77cb79699a0ea873e4a0e628e8a3.tar.gz
MDEV-22726: Add check that one can't change general or slow log to a
transactional engine
-rw-r--r--mysql-test/r/log_tables.result6
-rw-r--r--mysql-test/t/log_tables.test8
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/sql_table.cc7
4 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index aed5dbfba3d..6b5a2ad1577 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -259,6 +259,12 @@ Warning 1286 Unknown storage engine 'NonExistentEngine'
alter table mysql.slow_log engine=memory;
ERROR HY000: Storage engine MEMORY cannot be used for log tables
set storage_engine= @save_storage_engine;
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ERROR HY000: Only non-transactional Aria table can be used for logging
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ERROR HY000: Only non-transactional Aria table can be used for logging
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
drop table mysql.slow_log;
drop table mysql.general_log;
drop table mysql.general_log;
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 4ea8a7639ef..1146611ac6c 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -269,6 +269,14 @@ alter table mysql.slow_log engine=memory;
#alter table mysql.slow_log engine=blackhole;
set storage_engine= @save_storage_engine;
+# Make sure only non-transactional Aria table can be used for logging
+--error ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+--error ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
+
drop table mysql.slow_log;
drop table mysql.general_log;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index ff495f69a4f..8db992c7501 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7731,3 +7731,5 @@ ER_GEOJSON_EMPTY_COORDINATES
ER_MYROCKS_CANT_NOPAD_COLLATION
eng "MyRocks doesn't currently support collations with \"No pad\" attribute."
+ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ eng "Only non-transactional Aria table can be used for logging"
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7cce3bcc323..b3a600eec36 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -8925,6 +8925,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(true);
}
+ if (create_info->db_type == maria_hton &&
+ create_info->transactional != HA_CHOICE_NO)
+ {
+ my_error(ER_TRANSACTIONAL_ARIA_LOG_ENGINE, MYF(0));
+ DBUG_RETURN(true);
+ }
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (alter_info->flags & Alter_info::ALTER_PARTITION)
{