Commit 56fd0d7b authored by anel's avatar anel

MDEV-28344:sys.ps_setup_save and dependent procedures fail with ER_ILLEGAL_HA_CREATE_OPTION

- The problem:
==============
- Commit f7216fa6 created the check function for
  default temporary storage engine and in case the SE doesn't support temporary tables
  the error `ER_ILLEGAL_HA_CREATE_OPTION` is raised.
  Before that commit in such cases temporary tables were created by silently substituting
  default SE (RocksDB, Connect, PerfSchema) with MyISAM.
- The test `pr_diagnostics.test` was modified in that commit with raising the error,
  since I didn't check the root cause of test itself.

- The solution:
===============
- This commit update the root case: procedure `ps_setup_save()` that uses temporary
  tables created from performance schema tables definition using `LIKE`, what is not supported.
  The suggested fix is to use InnoDB table by using `AS SELECT`.
- Note that test `pr_diagnostics` will raise this error for `medium/full` third argument,
  but not for `current` value of third argument.
- Additionally this patch updates the test case of commit f7216fa6, by adding missing relation
  between temporary tables and Performance schema in `perfschema.misc` test.

- Reviewed by: <wlad@mariadb.com>
parent 638afc4a
......@@ -174,3 +174,16 @@ select object_type, object_schema, object_name
from performance_schema.objects_summary_global_by_type
where object_schema="test";
object_type object_schema object_name
#
# MDEV-28344: sys.ps_setup_save and dependent procedures fail
# with ER_ILLEGAL_HA_CREATE_OPTION
#
CREATE TEMPORARY TABLE t1 (t int) ENGINE = PERFORMANCE_SCHEMA;
ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
CREATE TEMPORARY TABLE t1 LIKE performance_schema.setup_actors;
ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
SET @default_storage_engine_old = @@default_storage_engine;
SET default_storage_engine = performance_schema;
CREATE TEMPORARY TABLE t1 (t int);
ERROR HY000: Table storage engine 'PERFORMANCE_SCHEMA' does not support the create option 'TEMPORARY'
SET @@default_storage_engine = @default_storage_engine_old;
......@@ -298,3 +298,23 @@ drop tables t1;
select object_type, object_schema, object_name
from performance_schema.objects_summary_global_by_type
where object_schema="test";
--echo #
--echo # MDEV-28344: sys.ps_setup_save and dependent procedures fail
--echo # with ER_ILLEGAL_HA_CREATE_OPTION
--echo #
# It is not allowed to create temporary tables with performance schema
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TEMPORARY TABLE t1 (t int) ENGINE = PERFORMANCE_SCHEMA;
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TEMPORARY TABLE t1 LIKE performance_schema.setup_actors;
SET @default_storage_engine_old = @@default_storage_engine;
SET default_storage_engine = performance_schema;
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TEMPORARY TABLE t1 (t int);
SET @@default_storage_engine = @default_storage_engine_old;
\ No newline at end of file
......@@ -6,6 +6,8 @@ SET @sys.debug = 'OFF',
@sys.diagnostics.allow_i_s_tables = 'OFF',
@sys.diagnostics.include_raw = 'OFF';
CALL sys.diagnostics(0, 0, 'full');
summary
Disabled 1 thread
ERROR 45000: in_max_runtime must be greater than 0
CALL sys.diagnostics(2, 0, 'full');
ERROR 45000: in_interval must be greater than 0
......
......@@ -19,7 +19,6 @@ SET @sys.debug = 'ON',
@sys.diagnostics.allow_i_s_tables = 'ON',
@sys.diagnostics.include_raw = 'ON';
--error ER_ILLEGAL_HA_CREATE_OPTION
CALL sys.diagnostics(4, 2, 'full');
SET @sys.debug = 'OFF',
......
......@@ -80,14 +80,11 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp_setup_instruments;
DROP TEMPORARY TABLE IF EXISTS tmp_threads;
CREATE TEMPORARY TABLE tmp_setup_actors LIKE performance_schema.setup_actors;
CREATE TEMPORARY TABLE tmp_setup_consumers LIKE performance_schema.setup_consumers;
CREATE TEMPORARY TABLE tmp_setup_instruments LIKE performance_schema.setup_instruments;
CREATE TEMPORARY TABLE tmp_setup_actors AS SELECT * FROM performance_schema.setup_actors;
CREATE TEMPORARY TABLE tmp_setup_consumers AS SELECT * FROM performance_schema.setup_consumers;
CREATE TEMPORARY TABLE tmp_setup_instruments AS SELECT * FROM performance_schema.setup_instruments;
CREATE TEMPORARY TABLE tmp_threads (THREAD_ID bigint unsigned NOT NULL PRIMARY KEY, INSTRUMENTED enum('YES','NO') NOT NULL);
INSERT INTO tmp_setup_actors SELECT * FROM performance_schema.setup_actors;
INSERT INTO tmp_setup_consumers SELECT * FROM performance_schema.setup_consumers;
INSERT INTO tmp_setup_instruments SELECT * FROM performance_schema.setup_instruments;
INSERT INTO tmp_threads SELECT THREAD_ID, INSTRUMENTED FROM performance_schema.threads;
ELSE
SIGNAL SQLSTATE VALUE '90000'
......
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