diff options
Diffstat (limited to 'mysql-test/suite/sysschema')
190 files changed, 6434 insertions, 0 deletions
diff --git a/mysql-test/suite/sysschema/disabled.def b/mysql-test/suite/sysschema/disabled.def new file mode 100644 index 00000000..62df96a4 --- /dev/null +++ b/mysql-test/suite/sysschema/disabled.def @@ -0,0 +1,12 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## +pr_statement_performance_analyzer : MDEV-29822 perfschema specific and Windows specific problems. diff --git a/mysql-test/suite/sysschema/include/ps_setup_actors_cleanup.inc b/mysql-test/suite/sysschema/include/ps_setup_actors_cleanup.inc new file mode 100644 index 00000000..0e18278d --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_setup_actors_cleanup.inc @@ -0,0 +1,5 @@ +# Reset the performance_schema.setup_actors table + +TRUNCATE TABLE performance_schema.setup_actors; + +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); diff --git a/mysql-test/suite/sysschema/include/ps_setup_consumers_cleanup.inc b/mysql-test/suite/sysschema/include/ps_setup_consumers_cleanup.inc new file mode 100644 index 00000000..ee591ec6 --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_setup_consumers_cleanup.inc @@ -0,0 +1,3 @@ +# Reset the performance_schema.setup_consumers table + +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; diff --git a/mysql-test/suite/sysschema/include/ps_setup_instruments_cleanup.inc b/mysql-test/suite/sysschema/include/ps_setup_instruments_cleanup.inc new file mode 100644 index 00000000..aa782d12 --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_setup_instruments_cleanup.inc @@ -0,0 +1,3 @@ +# Reset the performance_schema.setup_instruments table + +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; diff --git a/mysql-test/suite/sysschema/include/ps_setup_reset_to_default_cleanup.inc b/mysql-test/suite/sysschema/include/ps_setup_reset_to_default_cleanup.inc new file mode 100644 index 00000000..6be56538 --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_setup_reset_to_default_cleanup.inc @@ -0,0 +1,9 @@ +# Reset all Performance Schema configuration + +--source ./ps_setup_instruments_cleanup.inc + +--source ./ps_setup_actors_cleanup.inc + +--source ./ps_setup_consumers_cleanup.inc + +--source ./ps_threads_cleanup.inc diff --git a/mysql-test/suite/sysschema/include/ps_threads_cleanup.inc b/mysql-test/suite/sysschema/include/ps_threads_cleanup.inc new file mode 100644 index 00000000..708f2f7c --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_threads_cleanup.inc @@ -0,0 +1,3 @@ +# Reset the performance_schema.setup_consumers table + +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/include/ps_truncate_all_tables.inc b/mysql-test/suite/sysschema/include/ps_truncate_all_tables.inc new file mode 100644 index 00000000..4811b8af --- /dev/null +++ b/mysql-test/suite/sysschema/include/ps_truncate_all_tables.inc @@ -0,0 +1,6 @@ +# Reset all underlying Performance Schema data + +--disable_result_log +--disable_query_log ONCE +CALL sys.ps_truncate_all_tables(FALSE); +--enable_result_log diff --git a/mysql-test/suite/sysschema/include/sys_config_cleanup.inc b/mysql-test/suite/sysschema/include/sys_config_cleanup.inc new file mode 100644 index 00000000..af8d0362 --- /dev/null +++ b/mysql-test/suite/sysschema/include/sys_config_cleanup.inc @@ -0,0 +1,17 @@ +# Reset the sys.sys_config table + +# Note, we have to disable the triggers to reset the set_by column back to NULL +# as the sys.sys_config_update_set_user trigger will overwrite it to the current user +SET @sys.ignore_sys_config_triggers := true; + +DELETE FROM sys.sys_config; + +INSERT IGNORE INTO sys.sys_config (variable, value) VALUES + ('statement_truncate_len', 64), + ('statement_performance_analyzer.limit', 100), + ('statement_performance_analyzer.view', NULL), + ('diagnostics.allow_i_s_tables', 'OFF'), + ('diagnostics.include_raw', 'OFF'), + ('ps_thread_trx_info.max_length', 65535); + +SET @sys.ignore_sys_config_triggers := NULL; diff --git a/mysql-test/suite/sysschema/r/all_sys_objects_exist.result b/mysql-test/suite/sysschema/r/all_sys_objects_exist.result new file mode 100644 index 00000000..6dddd8a1 --- /dev/null +++ b/mysql-test/suite/sysschema/r/all_sys_objects_exist.result @@ -0,0 +1,159 @@ +USE sys; +SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' ORDER BY TABLE_NAME; +TABLE_NAME +host_summary +host_summary_by_file_io +host_summary_by_file_io_type +host_summary_by_stages +host_summary_by_statement_latency +host_summary_by_statement_type +innodb_buffer_stats_by_schema +innodb_buffer_stats_by_table +innodb_lock_waits +io_by_thread_by_latency +io_global_by_file_by_bytes +io_global_by_file_by_latency +io_global_by_wait_by_bytes +io_global_by_wait_by_latency +latest_file_io +memory_by_host_by_current_bytes +memory_by_thread_by_current_bytes +memory_by_user_by_current_bytes +memory_global_by_current_bytes +memory_global_total +metrics +processlist +ps_check_lost_instrumentation +schema_auto_increment_columns +schema_index_statistics +schema_object_overview +schema_redundant_indexes +schema_tables_with_full_table_scans +schema_table_lock_waits +schema_table_statistics +schema_table_statistics_with_buffer +schema_unused_indexes +session +session_ssl_status +statements_with_errors_or_warnings +statements_with_full_table_scans +statements_with_runtimes_in_95th_percentile +statements_with_sorting +statements_with_temp_tables +statement_analysis +sys_config +user_summary +user_summary_by_file_io +user_summary_by_file_io_type +user_summary_by_stages +user_summary_by_statement_latency +user_summary_by_statement_type +version +waits_by_host_by_latency +waits_by_user_by_latency +waits_global_by_latency +wait_classes_global_by_avg_latency +wait_classes_global_by_latency +x$host_summary +x$host_summary_by_file_io +x$host_summary_by_file_io_type +x$host_summary_by_stages +x$host_summary_by_statement_latency +x$host_summary_by_statement_type +x$innodb_buffer_stats_by_schema +x$innodb_buffer_stats_by_table +x$innodb_lock_waits +x$io_by_thread_by_latency +x$io_global_by_file_by_bytes +x$io_global_by_file_by_latency +x$io_global_by_wait_by_bytes +x$io_global_by_wait_by_latency +x$latest_file_io +x$memory_by_host_by_current_bytes +x$memory_by_thread_by_current_bytes +x$memory_by_user_by_current_bytes +x$memory_global_by_current_bytes +x$memory_global_total +x$processlist +x$ps_digest_95th_percentile_by_avg_us +x$ps_digest_avg_latency_distribution +x$ps_schema_table_statistics_io +x$schema_flattened_keys +x$schema_index_statistics +x$schema_tables_with_full_table_scans +x$schema_table_lock_waits +x$schema_table_statistics +x$schema_table_statistics_with_buffer +x$session +x$statements_with_errors_or_warnings +x$statements_with_full_table_scans +x$statements_with_runtimes_in_95th_percentile +x$statements_with_sorting +x$statements_with_temp_tables +x$statement_analysis +x$user_summary +x$user_summary_by_file_io +x$user_summary_by_file_io_type +x$user_summary_by_stages +x$user_summary_by_statement_latency +x$user_summary_by_statement_type +x$waits_by_host_by_latency +x$waits_by_user_by_latency +x$waits_global_by_latency +x$wait_classes_global_by_avg_latency +x$wait_classes_global_by_latency +SELECT ROUTINE_NAME, ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' ORDER BY ROUTINE_TYPE, ROUTINE_NAME; +ROUTINE_NAME ROUTINE_TYPE +extract_schema_from_file_name FUNCTION +extract_table_from_file_name FUNCTION +format_bytes FUNCTION +format_path FUNCTION +format_statement FUNCTION +format_time FUNCTION +list_add FUNCTION +list_drop FUNCTION +ps_is_account_enabled FUNCTION +ps_is_consumer_enabled FUNCTION +ps_is_instrument_default_enabled FUNCTION +ps_is_instrument_default_timed FUNCTION +ps_is_thread_instrumented FUNCTION +ps_thread_account FUNCTION +ps_thread_id FUNCTION +ps_thread_stack FUNCTION +ps_thread_trx_info FUNCTION +quote_identifier FUNCTION +sys_get_config FUNCTION +version_major FUNCTION +version_minor FUNCTION +version_patch FUNCTION +create_synonym_db PROCEDURE +diagnostics PROCEDURE +execute_prepared_stmt PROCEDURE +ps_setup_disable_background_threads PROCEDURE +ps_setup_disable_consumer PROCEDURE +ps_setup_disable_instrument PROCEDURE +ps_setup_disable_thread PROCEDURE +ps_setup_enable_background_threads PROCEDURE +ps_setup_enable_consumer PROCEDURE +ps_setup_enable_instrument PROCEDURE +ps_setup_enable_thread PROCEDURE +ps_setup_reload_saved PROCEDURE +ps_setup_reset_to_default PROCEDURE +ps_setup_save PROCEDURE +ps_setup_show_disabled PROCEDURE +ps_setup_show_disabled_consumers PROCEDURE +ps_setup_show_disabled_instruments PROCEDURE +ps_setup_show_enabled PROCEDURE +ps_setup_show_enabled_consumers PROCEDURE +ps_setup_show_enabled_instruments PROCEDURE +ps_statement_avg_latency_histogram PROCEDURE +ps_trace_statement_digest PROCEDURE +ps_trace_thread PROCEDURE +ps_truncate_all_tables PROCEDURE +statement_performance_analyzer PROCEDURE +table_exists PROCEDURE +SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys' ORDER BY TRIGGER_NAME; +TRIGGER_NAME +SELECT sys_version FROM sys.version; +sys_version +1.5.1 diff --git a/mysql-test/suite/sysschema/r/fn_extract_schema_from_file_name.result b/mysql-test/suite/sysschema/r/fn_extract_schema_from_file_name.result new file mode 100644 index 00000000..c25f82eb --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_extract_schema_from_file_name.result @@ -0,0 +1,6 @@ +SELECT sys.extract_schema_from_file_name(NULL); +sys.extract_schema_from_file_name(NULL) +NULL +SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); +sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd') +employees diff --git a/mysql-test/suite/sysschema/r/fn_extract_table_from_file_name.result b/mysql-test/suite/sysschema/r/fn_extract_table_from_file_name.result new file mode 100644 index 00000000..a9297feb --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_extract_table_from_file_name.result @@ -0,0 +1,6 @@ +SELECT sys.extract_table_from_file_name(NULL); +sys.extract_table_from_file_name(NULL) +NULL +SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); +sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd') +employee diff --git a/mysql-test/suite/sysschema/r/fn_format_bytes.result b/mysql-test/suite/sysschema/r/fn_format_bytes.result new file mode 100644 index 00000000..5bf6c99b --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_format_bytes.result @@ -0,0 +1,39 @@ +SELECT sys.format_bytes(NULL); +sys.format_bytes(NULL) +NULL +SELECT sys.format_bytes(1); +sys.format_bytes(1) +1 bytes +SELECT sys.format_bytes(1023); +sys.format_bytes(1023) +1023 bytes +SELECT sys.format_bytes(1024); +sys.format_bytes(1024) +1.00 KiB +SELECT sys.format_bytes(1048575); +sys.format_bytes(1048575) +1024.00 KiB +SELECT sys.format_bytes(1048576); +sys.format_bytes(1048576) +1.00 MiB +SELECT sys.format_bytes(1073741823); +sys.format_bytes(1073741823) +1024.00 MiB +SELECT sys.format_bytes(1073741824); +sys.format_bytes(1073741824) +1.00 GiB +SELECT sys.format_bytes(1099511627775); +sys.format_bytes(1099511627775) +1024.00 GiB +SELECT sys.format_bytes(1099511627776); +sys.format_bytes(1099511627776) +1.00 TiB +SELECT sys.format_bytes(1125899906842623); +sys.format_bytes(1125899906842623) +1024.00 TiB +SELECT sys.format_bytes(1125899906842624); +sys.format_bytes(1125899906842624) +1.00 PiB +SELECT sys.format_bytes(1125899906842624238947293); +sys.format_bytes(1125899906842624238947293) +1000000000.00 PiB diff --git a/mysql-test/suite/sysschema/r/fn_format_path.result b/mysql-test/suite/sysschema/r/fn_format_path.result new file mode 100644 index 00000000..5672b09f --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_format_path.result @@ -0,0 +1,14 @@ +SELECT sys.format_path(NULL); +sys.format_path(NULL) +NULL +SET @mypath := CONCAT(@@global.datadir, 'foo/bar.foo'); +SELECT sys.format_path(@mypath); +sys.format_path(@mypath) +@@datadir/foo/bar.foo +SET @mypath := CONCAT(@@global.tmpdir, '/foo/bar.foo'); +SELECT sys.format_path(@mypath); +sys.format_path(@mypath) +@@tmpdir/foo/bar.foo +SELECT sys.format_path('/foo/bar/baz.foo'); +sys.format_path('/foo/bar/baz.foo') +/foo/bar/baz.foo diff --git a/mysql-test/suite/sysschema/r/fn_format_statement.result b/mysql-test/suite/sysschema/r/fn_format_statement.result new file mode 100644 index 00000000..b07e4b02 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_format_statement.result @@ -0,0 +1,10 @@ +SELECT sys.format_statement(NULL); +sys.format_statement(NULL) +NULL +SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement; +statement +SELECT foo, bar, baz, foobar, ... RE foo = 'foo' AND bar = 'bar' +SET @sys.statement_truncate_len = 80; +SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement; +statement +SELECT foo, bar, baz, foobar, foobaz F ... bar) WHERE foo = 'foo' AND bar = 'bar' diff --git a/mysql-test/suite/sysschema/r/fn_format_time.result b/mysql-test/suite/sysschema/r/fn_format_time.result new file mode 100644 index 00000000..6854bb88 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_format_time.result @@ -0,0 +1,57 @@ +SELECT sys.format_time(NULL); +sys.format_time(NULL) +NULL +SELECT sys.format_time(1); +sys.format_time(1) +1 ps +SELECT sys.format_time(999); +sys.format_time(999) +999 ps +SELECT sys.format_time(1000); +sys.format_time(1000) +1.00 ns +SELECT sys.format_time(999999); +sys.format_time(999999) +1000.00 ns +SELECT sys.format_time(1000000); +sys.format_time(1000000) +1.00 us +SELECT sys.format_time(999999999); +sys.format_time(999999999) +1000.00 us +SELECT sys.format_time(1000000000); +sys.format_time(1000000000) +1.00 ms +SELECT sys.format_time(999999999999); +sys.format_time(999999999999) +1000.00 ms +SELECT sys.format_time(1000000000000); +sys.format_time(1000000000000) +1.00 s +SELECT sys.format_time(59999999999999); +sys.format_time(59999999999999) +60.00 s +SELECT sys.format_time(60000000000000); +sys.format_time(60000000000000) +1.00 m +SELECT sys.format_time(3599999999999999); +sys.format_time(3599999999999999) +60.00 m +SELECT sys.format_time(3600000000000000); +sys.format_time(3600000000000000) +1.00 h +SELECT sys.format_time(86399999999999988); +sys.format_time(86399999999999988) +24.00 h +SELECT sys.format_time(86400000000000000); +sys.format_time(86400000000000000) +1.00 d +SELECT sys.format_time(604799999999999888); +sys.format_time(604799999999999888) +7.00 d +SELECT sys.format_time(604800000000000000); +sys.format_time(604800000000000000) +1.00 w +SELECT sys.format_time(2389472398472389748237429837423984728374); +sys.format_time(2389472398472389748237429837423984728374) +3950847219696411300000.00 w diff --git a/mysql-test/suite/sysschema/r/fn_list_add.result b/mysql-test/suite/sysschema/r/fn_list_add.result new file mode 100644 index 00000000..c3ade975 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_list_add.result @@ -0,0 +1,28 @@ +SELECT sys.list_add(NULL, 'foo'); +sys.list_add(NULL, 'foo') +foo +SELECT sys.list_add('', 'foo'); +sys.list_add('', 'foo') +foo +SELECT sys.list_add('bar', 'foo'); +sys.list_add('bar', 'foo') +bar,foo +SELECT sys.list_add('bar, ', 'foo'); +sys.list_add('bar, ', 'foo') +bar,foo +SELECT sys.list_add('foo', NULL); +ERROR 02200: Function sys.list_add: in_add_value input variable should not be NULL +SET @sqlmode := @@sql_mode; +SELECT @@sql_mode; +@@sql_mode +STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET SESSION sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); +SELECT @@sql_mode; +@@sql_mode +ANSI_QUOTES,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET SESSION sql_mode = @sqlmode; +SET @sqlmode := NULL; +SET @input := REPEAT('a', 4194304); +SELECT sys.list_add(@input, 'foo'); +ERROR 22001: Data too long for column 'in_list' at row 1 +SET @input := NULL; diff --git a/mysql-test/suite/sysschema/r/fn_list_drop.result b/mysql-test/suite/sysschema/r/fn_list_drop.result new file mode 100644 index 00000000..17c1ede1 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_list_drop.result @@ -0,0 +1,30 @@ +SELECT sys.list_drop('1,2,3,4,5', '1'); +sys.list_drop('1,2,3,4,5', '1') +2,3,4,5 +SELECT sys.list_drop('1,2,3,4,5', '3'); +sys.list_drop('1,2,3,4,5', '3') +1,2,4,5 +SELECT sys.list_drop('1,2,3,4,5', '5'); +sys.list_drop('1,2,3,4,5', '5') +1,2,3,4 +SELECT sys.list_drop('1, 2, 3, 4, 5', '1'); +sys.list_drop('1, 2, 3, 4, 5', '1') + 2, 3, 4, 5 +SELECT sys.list_drop('1, 2, 3, 4, 5', '3'); +sys.list_drop('1, 2, 3, 4, 5', '3') +1, 2, 4, 5 +SELECT sys.list_drop('1, 2, 3, 4, 5', '5'); +sys.list_drop('1, 2, 3, 4, 5', '5') +1, 2, 3, 4 +SELECT sys.list_drop('1,2,3,4,5', NULL); +ERROR 02200: Function sys.list_drop: in_drop_value input variable should not be NULL +SET @sqlmode := @@sql_mode; +SELECT @@sql_mode; +@@sql_mode +STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET SESSION sql_mode = sys.list_drop(@@sql_mode, 'STRICT_TRANS_TABLES'); +SELECT @@sql_mode; +@@sql_mode +ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET SESSION sql_mode = @sqlmode; +SET @sqlmode := NULL; diff --git a/mysql-test/suite/sysschema/r/fn_ps_is_account_enabled.result b/mysql-test/suite/sysschema/r/fn_ps_is_account_enabled.result new file mode 100644 index 00000000..79bad719 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_is_account_enabled.result @@ -0,0 +1,14 @@ +SELECT sys.ps_is_account_enabled('foo', 'bar'); +sys.ps_is_account_enabled('foo', 'bar') +YES +DELETE FROM performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES +('test', 'test', '%', 'YES', 'NO'); +SELECT sys.ps_is_account_enabled('foo', 'bar'); +sys.ps_is_account_enabled('foo', 'bar') +NO +SELECT sys.ps_is_account_enabled('test', 'test'); +sys.ps_is_account_enabled('test', 'test') +YES +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); diff --git a/mysql-test/suite/sysschema/r/fn_ps_is_consumer_enabled.result b/mysql-test/suite/sysschema/r/fn_ps_is_consumer_enabled.result new file mode 100644 index 00000000..e69c0728 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_is_consumer_enabled.result @@ -0,0 +1,42 @@ +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_history'; +SELECT sys.ps_is_consumer_enabled('events_stages_history'); +sys.ps_is_consumer_enabled('events_stages_history') +NO +SELECT sys.ps_is_consumer_enabled('global_instrumentation'); +sys.ps_is_consumer_enabled('global_instrumentation') +YES +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_current'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_history'; +SELECT sys.ps_is_consumer_enabled('events_stages_history'); +sys.ps_is_consumer_enabled('events_stages_history') +NO +UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_current'; +SELECT sys.ps_is_consumer_enabled('events_stages_history'); +sys.ps_is_consumer_enabled('events_stages_history') +YES +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'global_instrumentation'; +SELECT sys.ps_is_consumer_enabled('thread_instrumentation'); +sys.ps_is_consumer_enabled('thread_instrumentation') +NO +SELECT sys.ps_is_consumer_enabled('statements_digest'); +sys.ps_is_consumer_enabled('statements_digest') +NO +SELECT sys.ps_is_consumer_enabled('events_stages_current'); +sys.ps_is_consumer_enabled('events_stages_current') +NO +SELECT sys.ps_is_consumer_enabled('events_stages_history'); +sys.ps_is_consumer_enabled('events_stages_history') +NO +SELECT sys.ps_is_consumer_enabled('events_stages_history_long'); +sys.ps_is_consumer_enabled('events_stages_history_long') +NO +SELECT sys.ps_is_consumer_enabled('events_statements_current'); +sys.ps_is_consumer_enabled('events_statements_current') +NO +SELECT sys.ps_is_consumer_enabled('events_statements_history'); +sys.ps_is_consumer_enabled('events_statements_history') +NO +SELECT sys.ps_is_consumer_enabled('events_statements_history_long'); +sys.ps_is_consumer_enabled('events_statements_history_long') +NO +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; diff --git a/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_enabled.result b/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_enabled.result new file mode 100644 index 00000000..e9143faf --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_enabled.result @@ -0,0 +1,48 @@ +SELECT sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers'); +sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers') +YES +SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +sys.ps_is_instrument_default_enabled('statement/sql/select') +YES +SELECT sys.ps_is_instrument_default_enabled('statement/sp/error'); +sys.ps_is_instrument_default_enabled('statement/sp/error') +YES +SELECT sys.ps_is_instrument_default_enabled('statement/com/Prepare'); +sys.ps_is_instrument_default_enabled('statement/com/Prepare') +YES +SELECT sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog'); +sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog') +YES +SELECT sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler'); +sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler') +YES +SELECT sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler'); +sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler') +YES +SELECT sys.ps_is_instrument_default_enabled('idle'); +sys.ps_is_instrument_default_enabled('idle') +YES +SELECT sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin'); +sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin') +NO +SELECT sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant'); +sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant') +NO +SELECT sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch'); +sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch') +NO +SELECT sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond'); +sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond') +NO +SELECT sys.ps_is_instrument_default_enabled('stage/sql/end'); +sys.ps_is_instrument_default_enabled('stage/sql/end') +NO +SELECT sys.ps_is_instrument_default_enabled('transaction'); +sys.ps_is_instrument_default_enabled('transaction') +NO +SELECT sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket'); +sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket') +NO +SELECT sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl'); +sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl') +NO diff --git a/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_timed.result b/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_timed.result new file mode 100644 index 00000000..99f426c6 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_is_instrument_default_timed.result @@ -0,0 +1,48 @@ +SELECT sys.ps_is_instrument_default_timed('wait/io/file/sql/binlog'); +sys.ps_is_instrument_default_timed('wait/io/file/sql/binlog') +YES +SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +sys.ps_is_instrument_default_timed('statement/sql/select') +YES +SELECT sys.ps_is_instrument_default_timed('statement/sp/error'); +sys.ps_is_instrument_default_timed('statement/sp/error') +YES +SELECT sys.ps_is_instrument_default_timed('statement/com/Prepare'); +sys.ps_is_instrument_default_timed('statement/com/Prepare') +YES +SELECT sys.ps_is_instrument_default_timed('wait/io/table/sql/handler'); +sys.ps_is_instrument_default_timed('wait/io/table/sql/handler') +YES +SELECT sys.ps_is_instrument_default_timed('wait/lock/table/sql/handler'); +sys.ps_is_instrument_default_timed('wait/lock/table/sql/handler') +YES +SELECT sys.ps_is_instrument_default_timed('idle'); +sys.ps_is_instrument_default_timed('idle') +YES +SELECT sys.ps_is_instrument_default_timed('wait/synch/mutex/sql/LOCK_plugin'); +sys.ps_is_instrument_default_timed('wait/synch/mutex/sql/LOCK_plugin') +NO +SELECT sys.ps_is_instrument_default_timed('wait/synch/rwlock/sql/LOCK_grant'); +sys.ps_is_instrument_default_timed('wait/synch/rwlock/sql/LOCK_grant') +NO +SELECT sys.ps_is_instrument_default_timed('wait/synch/sxlock/innodb/btr_search_latch'); +sys.ps_is_instrument_default_timed('wait/synch/sxlock/innodb/btr_search_latch') +NO +SELECT sys.ps_is_instrument_default_timed('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond'); +sys.ps_is_instrument_default_timed('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond') +NO +SELECT sys.ps_is_instrument_default_timed('stage/sql/end'); +sys.ps_is_instrument_default_timed('stage/sql/end') +NO +SELECT sys.ps_is_instrument_default_timed('transaction'); +sys.ps_is_instrument_default_timed('transaction') +NO +SELECT sys.ps_is_instrument_default_timed('wait/io/socket/sql/server_tcpip_socket'); +sys.ps_is_instrument_default_timed('wait/io/socket/sql/server_tcpip_socket') +NO +SELECT sys.ps_is_instrument_default_timed('memory/performance_schema/internal_buffers'); +sys.ps_is_instrument_default_timed('memory/performance_schema/internal_buffers') +NO +SELECT sys.ps_is_instrument_default_timed('wait/lock/metadata/sql/mdl'); +sys.ps_is_instrument_default_timed('wait/lock/metadata/sql/mdl') +NO diff --git a/mysql-test/suite/sysschema/r/fn_ps_is_thread_instrumented.result b/mysql-test/suite/sysschema/r/fn_ps_is_thread_instrumented.result new file mode 100644 index 00000000..90583e3c --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_is_thread_instrumented.result @@ -0,0 +1,14 @@ +SELECT sys.ps_is_thread_instrumented(NULL); +sys.ps_is_thread_instrumented(NULL) +NULL +SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +sys.ps_is_thread_instrumented(CONNECTION_ID()) +YES +UPDATE performance_schema.threads SET instrumented = 'NO' WHERE processlist_id = CONNECTION_ID(); +SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +sys.ps_is_thread_instrumented(CONNECTION_ID()) +NO +SELECT sys.ps_is_thread_instrumented(234623462376); +sys.ps_is_thread_instrumented(234623462376) +UNKNOWN +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/fn_ps_thread_account.result b/mysql-test/suite/sysschema/r/fn_ps_thread_account.result new file mode 100644 index 00000000..67f7e8fa --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_thread_account.result @@ -0,0 +1,9 @@ +SELECT sys.ps_thread_account(NULL); +sys.ps_thread_account(NULL) +NULL +SELECT sys.ps_thread_account(234623462376); +sys.ps_thread_account(234623462376) +NULL +SELECT sys.ps_thread_account(sys.ps_thread_id(NULL)); +sys.ps_thread_account(sys.ps_thread_id(NULL)) +root@localhost diff --git a/mysql-test/suite/sysschema/r/fn_ps_thread_id.result b/mysql-test/suite/sysschema/r/fn_ps_thread_id.result new file mode 100644 index 00000000..8d1677af --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_thread_id.result @@ -0,0 +1,9 @@ +SELECT sys.ps_thread_id(234623462376); +sys.ps_thread_id(234623462376) +NULL +SELECT sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id; +sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id +1 +SELECT sys.ps_thread_id(NULL) = @ps_thread_id; +sys.ps_thread_id(NULL) = @ps_thread_id +1 diff --git a/mysql-test/suite/sysschema/r/fn_ps_thread_trx_info.result b/mysql-test/suite/sysschema/r/fn_ps_thread_trx_info.result new file mode 100644 index 00000000..fe11e702 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_ps_thread_trx_info.result @@ -0,0 +1,92 @@ +SELECT sys.ps_thread_trx_info(234623462376); +sys.ps_thread_trx_info(234623462376) +NULL +SELECT JSON_VALID(sys.ps_thread_trx_info(sys.ps_thread_id(NULL))); +JSON_VALID(sys.ps_thread_trx_info(sys.ps_thread_id(NULL))) +1 +CREATE DATABASE trx; +CREATE TABLE trx.info (id INT PRIMARY KEY, info VARCHAR(20)); +connect con1,localhost,root,,; +connection con1; +USE trx; +START TRANSACTION; +INSERT INTO info VALUES (1, 'foo'); +COMMIT; +START TRANSACTION; +INSERT INTO info VALUES (2, 'bar'); +COMMIT; +connection default; +SET @json_doc := sys.ps_thread_trx_info(@ps_thread_id); +SELECT JSON_VALID(@json_doc); +JSON_VALID(@json_doc) +1 +SELECT JSON_LENGTH(@json_doc); +JSON_LENGTH(@json_doc) +2 +SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0]')); +JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0]')) +["time", "state", "mode", "autocommitted", "gtid", "isolation", "statements_executed"] +SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].time'); +JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].time') +1 +SELECT JSON_CONTAINS(@json_doc, '"COMMITTED"', '$[0].state'); +JSON_CONTAINS(@json_doc, '"COMMITTED"', '$[0].state') +1 +SELECT JSON_CONTAINS(@json_doc, '"READ WRITE"', '$[0].mode'); +JSON_CONTAINS(@json_doc, '"READ WRITE"', '$[0].mode') +1 +SELECT JSON_CONTAINS(@json_doc, '"NO"', '$[0].autocommitted'); +JSON_CONTAINS(@json_doc, '"NO"', '$[0].autocommitted') +1 +SELECT JSON_CONTAINS(@json_doc, '"AUTOMATIC"', '$[0].gtid'); +JSON_CONTAINS(@json_doc, '"AUTOMATIC"', '$[0].gtid') +0 +SELECT JSON_CONTAINS(@json_doc, '"REPEATABLE READ"', '$[0].isolation'); +JSON_CONTAINS(@json_doc, '"REPEATABLE READ"', '$[0].isolation') +1 +SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0].statements_executed[0]')); +JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0].statements_executed[0]')) +["sql_text", "time", "schema", "rows_examined", "rows_affected", "rows_sent", "tmp_tables", "tmp_disk_tables", "sort_rows", "sort_merge_passes"] +SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].statements_executed[0].time'); +JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].statements_executed[0].time') +1 +SELECT JSON_CONTAINS(@json_doc, '"INSERT INTO info VALUES (1, \'foo\')"', '$[0].statements_executed[0].sql_text'); +JSON_CONTAINS(@json_doc, '"INSERT INTO info VALUES (1, \'foo\')"', '$[0].statements_executed[0].sql_text') +1 +SELECT JSON_CONTAINS(@json_doc, '"trx"', '$[0].statements_executed[0].schema'); +JSON_CONTAINS(@json_doc, '"trx"', '$[0].statements_executed[0].schema') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_examined'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_examined') +1 +SELECT JSON_CONTAINS(@json_doc, '1', '$[0].statements_executed[0].rows_affected'); +JSON_CONTAINS(@json_doc, '1', '$[0].statements_executed[0].rows_affected') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_sent'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_sent') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_tables'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_tables') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_disk_tables'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_disk_tables') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_rows'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_rows') +1 +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_merge_passes'); +JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_merge_passes') +1 +SELECT JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_text'); +JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_text') +1 +SET @sys.ps_thread_trx_info.max_length = 100; +SELECT sys.ps_thread_trx_info(@ps_thread_id); +sys.ps_thread_trx_info(@ps_thread_id) +{ "error": "Trx info truncated: Row 1X was cut by GROUP_CONCAT()" } +SET @sys.ps_thread_trx_info.max_length = NULL; +SELECT JSON_VALID(sys.ps_thread_trx_info(@ps_thread_id)); +JSON_VALID(sys.ps_thread_trx_info(@ps_thread_id)) +1 +disconnect con1; +DROP DATABASE trx; diff --git a/mysql-test/suite/sysschema/r/fn_quote_identifier.result b/mysql-test/suite/sysschema/r/fn_quote_identifier.result new file mode 100644 index 00000000..5d0a4964 --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_quote_identifier.result @@ -0,0 +1,21 @@ +SELECT sys.quote_identifier(NULL); +sys.quote_identifier(NULL) +NULL +SELECT sys.quote_identifier('abc'); +sys.quote_identifier('abc') +`abc` +SELECT sys.quote_identifier('ab`c'); +sys.quote_identifier('ab`c') +`ab``c` +SELECT sys.quote_identifier('ab``c'); +sys.quote_identifier('ab``c') +`ab````c` +SELECT sys.quote_identifier('ab```c'); +sys.quote_identifier('ab```c') +`ab``````c` +SELECT sys.quote_identifier('a`b`c'); +sys.quote_identifier('a`b`c') +`a``b``c` +SELECT sys.quote_identifier('a`b``c'); +sys.quote_identifier('a`b``c') +`a``b````c` diff --git a/mysql-test/suite/sysschema/r/fn_sys_get_config.result b/mysql-test/suite/sysschema/r/fn_sys_get_config.result new file mode 100644 index 00000000..26345cfd --- /dev/null +++ b/mysql-test/suite/sysschema/r/fn_sys_get_config.result @@ -0,0 +1,8 @@ +SET @sys.statement_truncate_len := IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 128)); +SELECT @sys.statement_truncate_len; +@sys.statement_truncate_len +64 +SET @sys.foo := IFNULL(@sys.foo, sys.sys_get_config('foo', 'foobar')); +SELECT @sys.foo; +@sys.foo +foobar diff --git a/mysql-test/suite/sysschema/r/mysqldump.result b/mysql-test/suite/sysschema/r/mysqldump.result new file mode 100644 index 00000000..43a4fcbf --- /dev/null +++ b/mysql-test/suite/sysschema/r/mysqldump.result @@ -0,0 +1,25 @@ +CREATE TEMPORARY TABLE tmp_global_priv AS SELECT * FROM mysql.global_priv; +CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv; +DROP DATABASE sys; +SHOW DATABASES; +Database +information_schema +mtr +mysql +performance_schema +test +SHOW DATABASES; +Database +information_schema +mtr +mysql +performance_schema +sys +test +TRUNCATE TABLE mysql.global_priv; +INSERT INTO mysql.global_priv (SELECT * FROM tmp_global_priv); +DROP TEMPORARY TABLE tmp_global_priv; +TRUNCATE TABLE mysql.tables_priv; +INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv); +DROP TEMPORARY TABLE tmp_tables_priv; +FLUSH PRIVILEGES; diff --git a/mysql-test/suite/sysschema/r/pr_create_synonym_db.result b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result new file mode 100644 index 00000000..8c0e8dfa --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result @@ -0,0 +1,66 @@ +CREATE TABLE t1 (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TABLE t2 (t2_id int PRIMARY KEY, t1_id int, t2_val int, INDEX (t1_id)); +CREATE TABLE `is` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE SQL SECURITY INVOKER VIEW myview AS SELECT * FROM t1 NATURAL JOIN t2; +CALL sys.create_synonym_db('test', 'test1'); +summary +Created 5 views in the `test1` database +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'test1' ORDER BY TABLE_NAME; +TABLE_NAME SECURITY_TYPE +ab`c INVOKER +is INVOKER +myview INVOKER +t1 INVOKER +t2 INVOKER +CALL sys.create_synonym_db('test', 'test1'); +ERROR HY000: Can't create database test1; database exists +CREATE SCHEMA test2; +CALL sys.create_synonym_db('test', 'test2'); +ERROR HY000: Can't create database test2; database exists +SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test2'; +COUNT(*) +0 +CALL sys.create_synonym_db('test', 'is'); +summary +Created 5 views in the `is` database +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'is' ORDER BY TABLE_NAME; +TABLE_NAME SECURITY_TYPE +ab`c INVOKER +is INVOKER +myview INVOKER +t1 INVOKER +t2 INVOKER +CALL sys.create_synonym_db('is', 'i`s'); +summary +Created 5 views in the `i``s` database +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'i`s' ORDER BY TABLE_NAME; +TABLE_NAME SECURITY_TYPE +ab`c INVOKER +is INVOKER +myview INVOKER +t1 INVOKER +t2 INVOKER +DROP SCHEMA test1; +DROP SCHEMA test2; +DROP SCHEMA `is`; +DROP SCHEMA `i``s`; +DROP VIEW test.myview; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE `is`; +DROP TABLE `ab``c`; +# +# MDEV-28342: sys.create_synonym_db fails +# when a temporary table masks a base table +# +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +call sys.create_synonym_db('db','db_copy'); +ERROR HY000: Table`db`.`b`shadows base table. View cannot be created! Terminating! +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/sysschema/r/pr_diagnostics.result b/mysql-test/suite/sysschema/r/pr_diagnostics.result new file mode 100644 index 00000000..d07295bd --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_diagnostics.result @@ -0,0 +1,15 @@ +SET @sys.debug = 'ON', +@sys.diagnostics.allow_i_s_tables = 'ON', +@sys.diagnostics.include_raw = 'ON'; +CALL sys.diagnostics(4, 2, 'full'); +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 +CALL sys.diagnostics(1, 2, 'full'); +ERROR 45000: in_max_runtime must be greater than or equal to in_interval diff --git a/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result b/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result new file mode 100644 index 00000000..5cedd970 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_execute_prepared_stmt.result @@ -0,0 +1,21 @@ +SET @sql := "CREATE TABLE test.t1 (i INT) Engine=MEMORY"; +CALL sys.execute_prepared_stmt(@sql); +SHOW CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET @sql := CONCAT('INSERT INTO test.t1 VALUES (', 1, ')'); +CALL sys.execute_prepared_stmt(@sql); +SELECT * FROM test.t1; +i +1 +SET @sql := "DROP TABLE test.t1"; +CALL sys.execute_prepared_stmt(@sql); +SHOW TABLES; +Tables_in_test +SET @sql = NULL; +CALL sys.execute_prepared_stmt(NULL); +ERROR 45000: The @sys.execute_prepared_stmt.sql must contain a query +CALL sys.execute_prepared_stmt('foo'); +ERROR 45000: The @sys.execute_prepared_stmt.sql must contain a query diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_reset_to_default.result b/mysql-test/suite/sysschema/r/pr_ps_setup_reset_to_default.result new file mode 100644 index 00000000..78258de1 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_reset_to_default.result @@ -0,0 +1,60 @@ +CALL sys.ps_setup_reset_to_default(TRUE); +status +Resetting: setup_actors +DELETE +FROM performance_schema.setup_actors + WHERE NOT (HOST = '%' AND USER = '%' AND ROLE = '%') +status +Resetting: setup_actors +INSERT IGNORE INTO performance_schema.setup_actors +VALUES ('%', '%', '%', 'YES', 'YES') +status +Resetting: setup_instruments +UPDATE performance_schema.setup_instruments + SET ENABLED = sys.ps_is_instrument_default_enabled(NAME), + TIMED = sys.ps_is_instrument_default_timed(NAME) +status +Resetting: setup_consumers +UPDATE performance_schema.setup_consumers + SET ENABLED = IF(NAME IN ('events_statements_current', 'events_transactions_current', 'global_instrumentation', 'thread_instrumentation', 'statements_digest'), 'YES', 'NO') +status +Resetting: setup_objects +DELETE +FROM performance_schema.setup_objects + WHERE NOT (OBJECT_TYPE IN ('EVENT', 'FUNCTION', 'PROCEDURE', 'TABLE', 'TRIGGER') AND OBJECT_NAME = '%' + AND (OBJECT_SCHEMA = 'mysql'AND ENABLED = 'NO'AND TIMED = 'NO' ) +OR (OBJECT_SCHEMA = 'performance_schema' AND ENABLED = 'NO'AND TIMED = 'NO' ) +OR (OBJECT_SCHEMA = 'information_schema' AND ENABLED = 'NO'AND TIMED = 'NO' ) +OR (OBJECT_SCHEMA = '%'AND ENABLED = 'YES' AND TIMED = 'YES')) +status +Resetting: setup_objects +INSERT IGNORE INTO performance_schema.setup_objects +VALUES ('EVENT', 'mysql' , '%', 'NO' , 'NO' ), + ('EVENT', 'performance_schema', '%', 'NO' , 'NO' ), + ('EVENT', 'information_schema', '%', 'NO' , 'NO' ), + ('EVENT', '%' , '%', 'YES', 'YES'), + ('FUNCTION' , 'mysql' , '%', 'NO' , 'NO' ), + ('FUNCTION' , 'performance_schema', '%', 'NO' , 'NO' ), + ('FUNCTION' , 'information_schema', '%', 'NO' , 'NO' ), + ('FUNCTION' , '%' , '%', 'YES', 'YES'), + ('PROCEDURE', 'mysql' , '%', 'NO' , 'NO' ), + ('PROCEDURE', 'performance_schema', '%', 'NO' , 'NO' ), + ('PROCEDURE', 'information_schema', '%', 'NO' , 'NO' ), + ('PROCEDURE', '%' , '%', 'YES', 'YES'), + ('TABLE', 'mysql' , '%', 'NO' , 'NO' ), + ('TABLE', 'performance_schema', '%', 'NO' , 'NO' ), + ('TABLE', 'information_schema', '%', 'NO' , 'NO' ), + ('TABLE', '%' , '%', 'YES', 'YES'), + ('TRIGGER', 'mysql' , '%', 'NO' , 'NO' ), + ('TRIGGER', 'performance_schema', '%', 'NO' , 'NO' ), + ('TRIGGER', 'information_schema', '%', 'NO' , 'NO' ), + ('TRIGGER', '%' , '%', 'YES', 'YES') +status +Resetting: threads +UPDATE performance_schema.threads + SET INSTRUMENTED = 'YES' +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled.result new file mode 100644 index 00000000..cf8ca76e --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled.result @@ -0,0 +1,205 @@ +INSERT INTO performance_schema.setup_actors +VALUES ('localhost', 'foo', '%', 'YES', 'YES'), +('localhost', 'bar', '%', 'NO', 'NO'); +UPDATE performance_schema.setup_instruments +SET ENABLED = 'NO' + WHERE NAME LIKE 'stage/innodb/%' + OR NAME LIKE 'statement/com/%' + OR NAME = 'idle'; +UPDATE performance_schema.setup_consumers +SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; +UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%'; +CALL sys.ps_setup_show_disabled(FALSE, FALSE); +performance_schema_enabled +1 +object_type objects enabled timed +EVENT information_schema.% NO NO +EVENT mysql.% NO NO +EVENT performance_schema.% NO NO +FUNCTION information_schema.% NO NO +FUNCTION mysql.% NO NO +FUNCTION performance_schema.% NO NO +PROCEDURE information_schema.% NO NO +PROCEDURE mysql.% NO NO +PROCEDURE performance_schema.% NO NO +TABLE information_schema.% NO NO +TABLE mysql.% NO NO +TABLE performance_schema.% NO NO +TRIGGER information_schema.% NO NO +TRIGGER mysql.% NO NO +TRIGGER performance_schema.% NO NO +disabled_consumers +events_stages_history_long +events_statements_history_long +events_transactions_history_long +events_waits_history_long +CALL sys.ps_setup_show_disabled(TRUE, FALSE); +performance_schema_enabled +1 +object_type objects enabled timed +EVENT information_schema.% NO NO +EVENT mysql.% NO NO +EVENT performance_schema.% NO NO +FUNCTION information_schema.% NO NO +FUNCTION mysql.% NO NO +FUNCTION performance_schema.% NO NO +PROCEDURE information_schema.% NO NO +PROCEDURE mysql.% NO NO +PROCEDURE performance_schema.% NO NO +TABLE information_schema.% NO NO +TABLE mysql.% NO NO +TABLE performance_schema.% NO NO +TRIGGER information_schema.% NO NO +TRIGGER mysql.% NO NO +TRIGGER performance_schema.% NO NO +disabled_consumers +events_stages_history_long +events_statements_history_long +events_transactions_history_long +events_waits_history_long +disabled_instruments timed +idle YES +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +CALL sys.ps_setup_show_disabled(FALSE, TRUE); +performance_schema_enabled +1 +object_type objects enabled timed +EVENT information_schema.% NO NO +EVENT mysql.% NO NO +EVENT performance_schema.% NO NO +FUNCTION information_schema.% NO NO +FUNCTION mysql.% NO NO +FUNCTION performance_schema.% NO NO +PROCEDURE information_schema.% NO NO +PROCEDURE mysql.% NO NO +PROCEDURE performance_schema.% NO NO +TABLE information_schema.% NO NO +TABLE mysql.% NO NO +TABLE performance_schema.% NO NO +TRIGGER information_schema.% NO NO +TRIGGER mysql.% NO NO +TRIGGER performance_schema.% NO NO +disabled_consumers +events_stages_history_long +events_statements_history_long +events_transactions_history_long +events_waits_history_long +disabled_threads thread_type +CALL sys.ps_setup_show_disabled(TRUE, TRUE); +performance_schema_enabled +1 +object_type objects enabled timed +EVENT information_schema.% NO NO +EVENT mysql.% NO NO +EVENT performance_schema.% NO NO +FUNCTION information_schema.% NO NO +FUNCTION mysql.% NO NO +FUNCTION performance_schema.% NO NO +PROCEDURE information_schema.% NO NO +PROCEDURE mysql.% NO NO +PROCEDURE performance_schema.% NO NO +TABLE information_schema.% NO NO +TABLE mysql.% NO NO +TABLE performance_schema.% NO NO +TRIGGER information_schema.% NO NO +TRIGGER mysql.% NO NO +TRIGGER performance_schema.% NO NO +disabled_consumers +events_stages_history_long +events_statements_history_long +events_transactions_history_long +events_waits_history_long +disabled_threads thread_type +disabled_instruments timed +idle YES +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_consumers.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_consumers.result new file mode 100644 index 00000000..c9aae2d2 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_consumers.result @@ -0,0 +1,14 @@ +UPDATE performance_schema.setup_consumers +SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; +CALL sys.ps_setup_show_disabled_consumers(); +disabled_consumers +events_stages_history_long +events_statements_history_long +events_transactions_history_long +events_waits_history_long +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_instruments.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_instruments.result new file mode 100644 index 00000000..b0aa5f6d --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_disabled_instruments.result @@ -0,0 +1,56 @@ +UPDATE performance_schema.setup_instruments +SET ENABLED = 'NO' + WHERE NAME LIKE 'stage/innodb/%' + OR NAME LIKE 'statement/com/%' + OR NAME = 'idle'; +CALL sys.ps_setup_show_disabled_instruments(); +disabled_instruments timed +idle YES +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result new file mode 100644 index 00000000..261ccb19 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result @@ -0,0 +1,362 @@ +INSERT INTO performance_schema.setup_actors +VALUES ('localhost', 'foo', '%', 'YES', 'YES'), +('localhost', 'bar', '%', 'NO', 'NO'); +UPDATE performance_schema.setup_instruments +SET ENABLED = 'NO' + WHERE NAME NOT LIKE 'memory/performance_schema/%' + AND NAME NOT LIKE 'stage/innodb/%' + AND NAME NOT LIKE 'statement/com/%' + AND NAME <> 'idle'; +UPDATE performance_schema.setup_consumers +SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; +UPDATE performance_schema.threads +SET INSTRUMENTED = 'NO' + WHERE NAME LIKE 'thread/innodb/srv\_%' + OR NAME LIKE '%con\_%' + OR NAME LIKE '%signal_handler%'; +CALL sys.ps_setup_show_enabled(FALSE, FALSE); +performance_schema_enabled +1 +enabled_users +'%'@'%' +'foo'@'localhost' +object_type objects enabled timed +EVENT %.% YES YES +FUNCTION %.% YES YES +PROCEDURE %.% YES YES +TABLE %.% YES YES +TRIGGER %.% YES YES +enabled_consumers +events_stages_current +events_stages_history +events_statements_current +events_statements_history +events_transactions_current +events_transactions_history +events_waits_current +events_waits_history +global_instrumentation +statements_digest +thread_instrumentation +CALL sys.ps_setup_show_enabled(TRUE, FALSE); +performance_schema_enabled +1 +enabled_users +'%'@'%' +'foo'@'localhost' +object_type objects enabled timed +EVENT %.% YES YES +FUNCTION %.% YES YES +PROCEDURE %.% YES YES +TABLE %.% YES YES +TRIGGER %.% YES YES +enabled_consumers +events_stages_current +events_stages_history +events_statements_current +events_statements_history +events_transactions_current +events_transactions_history +events_waits_current +events_waits_history +global_instrumentation +statements_digest +thread_instrumentation +enabled_instruments timed +idle YES +memory/performance_schema/accounts NO +memory/performance_schema/cond_class NO +memory/performance_schema/cond_instances NO +memory/performance_schema/events_stages_history NO +memory/performance_schema/events_stages_history_long NO +memory/performance_schema/events_stages_summary_by_account_by_event_name NO +memory/performance_schema/events_stages_summary_by_host_by_event_name NO +memory/performance_schema/events_stages_summary_by_thread_by_event_name NO +memory/performance_schema/events_stages_summary_by_user_by_event_name NO +memory/performance_schema/events_stages_summary_global_by_event_name NO +memory/performance_schema/events_statements_current NO +memory/performance_schema/events_statements_current.sqltext NO +memory/performance_schema/events_statements_current.tokens NO +memory/performance_schema/events_statements_history NO +memory/performance_schema/events_statements_history.sqltext NO +memory/performance_schema/events_statements_history.tokens NO +memory/performance_schema/events_statements_history_long NO +memory/performance_schema/events_statements_history_long.sqltext NO +memory/performance_schema/events_statements_history_long.tokens NO +memory/performance_schema/events_statements_summary_by_account_by_event_name NO +memory/performance_schema/events_statements_summary_by_digest NO +memory/performance_schema/events_statements_summary_by_digest.tokens NO +memory/performance_schema/events_statements_summary_by_host_by_event_name NO +memory/performance_schema/events_statements_summary_by_program NO +memory/performance_schema/events_statements_summary_by_thread_by_event_name NO +memory/performance_schema/events_statements_summary_by_user_by_event_name NO +memory/performance_schema/events_statements_summary_global_by_event_name NO +memory/performance_schema/events_transactions_history NO +memory/performance_schema/events_transactions_history_long NO +memory/performance_schema/events_transactions_summary_by_account_by_event_name NO +memory/performance_schema/events_transactions_summary_by_host_by_event_name NO +memory/performance_schema/events_transactions_summary_by_thread_by_event_name NO +memory/performance_schema/events_transactions_summary_by_user_by_event_name NO +memory/performance_schema/events_waits_history NO +memory/performance_schema/events_waits_history_long NO +memory/performance_schema/events_waits_summary_by_account_by_event_name NO +memory/performance_schema/events_waits_summary_by_host_by_event_name NO +memory/performance_schema/events_waits_summary_by_thread_by_event_name NO +memory/performance_schema/events_waits_summary_by_user_by_event_name NO +memory/performance_schema/file_class NO +memory/performance_schema/file_handle NO +memory/performance_schema/file_instances NO +memory/performance_schema/hosts NO +memory/performance_schema/memory_class NO +memory/performance_schema/memory_summary_by_account_by_event_name NO +memory/performance_schema/memory_summary_by_host_by_event_name NO +memory/performance_schema/memory_summary_by_thread_by_event_name NO +memory/performance_schema/memory_summary_by_user_by_event_name NO +memory/performance_schema/memory_summary_global_by_event_name NO +memory/performance_schema/metadata_locks NO +memory/performance_schema/mutex_class NO +memory/performance_schema/mutex_instances NO +memory/performance_schema/prepared_statements_instances NO +memory/performance_schema/rwlock_class NO +memory/performance_schema/rwlock_instances NO +memory/performance_schema/scalable_buffer NO +memory/performance_schema/session_connect_attrs NO +memory/performance_schema/setup_actors NO +memory/performance_schema/setup_objects NO +memory/performance_schema/socket_class NO +memory/performance_schema/socket_instances NO +memory/performance_schema/stage_class NO +memory/performance_schema/statement_class NO +memory/performance_schema/table_handles NO +memory/performance_schema/table_io_waits_summary_by_index_usage NO +memory/performance_schema/table_lock_waits_summary_by_table NO +memory/performance_schema/table_shares NO +memory/performance_schema/threads NO +memory/performance_schema/thread_class NO +memory/performance_schema/users NO +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +CALL sys.ps_setup_show_enabled(FALSE, TRUE); +performance_schema_enabled +1 +enabled_users +'%'@'%' +'foo'@'localhost' +object_type objects enabled timed +EVENT %.% YES YES +FUNCTION %.% YES YES +PROCEDURE %.% YES YES +TABLE %.% YES YES +TRIGGER %.% YES YES +enabled_consumers +events_stages_current +events_stages_history +events_statements_current +events_statements_history +events_transactions_current +events_transactions_history +events_waits_current +events_waits_history +global_instrumentation +statements_digest +thread_instrumentation +enabled_threads thread_type +aria/checkpoint_background BACKGROUND +innodb/page_cleaner_thread BACKGROUND +mysys/statement_timer BACKGROUND +root@localhost FOREGROUND +sql/main BACKGROUND +sql/manager BACKGROUND +CALL sys.ps_setup_show_enabled(TRUE, TRUE); +performance_schema_enabled +1 +enabled_users +'%'@'%' +'foo'@'localhost' +object_type objects enabled timed +EVENT %.% YES YES +FUNCTION %.% YES YES +PROCEDURE %.% YES YES +TABLE %.% YES YES +TRIGGER %.% YES YES +enabled_consumers +events_stages_current +events_stages_history +events_statements_current +events_statements_history +events_transactions_current +events_transactions_history +events_waits_current +events_waits_history +global_instrumentation +statements_digest +thread_instrumentation +enabled_threads thread_type +aria/checkpoint_background BACKGROUND +innodb/page_cleaner_thread BACKGROUND +mysys/statement_timer BACKGROUND +root@localhost FOREGROUND +sql/main BACKGROUND +sql/manager BACKGROUND +enabled_instruments timed +idle YES +memory/performance_schema/accounts NO +memory/performance_schema/cond_class NO +memory/performance_schema/cond_instances NO +memory/performance_schema/events_stages_history NO +memory/performance_schema/events_stages_history_long NO +memory/performance_schema/events_stages_summary_by_account_by_event_name NO +memory/performance_schema/events_stages_summary_by_host_by_event_name NO +memory/performance_schema/events_stages_summary_by_thread_by_event_name NO +memory/performance_schema/events_stages_summary_by_user_by_event_name NO +memory/performance_schema/events_stages_summary_global_by_event_name NO +memory/performance_schema/events_statements_current NO +memory/performance_schema/events_statements_current.sqltext NO +memory/performance_schema/events_statements_current.tokens NO +memory/performance_schema/events_statements_history NO +memory/performance_schema/events_statements_history.sqltext NO +memory/performance_schema/events_statements_history.tokens NO +memory/performance_schema/events_statements_history_long NO +memory/performance_schema/events_statements_history_long.sqltext NO +memory/performance_schema/events_statements_history_long.tokens NO +memory/performance_schema/events_statements_summary_by_account_by_event_name NO +memory/performance_schema/events_statements_summary_by_digest NO +memory/performance_schema/events_statements_summary_by_digest.tokens NO +memory/performance_schema/events_statements_summary_by_host_by_event_name NO +memory/performance_schema/events_statements_summary_by_program NO +memory/performance_schema/events_statements_summary_by_thread_by_event_name NO +memory/performance_schema/events_statements_summary_by_user_by_event_name NO +memory/performance_schema/events_statements_summary_global_by_event_name NO +memory/performance_schema/events_transactions_history NO +memory/performance_schema/events_transactions_history_long NO +memory/performance_schema/events_transactions_summary_by_account_by_event_name NO +memory/performance_schema/events_transactions_summary_by_host_by_event_name NO +memory/performance_schema/events_transactions_summary_by_thread_by_event_name NO +memory/performance_schema/events_transactions_summary_by_user_by_event_name NO +memory/performance_schema/events_waits_history NO +memory/performance_schema/events_waits_history_long NO +memory/performance_schema/events_waits_summary_by_account_by_event_name NO +memory/performance_schema/events_waits_summary_by_host_by_event_name NO +memory/performance_schema/events_waits_summary_by_thread_by_event_name NO +memory/performance_schema/events_waits_summary_by_user_by_event_name NO +memory/performance_schema/file_class NO +memory/performance_schema/file_handle NO +memory/performance_schema/file_instances NO +memory/performance_schema/hosts NO +memory/performance_schema/memory_class NO +memory/performance_schema/memory_summary_by_account_by_event_name NO +memory/performance_schema/memory_summary_by_host_by_event_name NO +memory/performance_schema/memory_summary_by_thread_by_event_name NO +memory/performance_schema/memory_summary_by_user_by_event_name NO +memory/performance_schema/memory_summary_global_by_event_name NO +memory/performance_schema/metadata_locks NO +memory/performance_schema/mutex_class NO +memory/performance_schema/mutex_instances NO +memory/performance_schema/prepared_statements_instances NO +memory/performance_schema/rwlock_class NO +memory/performance_schema/rwlock_instances NO +memory/performance_schema/scalable_buffer NO +memory/performance_schema/session_connect_attrs NO +memory/performance_schema/setup_actors NO +memory/performance_schema/setup_objects NO +memory/performance_schema/socket_class NO +memory/performance_schema/socket_instances NO +memory/performance_schema/stage_class NO +memory/performance_schema/statement_class NO +memory/performance_schema/table_handles NO +memory/performance_schema/table_io_waits_summary_by_index_usage NO +memory/performance_schema/table_lock_waits_summary_by_table NO +memory/performance_schema/table_shares NO +memory/performance_schema/threads NO +memory/performance_schema/thread_class NO +memory/performance_schema/users NO +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_consumers.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_consumers.result new file mode 100644 index 00000000..283a58f6 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_consumers.result @@ -0,0 +1,21 @@ +UPDATE performance_schema.setup_consumers +SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; +CALL sys.ps_setup_show_enabled_consumers(); +enabled_consumers +events_stages_current +events_stages_history +events_statements_current +events_statements_history +events_transactions_current +events_transactions_history +events_waits_current +events_waits_history +global_instrumentation +statements_digest +thread_instrumentation +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_instruments.result b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_instruments.result new file mode 100644 index 00000000..36399f0d --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled_instruments.result @@ -0,0 +1,127 @@ +UPDATE performance_schema.setup_instruments +SET ENABLED = 'NO' + WHERE NAME NOT LIKE 'memory/performance_schema/%' + AND NAME NOT LIKE 'stage/innodb/%' + AND NAME NOT LIKE 'statement/com/%' + AND NAME <> 'idle'; +CALL sys.ps_setup_show_enabled_instruments(); +enabled_instruments timed +idle YES +memory/performance_schema/accounts NO +memory/performance_schema/cond_class NO +memory/performance_schema/cond_instances NO +memory/performance_schema/events_stages_history NO +memory/performance_schema/events_stages_history_long NO +memory/performance_schema/events_stages_summary_by_account_by_event_name NO +memory/performance_schema/events_stages_summary_by_host_by_event_name NO +memory/performance_schema/events_stages_summary_by_thread_by_event_name NO +memory/performance_schema/events_stages_summary_by_user_by_event_name NO +memory/performance_schema/events_stages_summary_global_by_event_name NO +memory/performance_schema/events_statements_current NO +memory/performance_schema/events_statements_current.sqltext NO +memory/performance_schema/events_statements_current.tokens NO +memory/performance_schema/events_statements_history NO +memory/performance_schema/events_statements_history.sqltext NO +memory/performance_schema/events_statements_history.tokens NO +memory/performance_schema/events_statements_history_long NO +memory/performance_schema/events_statements_history_long.sqltext NO +memory/performance_schema/events_statements_history_long.tokens NO +memory/performance_schema/events_statements_summary_by_account_by_event_name NO +memory/performance_schema/events_statements_summary_by_digest NO +memory/performance_schema/events_statements_summary_by_digest.tokens NO +memory/performance_schema/events_statements_summary_by_host_by_event_name NO +memory/performance_schema/events_statements_summary_by_program NO +memory/performance_schema/events_statements_summary_by_thread_by_event_name NO +memory/performance_schema/events_statements_summary_by_user_by_event_name NO +memory/performance_schema/events_statements_summary_global_by_event_name NO +memory/performance_schema/events_transactions_history NO +memory/performance_schema/events_transactions_history_long NO +memory/performance_schema/events_transactions_summary_by_account_by_event_name NO +memory/performance_schema/events_transactions_summary_by_host_by_event_name NO +memory/performance_schema/events_transactions_summary_by_thread_by_event_name NO +memory/performance_schema/events_transactions_summary_by_user_by_event_name NO +memory/performance_schema/events_waits_history NO +memory/performance_schema/events_waits_history_long NO +memory/performance_schema/events_waits_summary_by_account_by_event_name NO +memory/performance_schema/events_waits_summary_by_host_by_event_name NO +memory/performance_schema/events_waits_summary_by_thread_by_event_name NO +memory/performance_schema/events_waits_summary_by_user_by_event_name NO +memory/performance_schema/file_class NO +memory/performance_schema/file_handle NO +memory/performance_schema/file_instances NO +memory/performance_schema/hosts NO +memory/performance_schema/memory_class NO +memory/performance_schema/memory_summary_by_account_by_event_name NO +memory/performance_schema/memory_summary_by_host_by_event_name NO +memory/performance_schema/memory_summary_by_thread_by_event_name NO +memory/performance_schema/memory_summary_by_user_by_event_name NO +memory/performance_schema/memory_summary_global_by_event_name NO +memory/performance_schema/metadata_locks NO +memory/performance_schema/mutex_class NO +memory/performance_schema/mutex_instances NO +memory/performance_schema/prepared_statements_instances NO +memory/performance_schema/rwlock_class NO +memory/performance_schema/rwlock_instances NO +memory/performance_schema/scalable_buffer NO +memory/performance_schema/session_connect_attrs NO +memory/performance_schema/setup_actors NO +memory/performance_schema/setup_objects NO +memory/performance_schema/socket_class NO +memory/performance_schema/socket_instances NO +memory/performance_schema/stage_class NO +memory/performance_schema/statement_class NO +memory/performance_schema/table_handles NO +memory/performance_schema/table_io_waits_summary_by_index_usage NO +memory/performance_schema/table_lock_waits_summary_by_table NO +memory/performance_schema/table_shares NO +memory/performance_schema/threads NO +memory/performance_schema/thread_class NO +memory/performance_schema/users NO +stage/innodb/alter table (end) YES +stage/innodb/alter table (insert) YES +stage/innodb/alter table (log apply index) YES +stage/innodb/alter table (log apply table) YES +stage/innodb/alter table (merge sort) YES +stage/innodb/alter table (read PK and internal sort) YES +stage/innodb/buffer pool load YES +statement/com/Binlog Dump YES +statement/com/Bulk_execute YES +statement/com/Change user YES +statement/com/Close stmt YES +statement/com/Connect YES +statement/com/Connect Out YES +statement/com/Create DB YES +statement/com/Daemon YES +statement/com/Debug YES +statement/com/Delayed insert YES +statement/com/Drop DB YES +statement/com/Error YES +statement/com/Execute YES +statement/com/Fetch YES +statement/com/Field List YES +statement/com/Init DB YES +statement/com/Kill YES +statement/com/Long Data YES +statement/com/Ping YES +statement/com/Prepare YES +statement/com/Processlist YES +statement/com/Quit YES +statement/com/Refresh YES +statement/com/Register Slave YES +statement/com/Reset connection YES +statement/com/Reset stmt YES +statement/com/Set option YES +statement/com/Shutdown YES +statement/com/Slave_IO YES +statement/com/Slave_SQL YES +statement/com/Slave_worker YES +statement/com/Sleep YES +statement/com/Statistics YES +statement/com/Table Dump YES +statement/com/Time YES +statement/com/Unimpl get tid YES +UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +TRUNCATE TABLE performance_schema.setup_actors; +INSERT INTO performance_schema.setup_actors VALUES ('%', '%', '%', 'YES', 'YES'); +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; diff --git a/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result b/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result new file mode 100644 index 00000000..99854665 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_ps_trace_statement_digest.result @@ -0,0 +1,30 @@ +use test; +SET @threadid = sys.ps_thread_id(NULL); +CREATE TABLE t1 (id INT PRIMARY KEY, val int) ENGINE=MEMORY; +INSERT INTO test.t1 VALUES (1, 9); +SET @digest.insert = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'INSERT INTO test.t1 VALUES (1, 9)'); +SELECT * FROM t1; +id val +1 9 +SET @digest.select = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SELECT * FROM t1'); +SHOW CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `val` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SET @digest.show = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SHOW CREATE TABLE test.t1'); +CREATE SCHEMA test_sys; +use test_sys; +CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, FALSE, FALSE); +CALL sys.ps_trace_statement_digest(@digest.select, 0.5, 0.1, FALSE, FALSE); +CALL sys.ps_trace_statement_digest(@digest.show , 0.5, 0.1, FALSE, FALSE); +CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, TRUE , FALSE); +use test; +DROP SCHEMA test_sys; +DROP TABLE t1; +SET @threadid = NULL, +@digest.insert = NULL, +@digest.select = NULL, +@digest.show = NULL; diff --git a/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result b/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result new file mode 100644 index 00000000..c7bb029d --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_statement_performance_analyzer.result @@ -0,0 +1,211 @@ +use test; +DROP TABLE IF EXISTS t1; +DROP TEMPORARY TABLE IF EXISTS tmp_digests_ini; +DROP VIEW IF EXISTS view_digests; +CREATE TABLE t1 (id INT PRIMARY KEY, val int); +connect con1,localhost,root,,; +connection con1; +use test; +connection default; +UPDATE performance_schema.threads SET INSTRUMENTED = IF(THREAD_ID = CON1_THREAD_ID, 'YES', 'NO'); +CALL sys.ps_setup_enable_consumer('events_statements_history_long'); +CALL sys.ps_truncate_all_tables(FALSE); +connection con1; +INSERT INTO t1 VALUES (1, 0); +connection default; +connection con1; +UPDATE t1 SET val = 1 WHERE id = 1; +connection default; +connection con1; +SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id; +id val +1 1 +connection default; +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL); +CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +CALL sys.statement_performance_analyzer('save', 'test.tmp_digests_ini', NULL); +DO SLEEP(1.2); +connection con1; +INSERT INTO t1 VALUES (2, 0); +UPDATE t1 SET val = 1 WHERE id = 2; +SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id; +id val +1 1 +2 1 +disconnect con1; +connection default; +CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +SELECT DIGEST, COUNT_STAR FROM performance_schema.events_statements_summary_by_digest; +DIGEST COUNT_STAR +DIGEST_INSERT 2 +DIGEST_SELECT 2 +DIGEST_UPDATE 2 +CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +CALL sys.statement_performance_analyzer('overall', NULL, 'analysis'); +Next Output +QUERY_INSERT test 2 0 0 LATENCY LATENCY LATENCY LATENCY 0 0 0 0 2 1 0 0 0 0 DIGEST_INSERT FIRST_SEEN LAST_SEEN +QUERY_SELECT test * 2 0 0 LATENCY LATENCY LATENCY LATENCY 3 2 9 5 0 0 0 0 2 0 DIGEST_SELECT FIRST_SEEN LAST_SEEN +QUERY_UPDATE test 2 0 0 LATENCY LATENCY LATENCY LATENCY 0 0 2 1 2 1 0 0 0 0 DIGEST_UPDATE FIRST_SEEN LAST_SEEN +Top 100 Queries Ordered by Total Latency +query db full_scan exec_count err_count warn_count total_latency max_latency avg_latency lock_latency rows_sent rows_sent_avg rows_examined rows_examined_avg rows_affected rows_affected_avg tmp_tables tmp_disk_tables rows_sorted sort_merge_passes digest first_seen last_seen +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis'); +Next Output +QUERY_INSERT test 1 0 0 LATENCY LATENCY LATENCY LATENCY 0 0 0 0 1 1 0 0 0 0 DIGEST_INSERT FIRST_SEEN LAST_SEEN +QUERY_SELECT test * 1 0 0 LATENCY LATENCY LATENCY LATENCY 2 2 9 9 0 0 0 0 2 0 DIGEST_SELECT FIRST_SEEN LAST_SEEN +QUERY_UPDATE test 1 0 0 LATENCY LATENCY LATENCY LATENCY 0 0 1 1 1 1 0 0 0 0 DIGEST_UPDATE FIRST_SEEN LAST_SEEN +Top 100 Queries Ordered by Total Latency +query db full_scan exec_count err_count warn_count total_latency max_latency avg_latency lock_latency rows_sent rows_sent_avg rows_examined rows_examined_avg rows_affected rows_affected_avg tmp_tables tmp_disk_tables rows_sorted sort_merge_passes digest first_seen last_seen +CALL sys.statement_performance_analyzer('overall', NULL, 'with_errors_or_warnings'); +Next Output +Top 100 Queries with Errors +query db exec_count errors error_pct warnings warning_pct first_seen last_seen digest +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_errors_or_warnings'); +Next Output +Top 100 Queries with Errors +query db exec_count errors error_pct warnings warning_pct first_seen last_seen digest +CALL sys.statement_performance_analyzer('overall', NULL, 'with_full_table_scans'); +Next Output +Top 100 Queries with Full Table Scan +query db exec_count total_latency no_index_used_count no_good_index_used_count no_index_used_pct rows_sent rows_examined rows_sent_avg rows_examined_avg first_seen last_seen digest +QUERY_SELECT test 2 LATENCY 1 0 50 3 9 2 5 FIRST_SEEN LAST_SEEN DIGEST_SELECT +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_full_table_scans'); +Next Output +Top 100 Queries with Full Table Scan +query db exec_count total_latency no_index_used_count no_good_index_used_count no_index_used_pct rows_sent rows_examined rows_sent_avg rows_examined_avg first_seen last_seen digest +QUERY_SELECT test 1 LATENCY 1 0 100 2 9 2 9 FIRST_SEEN LAST_SEEN DIGEST_SELECT +CALL sys.statement_performance_analyzer('overall', NULL, 'with_sorting'); +Next Output +Top 100 Queries with Sorting +query db exec_count total_latency sort_merge_passes avg_sort_merges sorts_using_scans sort_using_range rows_sorted avg_rows_sorted first_seen last_seen digest +QUERY_SELECT test 2 LATENCY 0 0 1 0 2 1 FIRST_SEEN LAST_SEEN DIGEST_SELECT +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_sorting'); +Next Output +Top 100 Queries with Sorting +query db exec_count total_latency sort_merge_passes avg_sort_merges sorts_using_scans sort_using_range rows_sorted avg_rows_sorted first_seen last_seen digest +QUERY_SELECT test 1 LATENCY 0 0 1 0 2 2 FIRST_SEEN LAST_SEEN DIGEST_SELECT +CALL sys.statement_performance_analyzer('overall', NULL, 'with_temp_tables'); +Next Output +Top 100 Queries with Internal Temporary Tables +query db exec_count total_latency memory_tmp_tables disk_tmp_tables avg_tmp_tables_per_query tmp_tables_to_disk_pct first_seen last_seen digest +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_temp_tables'); +Next Output +Top 100 Queries with Internal Temporary Tables +query db exec_count total_latency memory_tmp_tables disk_tmp_tables avg_tmp_tables_per_query tmp_tables_to_disk_pct first_seen last_seen digest +CREATE VIEW test.view_digests AS +SELECT sys.format_statement(DIGEST_TEXT) AS query, +SCHEMA_NAME AS db, +COUNT_STAR AS exec_count, +sys.format_time(SUM_TIMER_WAIT) AS total_latency, +sys.format_time(AVG_TIMER_WAIT) AS avg_latency, +ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, +ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg, +ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg, +DIGEST AS digest +FROM performance_schema.events_statements_summary_by_digest +ORDER BY SUBSTRING(query, 1, 6); +SET @sys.statement_performance_analyzer.view = 'test.view_digests'; +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +Next Output +Top 100 Queries Using Custom View +query db exec_count total_latency avg_latency rows_sent_avg rows_examined_avg rows_affected_avg digest +QUERY_INSERT test 2 LATENCY LATENCY 0 0 1 DIGEST_INSERT +QUERY_SELECT test 2 LATENCY LATENCY 2 5 0 DIGEST_SELECT +QUERY_UPDATE test 2 LATENCY LATENCY 0 1 1 DIGEST_UPDATE +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'custom'); +Next Output +Top 100 Queries Using Custom View +query db exec_count total_latency avg_latency rows_sent_avg rows_examined_avg rows_affected_avg digest +QUERY_INSERT test 1 LATENCY LATENCY 0 0 1 DIGEST_INSERT +QUERY_SELECT test 1 LATENCY LATENCY 2 9 0 DIGEST_SELECT +QUERY_UPDATE test 1 LATENCY LATENCY 0 1 1 DIGEST_UPDATE +SET @sys.statement_performance_analyzer.limit = 2; +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +Next Output +Top 2 Queries Using Custom View +query db exec_count total_latency avg_latency rows_sent_avg rows_examined_avg rows_affected_avg digest +QUERY_INSERT test 2 LATENCY LATENCY 0 0 1 DIGEST_INSERT +QUERY_SELECT test 2 LATENCY LATENCY 2 5 0 DIGEST_SELECT +SET SESSION sql_mode = 'NO_AUTO_CREATE_USER'; +CALL sys.statement_performance_analyzer('do magic', NULL, NULL); +ERROR 45000: Unknown action. Supported actions are: cleanup, create_table, create_tmp, delta, overall, save, snapshot +SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; +CALL sys.statement_performance_analyzer('do magic', NULL, NULL); +ERROR 01000: Data truncated for column 'in_action' at row 0 +CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests', NULL); +ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests` is reserved table name. +CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests_delta', NULL); +ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests_delta` is reserved table name. +CALL sys.statement_performance_analyzer('create_tmp', 'tmp_digests', NULL); +ERROR 45000: Invalid value for in_table: `sys`.`tmp_digests` is reserved table name. +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests', NULL); +CREATE TABLE test.tmp_unsupported LIKE test.tmp_digests_ini; +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL); +ERROR 45000: Cannot create the table `test`.`tmp_digests_ini` as it already exists. +CALL sys.statement_performance_analyzer('create_table', 'test.tmp_digests_ini', NULL); +ERROR 45000: Cannot create the table `test`.`tmp_digests_ini` as it already exists as a temporary table. +CALL sys.statement_performance_analyzer('create_table', 'test.tmp_unsupported', NULL); +ERROR 45000: Cannot create the table `test`.`tmp_unsupported` as it already exists. +ALTER TABLE test.tmp_unsupported ADD COLUMN myvar int DEFAULT 0; +CALL sys.statement_performance_analyzer('save', 'test.tmp_unsupported', NULL); +ERROR 45000: The table `test`.`tmp_unsupported` has the wrong definition. +CALL sys.statement_performance_analyzer('snapshot', 'test.new_table', NULL); +ERROR 45000: The snapshot action requires in_table to be NULL, NOW() or specify an existing table. The table ...`.`new_table` does not exist. +CALL sys.statement_performance_analyzer('overall', 'test.new_table', 'analysis'); +ERROR 45000: The overall action requires in_table to be NULL, NOW() or specify an existing table. The table ...`.`new_table` does not exist. +CALL sys.statement_performance_analyzer('delta', 'test.new_table', 'analysis'); +ERROR 45000: The delta action requires in_table to be an existing table. The table `test`.`new_table` does not exist. +CALL sys.statement_performance_analyzer('save', 'test.new_table', NULL); +ERROR 45000: The save action requires in_table to be an existing table. The table `test`.`new_table` does not exist. +SET @sys.statement_performance_analyzer.view = NULL; +DELETE FROM sys.sys_config WHERE variable = 'statement_performance_analyzer.view'; +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +Next Output +Top 2 Queries Using Custom View +ERROR 45000: The @sys.statement_performance_analyzer.view user variable must be set with the view or query to use. +SET @sys.statement_performance_analyzer.view = 'test.tmp_unsupported'; +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +Next Output +Top 2 Queries Using Custom View +ERROR 45000: The @sys.statement_performance_analyzer.view user variable is set but specified neither an existing view nor a query. +CALL sys.table_exists('sys', 'tmp_digests', @exists); +SELECT @exists; +@exists +TEMPORARY +CALL sys.table_exists('sys', 'tmp_digests_delta', @exists); +SELECT @exists; +@exists +TEMPORARY +CALL sys.statement_performance_analyzer('cleanup', NULL, NULL); +DROP TEMPORARY TABLE sys.tmp_digests; +ERROR 42S02: Unknown table 'sys.tmp_digests' +DROP TEMPORARY TABLE sys.tmp_digests_delta; +ERROR 42S02: Unknown table 'sys.tmp_digests_delta' +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis'); +ERROR 45000: An existing snapshot generated with the statement_performance_analyzer() must exist. +DROP TEMPORARY TABLE sys.tmp_digests_delta; +ERROR 42S02: Unknown table 'sys.tmp_digests_delta' +SET @identifier := REPEAT('a', 65); +CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL); +ERROR 22001: Data too long for column 'in_table' at row 0 +DROP TEMPORARY TABLE test.tmp_digests_ini; +DROP TEMPORARY TABLE test.tmp_digests; +DROP TABLE test.tmp_unsupported; +DROP TABLE test.t1; +DROP VIEW view_digests; +SET @identifier := NULL; +SET SESSION sql_mode = @@global.sql_mode; +SET @sys.statement_performance_analyzer.limit = NULL; +SET @sys.statement_performance_analyzer.view = NULL; +UPDATE performance_schema.setup_consumers SET enabled = 'YES'; +UPDATE performance_schema.threads SET instrumented = 'YES'; +SET @sys.ignore_sys_config_triggers := true; +DELETE FROM sys.sys_config; +INSERT IGNORE INTO sys.sys_config (variable, value) VALUES +('statement_truncate_len', 64), +('statement_performance_analyzer.limit', 100), +('statement_performance_analyzer.view', NULL), +('diagnostics.allow_i_s_tables', 'OFF'), +('diagnostics.include_raw', 'OFF'), +('ps_thread_trx_info.max_length', 65535); +SET @sys.ignore_sys_config_triggers := NULL; diff --git a/mysql-test/suite/sysschema/r/pr_table_exists.result b/mysql-test/suite/sysschema/r/pr_table_exists.result new file mode 100644 index 00000000..76085bd7 --- /dev/null +++ b/mysql-test/suite/sysschema/r/pr_table_exists.result @@ -0,0 +1,72 @@ +CREATE TABLE t1 (id INT PRIMARY KEY); +CALL sys.table_exists('test', 't1', @exists); +SELECT @exists; +@exists +BASE TABLE +DROP TABLE t1; +CREATE view v_t1 AS SELECT 1; +CALL sys.table_exists('test', 'v_t1', @exists); +SELECT @exists; +@exists +VIEW +DROP VIEW v_t1; +CREATE TABLE tv (i int) with system versioning; +CALL sys.table_exists('test','tv',@exists); +SELECT @exists; +@exists +BASE TABLE +DROP TABLE tv; +CREATE SEQUENCE s; +CALL sys.table_exists('test','s',@exists); +SELECT @exists; +@exists +SEQUENCE +DROP SEQUENCE s; +CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); +CALL sys.table_exists('test', 't1', @exists); +SELECT @exists; +@exists +TEMPORARY +DROP TEMPORARY TABLE t1; +CALL sys.table_exists('information_schema', 'all_plugins', @exists); +SELECT @exists; +@exists +SYSTEM VIEW +CALL sys.table_exists('test', 't2', @exists); +SELECT @exists; +@exists + +SET @identifier := REPEAT('a', 65); +CALL sys.table_exists(@identifier, 't1', @exists); +ERROR 22001: Data too long for column 'in_db' at row 1 +CALL sys.table_exists('test', @identifier, @exists); +ERROR 22001: Data too long for column 'in_table' at row 0 +SET @identifier := NULL; +# +# MDEV-28391: table_exists procedure fails with +# Incorrect table name with backtick identifiers +# +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +BASE TABLE +DROP TABLE `ab``c`; +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +TEMPORARY +DROP TABLE `ab``c`; +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +@tbl_type +TEMPORARY +# We cannot send quoted identifer to the procedure, no table will be found +CALL sys.table_exists('test', '`ab``c`', @tbl_type); +SELECT @tbl_type; +@tbl_type + +DROP TABLE `ab``c`; diff --git a/mysql-test/suite/sysschema/r/t_sys_config.result b/mysql-test/suite/sysschema/r/t_sys_config.result new file mode 100644 index 00000000..f13196c6 --- /dev/null +++ b/mysql-test/suite/sysschema/r/t_sys_config.result @@ -0,0 +1,46 @@ +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='sys'; +COUNT(*) +0 +DESC sys.sys_config; +Field Type Null Key Default Extra +variable varchar(128) NO PRI NULL +value varchar(128) YES NULL +set_time timestamp NO current_timestamp() on update current_timestamp() +set_by varchar(128) YES NULL +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; +variable value set_by +diagnostics.allow_i_s_tables OFF NULL +diagnostics.include_raw OFF NULL +ps_thread_trx_info.max_length 65535 NULL +statement_performance_analyzer.limit 100 NULL +statement_performance_analyzer.view NULL NULL +statement_truncate_len 64 NULL +UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len'; +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; +variable value set_by +diagnostics.allow_i_s_tables OFF NULL +diagnostics.include_raw OFF NULL +ps_thread_trx_info.max_length 65535 NULL +statement_performance_analyzer.limit 100 NULL +statement_performance_analyzer.view NULL NULL +statement_truncate_len 128 NULL +INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar'); +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; +variable value set_by +diagnostics.allow_i_s_tables OFF NULL +diagnostics.include_raw OFF NULL +foo bar NULL +ps_thread_trx_info.max_length 65535 NULL +statement_performance_analyzer.limit 100 NULL +statement_performance_analyzer.view NULL NULL +statement_truncate_len 128 NULL +SET @sys.ignore_sys_config_triggers := true; +DELETE FROM sys.sys_config; +INSERT IGNORE INTO sys.sys_config (variable, value) VALUES +('statement_truncate_len', 64), +('statement_performance_analyzer.limit', 100), +('statement_performance_analyzer.view', NULL), +('diagnostics.allow_i_s_tables', 'OFF'), +('diagnostics.include_raw', 'OFF'), +('ps_thread_trx_info.max_length', 65535); +SET @sys.ignore_sys_config_triggers := NULL; diff --git a/mysql-test/suite/sysschema/r/v_host_summary.result b/mysql-test/suite/sysschema/r/v_host_summary.result new file mode 100644 index 00000000..b619a8a5 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary.result @@ -0,0 +1,30 @@ +DESC sys.host_summary; +Field Type Null Key Default Extra +host varchar(255) YES NULL +statements decimal(64,0) YES NULL +statement_latency text YES NULL +statement_avg_latency text YES NULL +table_scans decimal(65,0) YES NULL +file_ios decimal(64,0) YES NULL +file_io_latency text YES NULL +current_connections decimal(41,0) YES NULL +total_connections decimal(41,0) YES NULL +unique_users bigint(21) NO 0 +current_memory text YES NULL +total_memory_allocated text YES NULL +SELECT * FROM sys.host_summary; +DESC sys.x$host_summary; +Field Type Null Key Default Extra +host varchar(255) YES NULL +statements decimal(64,0) YES NULL +statement_latency decimal(64,0) YES NULL +statement_avg_latency decimal(65,4) YES NULL +table_scans decimal(65,0) YES NULL +file_ios decimal(64,0) YES NULL +file_io_latency decimal(64,0) YES NULL +current_connections decimal(41,0) YES NULL +total_connections decimal(41,0) YES NULL +unique_users bigint(21) NO 0 +current_memory decimal(63,0) YES NULL +total_memory_allocated decimal(64,0) YES NULL +SELECT * FROM sys.x$host_summary; diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result new file mode 100644 index 00000000..8e257163 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result @@ -0,0 +1,12 @@ +DESC sys.host_summary_by_file_io; +Field Type Null Key Default Extra +host varchar(255) YES NULL +ios decimal(42,0) YES NULL +io_latency text YES NULL +SELECT * FROM sys.host_summary_by_file_io; +DESC sys.x$host_summary_by_file_io; +Field Type Null Key Default Extra +host varchar(255) YES NULL +ios decimal(42,0) YES NULL +io_latency decimal(42,0) YES NULL +SELECT * FROM sys.x$host_summary_by_file_io; diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result new file mode 100644 index 00000000..c9a56aa9 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result @@ -0,0 +1,16 @@ +DESC sys.host_summary_by_file_io_type; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.host_summary_by_file_io_type; +DESC sys.x$host_summary_by_file_io_type; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$host_summary_by_file_io_type; diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result b/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result new file mode 100644 index 00000000..0ee6f255 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result @@ -0,0 +1,16 @@ +DESC sys.host_summary_by_stages; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +SELECT * FROM sys.host_summary_by_stages; +DESC sys.x$host_summary_by_stages; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$host_summary_by_stages; diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result new file mode 100644 index 00000000..882a30b7 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result @@ -0,0 +1,24 @@ +DESC sys.host_summary_by_statement_latency; +Field Type Null Key Default Extra +host varchar(255) YES NULL +total decimal(42,0) YES NULL +total_latency text YES NULL +max_latency text YES NULL +lock_latency text YES NULL +rows_sent decimal(42,0) YES NULL +rows_examined decimal(42,0) YES NULL +rows_affected decimal(42,0) YES NULL +full_scans decimal(43,0) YES NULL +SELECT * FROM sys.host_summary_by_statement_latency; +DESC sys.x$host_summary_by_statement_latency; +Field Type Null Key Default Extra +host varchar(255) YES NULL +total decimal(42,0) YES NULL +total_latency decimal(42,0) YES NULL +max_latency bigint(20) unsigned YES NULL +lock_latency decimal(42,0) YES NULL +rows_sent decimal(42,0) YES NULL +rows_examined decimal(42,0) YES NULL +rows_affected decimal(42,0) YES NULL +full_scans decimal(43,0) YES NULL +SELECT * FROM sys.x$host_summary_by_statement_latency; diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result new file mode 100644 index 00000000..eec8f869 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result @@ -0,0 +1,26 @@ +DESC sys.host_summary_by_statement_type; +Field Type Null Key Default Extra +host varchar(255) YES NULL +statement varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +max_latency text YES NULL +lock_latency text YES NULL +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_affected bigint(20) unsigned NO NULL +full_scans bigint(21) unsigned NO 0 +SELECT * FROM sys.host_summary_by_statement_type; +DESC sys.x$host_summary_by_statement_type; +Field Type Null Key Default Extra +host varchar(255) YES NULL +statement varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +lock_latency bigint(20) unsigned NO NULL +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_affected bigint(20) unsigned NO NULL +full_scans bigint(21) unsigned NO 0 +SELECT * FROM sys.x$host_summary_by_statement_type; diff --git a/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_schema.result b/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_schema.result new file mode 100644 index 00000000..fbfa41f7 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_schema.result @@ -0,0 +1,20 @@ +DESC sys.innodb_buffer_stats_by_schema; +Field Type Null Key Default Extra +object_schema text YES NULL +allocated text YES NULL +data text YES NULL +pages bigint(21) NO 0 +pages_hashed bigint(21) NO 0 +pages_old bigint(21) NO 0 +rows_cached decimal(44,0) YES NULL +SELECT * FROM sys.innodb_buffer_stats_by_schema; +DESC sys.x$innodb_buffer_stats_by_schema; +Field Type Null Key Default Extra +object_schema text YES NULL +allocated decimal(43,0) YES NULL +data decimal(43,0) YES NULL +pages bigint(21) NO 0 +pages_hashed bigint(21) NO 0 +pages_old bigint(21) NO 0 +rows_cached decimal(44,0) NO 0 +SELECT * FROM sys.x$innodb_buffer_stats_by_schema; diff --git a/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_table.result b/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_table.result new file mode 100644 index 00000000..27c7d991 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_innodb_buffer_stats_by_table.result @@ -0,0 +1,22 @@ +DESC sys.innodb_buffer_stats_by_table; +Field Type Null Key Default Extra +object_schema text YES NULL +object_name text YES NULL +allocated text YES NULL +data text YES NULL +pages bigint(21) NO 0 +pages_hashed bigint(21) NO 0 +pages_old bigint(21) NO 0 +rows_cached decimal(44,0) YES NULL +SELECT * FROM sys.innodb_buffer_stats_by_table; +DESC sys.x$innodb_buffer_stats_by_table; +Field Type Null Key Default Extra +object_schema text YES NULL +object_name text YES NULL +allocated decimal(43,0) YES NULL +data decimal(43,0) YES NULL +pages bigint(21) NO 0 +pages_hashed bigint(21) NO 0 +pages_old bigint(21) NO 0 +rows_cached decimal(44,0) NO 0 +SELECT * FROM sys.x$innodb_buffer_stats_by_table; diff --git a/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result b/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result new file mode 100644 index 00000000..d8e2c496 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_innodb_lock_waits.result @@ -0,0 +1,70 @@ +DESC sys.innodb_lock_waits; +Field Type Null Key Default Extra +wait_started datetime YES NULL +wait_age time /* mariadb-5.3 */ YES NULL +wait_age_secs bigint(21) YES NULL +locked_table varchar(1024) NO NULL +locked_index varchar(1024) YES NULL +locked_type enum('RECORD','TABLE') NO NULL +waiting_trx_id bigint(21) unsigned NO NULL +waiting_trx_started datetime NO NULL +waiting_trx_age time /* mariadb-5.3 */ YES NULL +waiting_trx_rows_locked bigint(21) unsigned NO NULL +waiting_trx_rows_modified bigint(21) unsigned NO NULL +waiting_pid bigint(21) unsigned NO NULL +waiting_query longtext YES NULL +waiting_lock_id varchar(81) NO NULL +waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL +blocking_trx_id bigint(21) unsigned NO NULL +blocking_pid bigint(21) unsigned NO NULL +blocking_query longtext YES NULL +blocking_lock_id varchar(81) NO NULL +blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL +blocking_trx_started datetime NO NULL +blocking_trx_age time /* mariadb-5.3 */ YES NULL +blocking_trx_rows_locked bigint(21) unsigned NO NULL +blocking_trx_rows_modified bigint(21) unsigned NO NULL +sql_kill_blocking_query varchar(32) YES NULL +sql_kill_blocking_connection varchar(26) YES NULL +SELECT * FROM sys.innodb_lock_waits; +DESC sys.x$innodb_lock_waits; +Field Type Null Key Default Extra +wait_started datetime YES NULL +wait_age time /* mariadb-5.3 */ YES NULL +wait_age_secs bigint(21) YES NULL +locked_table varchar(1024) NO NULL +locked_index varchar(1024) YES NULL +locked_type enum('RECORD','TABLE') NO NULL +waiting_trx_id bigint(21) unsigned NO NULL +waiting_trx_started datetime NO NULL +waiting_trx_age time /* mariadb-5.3 */ YES NULL +waiting_trx_rows_locked bigint(21) unsigned NO NULL +waiting_trx_rows_modified bigint(21) unsigned NO NULL +waiting_pid bigint(21) unsigned NO NULL +waiting_query varchar(1024) YES NULL +waiting_lock_id varchar(81) NO NULL +waiting_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL +blocking_trx_id bigint(21) unsigned NO NULL +blocking_pid bigint(21) unsigned NO NULL +blocking_query varchar(1024) YES NULL +blocking_lock_id varchar(81) NO NULL +blocking_lock_mode enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NO NULL +blocking_trx_started datetime NO NULL +blocking_trx_age time /* mariadb-5.3 */ YES NULL +blocking_trx_rows_locked bigint(21) unsigned NO NULL +blocking_trx_rows_modified bigint(21) unsigned NO NULL +sql_kill_blocking_query varchar(32) YES NULL +sql_kill_blocking_connection varchar(26) YES NULL +SELECT * FROM sys.x$innodb_lock_waits; +# +# Start of 10.6 tests +# +# +# MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +# +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +SELECT * FROM sys.x$innodb_lock_waits; +SET SESSION sql_mode=DEFAULT; +# +# End of 10.6 tests +# diff --git a/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result b/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result new file mode 100644 index 00000000..fddd2f26 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result @@ -0,0 +1,22 @@ +DESC sys.io_by_thread_by_latency; +Field Type Null Key Default Extra +user varchar(384) YES NULL +total decimal(42,0) YES NULL +total_latency text YES NULL +min_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +thread_id bigint(20) unsigned NO NULL +processlist_id bigint(20) unsigned YES NULL +SELECT * FROM sys.io_by_thread_by_latency; +DESC sys.x$io_by_thread_by_latency; +Field Type Null Key Default Extra +user varchar(384) YES NULL +total decimal(42,0) YES NULL +total_latency decimal(42,0) YES NULL +min_latency bigint(20) unsigned YES NULL +avg_latency decimal(24,4) YES NULL +max_latency bigint(20) unsigned YES NULL +thread_id bigint(20) unsigned NO NULL +processlist_id bigint(20) unsigned YES NULL +SELECT * FROM sys.x$io_by_thread_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_file_by_bytes.result b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_bytes.result new file mode 100644 index 00000000..06e88393 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_bytes.result @@ -0,0 +1,24 @@ +DESC sys.io_global_by_file_by_bytes; +Field Type Null Key Default Extra +file varchar(512) YES NULL +count_read bigint(20) unsigned NO NULL +total_read text YES NULL +avg_read text YES NULL +count_write bigint(20) unsigned NO NULL +total_written text YES NULL +avg_write text YES NULL +total text YES NULL +write_pct decimal(26,2) NO 0.00 +SELECT * FROM sys.io_global_by_file_by_bytes; +DESC sys.x$io_global_by_file_by_bytes; +Field Type Null Key Default Extra +file varchar(512) NO NULL +count_read bigint(20) unsigned NO NULL +total_read bigint(20) NO NULL +avg_read decimal(23,4) NO 0.0000 +count_write bigint(20) unsigned NO NULL +total_written bigint(20) NO NULL +avg_write decimal(23,4) NO 0.0000 +total bigint(21) NO 0 +write_pct decimal(26,2) NO 0.00 +SELECT * FROM sys.x$io_global_by_file_by_bytes; diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result new file mode 100644 index 00000000..32d992c2 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result @@ -0,0 +1,24 @@ +DESC sys.io_global_by_file_by_latency; +Field Type Null Key Default Extra +file varchar(512) YES NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +count_read bigint(20) unsigned NO NULL +read_latency text YES NULL +count_write bigint(20) unsigned NO NULL +write_latency text YES NULL +count_misc bigint(20) unsigned NO NULL +misc_latency text YES NULL +SELECT * FROM sys.io_global_by_file_by_latency; +DESC sys.x$io_global_by_file_by_latency; +Field Type Null Key Default Extra +file varchar(512) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +count_read bigint(20) unsigned NO NULL +read_latency bigint(20) unsigned NO NULL +count_write bigint(20) unsigned NO NULL +write_latency bigint(20) unsigned NO NULL +count_misc bigint(20) unsigned NO NULL +misc_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$io_global_by_file_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result new file mode 100644 index 00000000..3d5dcbff --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result @@ -0,0 +1,32 @@ +DESC sys.io_global_by_wait_by_bytes; +Field Type Null Key Default Extra +event_name varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +min_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +count_read bigint(20) unsigned NO NULL +total_read text YES NULL +avg_read text YES NULL +count_write bigint(20) unsigned NO NULL +total_written text YES NULL +avg_written text YES NULL +total_requested text YES NULL +SELECT * FROM sys.io_global_by_wait_by_bytes; +DESC sys.x$io_global_by_wait_by_bytes; +Field Type Null Key Default Extra +event_name varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +min_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +count_read bigint(20) unsigned NO NULL +total_read bigint(20) NO NULL +avg_read decimal(23,4) NO 0.0000 +count_write bigint(20) unsigned NO NULL +total_written bigint(20) NO NULL +avg_written decimal(23,4) NO 0.0000 +total_requested bigint(21) NO 0 +SELECT * FROM sys.x$io_global_by_wait_by_bytes; diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result new file mode 100644 index 00000000..1c5db297 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result @@ -0,0 +1,34 @@ +DESC sys.io_global_by_wait_by_latency; +Field Type Null Key Default Extra +event_name varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +read_latency text YES NULL +write_latency text YES NULL +misc_latency text YES NULL +count_read bigint(20) unsigned NO NULL +total_read text YES NULL +avg_read text YES NULL +count_write bigint(20) unsigned NO NULL +total_written text YES NULL +avg_written text YES NULL +SELECT * FROM sys.io_global_by_wait_by_latency; +DESC sys.x$io_global_by_wait_by_latency; +Field Type Null Key Default Extra +event_name varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +read_latency bigint(20) unsigned NO NULL +write_latency bigint(20) unsigned NO NULL +misc_latency bigint(20) unsigned NO NULL +count_read bigint(20) unsigned NO NULL +total_read bigint(20) NO NULL +avg_read decimal(23,4) NO 0.0000 +count_write bigint(20) unsigned NO NULL +total_written bigint(20) NO NULL +avg_written decimal(23,4) NO 0.0000 +SELECT * FROM sys.x$io_global_by_wait_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_latest_file_io.result b/mysql-test/suite/sysschema/r/v_latest_file_io.result new file mode 100644 index 00000000..a65cdb2d --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_latest_file_io.result @@ -0,0 +1,16 @@ +DESC sys.latest_file_io; +Field Type Null Key Default Extra +thread varchar(214) YES NULL +file varchar(512) YES NULL +latency text YES NULL +operation varchar(32) NO NULL +requested text YES NULL +SELECT * FROM sys.latest_file_io; +DESC sys.x$latest_file_io; +Field Type Null Key Default Extra +thread varchar(214) YES NULL +file varchar(512) YES NULL +latency bigint(20) unsigned YES NULL +operation varchar(32) NO NULL +requested bigint(20) YES NULL +SELECT * FROM sys.x$latest_file_io; diff --git a/mysql-test/suite/sysschema/r/v_memory_by_host_by_current_bytes.result b/mysql-test/suite/sysschema/r/v_memory_by_host_by_current_bytes.result new file mode 100644 index 00000000..9b0e0f91 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_memory_by_host_by_current_bytes.result @@ -0,0 +1,18 @@ +DESC sys.memory_by_host_by_current_bytes; +Field Type Null Key Default Extra +host varchar(60) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated text YES NULL +current_avg_alloc text YES NULL +current_max_alloc text YES NULL +total_allocated text YES NULL +SELECT * FROM sys.memory_by_host_by_current_bytes; +DESC sys.x$memory_by_host_by_current_bytes; +Field Type Null Key Default Extra +host varchar(60) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated decimal(41,0) YES NULL +current_avg_alloc decimal(45,4) NO 0.0000 +current_max_alloc bigint(20) YES NULL +total_allocated decimal(42,0) YES NULL +SELECT * FROM sys.x$memory_by_host_by_current_bytes; diff --git a/mysql-test/suite/sysschema/r/v_memory_by_thread_by_current_bytes.result b/mysql-test/suite/sysschema/r/v_memory_by_thread_by_current_bytes.result new file mode 100644 index 00000000..80bb84c3 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_memory_by_thread_by_current_bytes.result @@ -0,0 +1,20 @@ +DESC sys.memory_by_thread_by_current_bytes; +Field Type Null Key Default Extra +thread_id bigint(20) unsigned NO NULL +user varchar(384) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated text YES NULL +current_avg_alloc text YES NULL +current_max_alloc text YES NULL +total_allocated text YES NULL +SELECT * FROM sys.memory_by_thread_by_current_bytes; +DESC sys.x$memory_by_thread_by_current_bytes; +Field Type Null Key Default Extra +thread_id bigint(20) unsigned NO NULL +user varchar(384) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated decimal(41,0) YES NULL +current_avg_alloc decimal(45,4) NO 0.0000 +current_max_alloc bigint(20) YES NULL +total_allocated decimal(42,0) YES NULL +SELECT * FROM sys.x$memory_by_thread_by_current_bytes; diff --git a/mysql-test/suite/sysschema/r/v_memory_by_user_by_current_bytes.result b/mysql-test/suite/sysschema/r/v_memory_by_user_by_current_bytes.result new file mode 100644 index 00000000..95d56d9d --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_memory_by_user_by_current_bytes.result @@ -0,0 +1,18 @@ +DESC sys.memory_by_user_by_current_bytes; +Field Type Null Key Default Extra +user varchar(32) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated text YES NULL +current_avg_alloc text YES NULL +current_max_alloc text YES NULL +total_allocated text YES NULL +SELECT * FROM sys.memory_by_user_by_current_bytes; +DESC sys.x$memory_by_user_by_current_bytes; +Field Type Null Key Default Extra +user varchar(32) YES NULL +current_count_used decimal(41,0) YES NULL +current_allocated decimal(41,0) YES NULL +current_avg_alloc decimal(45,4) NO 0.0000 +current_max_alloc bigint(20) YES NULL +total_allocated decimal(42,0) YES NULL +SELECT * FROM sys.x$memory_by_user_by_current_bytes; diff --git a/mysql-test/suite/sysschema/r/v_memory_global_by_current_bytes.result b/mysql-test/suite/sysschema/r/v_memory_global_by_current_bytes.result new file mode 100644 index 00000000..aef384dd --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_memory_global_by_current_bytes.result @@ -0,0 +1,20 @@ +DESC sys.memory_global_by_current_bytes; +Field Type Null Key Default Extra +event_name varchar(128) NO NULL +current_count bigint(20) NO NULL +current_alloc text YES NULL +current_avg_alloc text YES NULL +high_count bigint(20) NO NULL +high_alloc text YES NULL +high_avg_alloc text YES NULL +SELECT * FROM sys.memory_global_by_current_bytes; +DESC sys.x$memory_global_by_current_bytes; +Field Type Null Key Default Extra +event_name varchar(128) NO NULL +current_count bigint(20) NO NULL +current_alloc bigint(20) NO NULL +current_avg_alloc decimal(23,4) NO 0.0000 +high_count bigint(20) NO NULL +high_alloc bigint(20) NO NULL +high_avg_alloc decimal(23,4) NO 0.0000 +SELECT * FROM sys.x$memory_global_by_current_bytes; diff --git a/mysql-test/suite/sysschema/r/v_memory_global_total.result b/mysql-test/suite/sysschema/r/v_memory_global_total.result new file mode 100644 index 00000000..e114cefa --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_memory_global_total.result @@ -0,0 +1,8 @@ +DESC sys.memory_global_total; +Field Type Null Key Default Extra +total_allocated text YES NULL +SELECT * FROM sys.memory_global_total; +DESC sys.x$memory_global_total; +Field Type Null Key Default Extra +total_allocated decimal(41,0) YES NULL +SELECT * FROM sys.x$memory_global_total; diff --git a/mysql-test/suite/sysschema/r/v_metrics.result b/mysql-test/suite/sysschema/r/v_metrics.result new file mode 100644 index 00000000..bfc840ed --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_metrics.result @@ -0,0 +1,7 @@ +DESC sys.metrics; +Field Type Null Key Default Extra +Variable_name varchar(193) YES NULL +Variable_value varchar(1024) YES NULL +Type varchar(210) YES NULL +Enabled varchar(3) NO +SELECT * FROM sys.metrics; diff --git a/mysql-test/suite/sysschema/r/v_processlist.result b/mysql-test/suite/sysschema/r/v_processlist.result new file mode 100644 index 00000000..dfc04814 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_processlist.result @@ -0,0 +1,62 @@ +DESC sys.processlist; +Field Type Null Key Default Extra +thd_id bigint(20) unsigned NO NULL +conn_id bigint(20) unsigned YES NULL +user varchar(384) YES NULL +db varchar(64) YES NULL +command varchar(16) YES NULL +state varchar(64) YES NULL +time bigint(20) YES NULL +current_statement longtext YES NULL +statement_latency mediumtext YES NULL +progress decimal(26,2) YES NULL +lock_latency text YES NULL +rows_examined bigint(20) unsigned YES NULL +rows_sent bigint(20) unsigned YES NULL +rows_affected bigint(20) unsigned YES NULL +tmp_tables bigint(20) unsigned YES NULL +tmp_disk_tables bigint(20) unsigned YES NULL +full_scan varchar(3) YES NULL +last_statement longtext YES NULL +last_statement_latency mediumtext YES NULL +current_memory text YES NULL +last_wait varchar(128) YES NULL +last_wait_latency mediumtext YES NULL +source varchar(64) YES NULL +trx_latency text YES NULL +trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL +trx_autocommit enum('YES','NO') YES NULL +pid varchar(1024) YES NULL +program_name varchar(1024) YES NULL +SELECT * FROM sys.processlist; +DESC sys.x$processlist; +Field Type Null Key Default Extra +thd_id bigint(20) unsigned NO NULL +conn_id bigint(20) unsigned YES NULL +user varchar(384) YES NULL +db varchar(64) YES NULL +command varchar(16) YES NULL +state varchar(64) YES NULL +time bigint(20) YES NULL +current_statement longtext YES NULL +statement_latency bigint(20) unsigned YES NULL +progress decimal(26,2) YES NULL +lock_latency bigint(20) unsigned YES NULL +rows_examined bigint(20) unsigned YES NULL +rows_sent bigint(20) unsigned YES NULL +rows_affected bigint(20) unsigned YES NULL +tmp_tables bigint(20) unsigned YES NULL +tmp_disk_tables bigint(20) unsigned YES NULL +full_scan varchar(3) YES NULL +last_statement longtext YES NULL +last_statement_latency bigint(20) unsigned YES NULL +current_memory decimal(41,0) YES NULL +last_wait varchar(128) YES NULL +last_wait_latency varchar(20) YES NULL +source varchar(64) YES NULL +trx_latency bigint(20) unsigned YES NULL +trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL +trx_autocommit enum('YES','NO') YES NULL +pid varchar(1024) YES NULL +program_name varchar(1024) YES NULL +SELECT * FROM sys.x$processlist; diff --git a/mysql-test/suite/sysschema/r/v_ps_check_lost_instrumentation.result b/mysql-test/suite/sysschema/r/v_ps_check_lost_instrumentation.result new file mode 100644 index 00000000..dfbd2046 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_ps_check_lost_instrumentation.result @@ -0,0 +1,5 @@ +DESC sys.ps_check_lost_instrumentation; +Field Type Null Key Default Extra +variable_name varchar(64) NO NULL +variable_value varchar(1024) YES NULL +SELECT * FROM sys.ps_check_lost_instrumentation; diff --git a/mysql-test/suite/sysschema/r/v_ps_digest_95th_percentile_by_avg_us.result b/mysql-test/suite/sysschema/r/v_ps_digest_95th_percentile_by_avg_us.result new file mode 100644 index 00000000..6378c9cf --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_ps_digest_95th_percentile_by_avg_us.result @@ -0,0 +1,18 @@ +DESC sys.x$ps_digest_95th_percentile_by_avg_us; +Field Type Null Key Default Extra +avg_us decimal(21,0) YES NULL +percentile decimal(46,4) NO 0.0000 +DESC sys.x$ps_digest_95th_percentile_by_avg_us; +Field Type Null Key Default Extra +avg_us decimal(21,0) YES NULL +percentile decimal(46,4) NO 0.0000 +DESC sys.x$ps_digest_95th_percentile_by_avg_us; +Field Type Null Key Default Extra +avg_us decimal(21,0) YES NULL +percentile decimal(46,4) NO 0.0000 +SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us; +DESC sys.x$ps_digest_95th_percentile_by_avg_us; +Field Type Null Key Default Extra +avg_us decimal(21,0) YES NULL +percentile decimal(46,4) NO 0.0000 +SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us; diff --git a/mysql-test/suite/sysschema/r/v_ps_digest_avg_latency_distribution.result b/mysql-test/suite/sysschema/r/v_ps_digest_avg_latency_distribution.result new file mode 100644 index 00000000..a3eb1e28 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_ps_digest_avg_latency_distribution.result @@ -0,0 +1,18 @@ +DESC sys.x$ps_digest_avg_latency_distribution; +Field Type Null Key Default Extra +cnt bigint(21) NO 0 +avg_us decimal(21,0) YES NULL +DESC sys.x$ps_digest_avg_latency_distribution; +Field Type Null Key Default Extra +cnt bigint(21) NO 0 +avg_us decimal(21,0) YES NULL +DESC sys.x$ps_digest_avg_latency_distribution; +Field Type Null Key Default Extra +cnt bigint(21) NO 0 +avg_us decimal(21,0) YES NULL +SELECT * FROM sys.x$ps_digest_avg_latency_distribution; +DESC sys.x$ps_digest_avg_latency_distribution; +Field Type Null Key Default Extra +cnt bigint(21) NO 0 +avg_us decimal(21,0) YES NULL +SELECT * FROM sys.x$ps_digest_avg_latency_distribution; diff --git a/mysql-test/suite/sysschema/r/v_ps_schema_table_statistics_io.result b/mysql-test/suite/sysschema/r/v_ps_schema_table_statistics_io.result new file mode 100644 index 00000000..0b1ae3bf --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_ps_schema_table_statistics_io.result @@ -0,0 +1,50 @@ +DESC sys.x$ps_schema_table_statistics_io; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +count_read decimal(42,0) YES NULL +sum_number_of_bytes_read decimal(41,0) YES NULL +sum_timer_read decimal(42,0) YES NULL +count_write decimal(42,0) YES NULL +sum_number_of_bytes_write decimal(41,0) YES NULL +sum_timer_write decimal(42,0) YES NULL +count_misc decimal(42,0) YES NULL +sum_timer_misc decimal(42,0) YES NULL +DESC sys.x$ps_schema_table_statistics_io; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +count_read decimal(42,0) YES NULL +sum_number_of_bytes_read decimal(41,0) YES NULL +sum_timer_read decimal(42,0) YES NULL +count_write decimal(42,0) YES NULL +sum_number_of_bytes_write decimal(41,0) YES NULL +sum_timer_write decimal(42,0) YES NULL +count_misc decimal(42,0) YES NULL +sum_timer_misc decimal(42,0) YES NULL +DESC sys.x$ps_schema_table_statistics_io; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +count_read decimal(42,0) YES NULL +sum_number_of_bytes_read decimal(41,0) YES NULL +sum_timer_read decimal(42,0) YES NULL +count_write decimal(42,0) YES NULL +sum_number_of_bytes_write decimal(41,0) YES NULL +sum_timer_write decimal(42,0) YES NULL +count_misc decimal(42,0) YES NULL +sum_timer_misc decimal(42,0) YES NULL +SELECT * FROM sys.x$ps_schema_table_statistics_io; +DESC sys.x$ps_schema_table_statistics_io; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +count_read decimal(42,0) YES NULL +sum_number_of_bytes_read decimal(41,0) YES NULL +sum_timer_read decimal(42,0) YES NULL +count_write decimal(42,0) YES NULL +sum_number_of_bytes_write decimal(41,0) YES NULL +sum_timer_write decimal(42,0) YES NULL +count_misc decimal(42,0) YES NULL +sum_timer_misc decimal(42,0) YES NULL +SELECT * FROM sys.x$ps_schema_table_statistics_io; diff --git a/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result b/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result new file mode 100644 index 00000000..ef2ad76b --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_auto_increment_columns.result @@ -0,0 +1,143 @@ +DESC sys.schema_auto_increment_columns; +Field Type Null Key Default Extra +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +column_name varchar(64) NO NULL +data_type varchar(64) NO NULL +column_type longtext NO NULL +is_signed int(1) NO 0 +is_unsigned int(1) NO 0 +max_value bigint(21) unsigned YES NULL +auto_increment bigint(21) unsigned YES NULL +auto_increment_ratio decimal(25,4) unsigned YES NULL +SELECT * FROM sys.schema_auto_increment_columns; +CREATE DATABASE auto_incs; +CREATE TABLE auto_incs.tinyintcol ( +id TINYINT AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.tinyintcol (foo) VALUES (100); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +CREATE TABLE auto_incs.tinyintcolunsigned ( +id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.tinyintcolunsigned (foo) (SELECT foo FROM auto_incs.tinyintcol); +CREATE TABLE auto_incs.smallintcol ( +id SMALLINT AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.smallintcol (foo) VALUES (200); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +CREATE TABLE auto_incs.smallintcolunsigned ( +id SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.smallintcolunsigned (foo) (SELECT foo FROM auto_incs.smallintcol); +CREATE TABLE auto_incs.mediumintcol ( +id MEDIUMINT AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.mediumintcol (foo) VALUES (300); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +CREATE TABLE auto_incs.mediumintcolunsigned ( +id MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.mediumintcolunsigned (foo) (SELECT foo FROM auto_incs.mediumintcol); +CREATE TABLE auto_incs.intcol ( +id INT AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.intcol (foo) VALUES (400); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +CREATE TABLE auto_incs.intcolunsigned ( +id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.intcolunsigned (foo) (SELECT foo FROM auto_incs.intcol); +CREATE TABLE auto_incs.bigintcol ( +id BIGINT AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.bigintcol (foo) VALUES (500); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +CREATE TABLE auto_incs.bigintcolunsigned ( +id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, +foo INT +); +INSERT INTO auto_incs.bigintcolunsigned (foo) (SELECT foo FROM auto_incs.bigintcol); +SELECT * FROM sys.schema_auto_increment_columns; +table_schema table_name column_name data_type column_type is_signed is_unsigned max_value auto_increment auto_increment_ratio +auto_incs tinyintcol id tinyint tinyint(4) 1 0 127 17 0.1339 +auto_incs tinyintcolunsigned id tinyint tinyint(3) unsigned 0 1 255 17 0.0667 +auto_incs smallintcol id smallint smallint(6) 1 0 32767 2049 0.0625 +auto_incs smallintcolunsigned id smallint smallint(5) unsigned 0 1 65535 2049 0.0313 +auto_incs mediumintcol id mediumint mediumint(9) 1 0 8388607 131073 0.0156 +auto_incs mediumintcolunsigned id mediumint mediumint(8) unsigned 0 1 16777215 131073 0.0078 +auto_incs intcol id int int(11) 1 0 2147483647 131073 0.0001 +auto_incs intcolunsigned id int int(10) unsigned 0 1 4294967295 131073 0.0000 +auto_incs bigintcol id bigint bigint(20) 1 0 9223372036854775807 131073 0.0000 +auto_incs bigintcolunsigned id bigint bigint(20) unsigned 0 1 18446744073709551615 131073 0.0000 +DROP DATABASE auto_incs; diff --git a/mysql-test/suite/sysschema/r/v_schema_index_statistics.result b/mysql-test/suite/sysschema/r/v_schema_index_statistics.result new file mode 100644 index 00000000..63cf1931 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_index_statistics.result @@ -0,0 +1,28 @@ +DESC sys.schema_index_statistics; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +index_name varchar(64) YES NULL +rows_selected bigint(20) unsigned NO NULL +select_latency text YES NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency text YES NULL +rows_updated bigint(20) unsigned NO NULL +update_latency text YES NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency text YES NULL +SELECT * FROM sys.schema_index_statistics; +DESC sys.x$schema_index_statistics; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +index_name varchar(64) YES NULL +rows_selected bigint(20) unsigned NO NULL +select_latency bigint(20) unsigned NO NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency bigint(20) unsigned NO NULL +rows_updated bigint(20) unsigned NO NULL +update_latency bigint(20) unsigned NO NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$schema_index_statistics; diff --git a/mysql-test/suite/sysschema/r/v_schema_object_overview.result b/mysql-test/suite/sysschema/r/v_schema_object_overview.result new file mode 100644 index 00000000..1c6144e9 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_object_overview.result @@ -0,0 +1,6 @@ +DESC sys.schema_object_overview; +Field Type Null Key Default Extra +db varchar(64) NO +object_type varchar(64) YES NULL +count bigint(21) NO 0 +SELECT * FROM sys.schema_object_overview; diff --git a/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result b/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result new file mode 100644 index 00000000..2199c959 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_redundant_indexes.result @@ -0,0 +1,37 @@ +DESC sys.schema_redundant_indexes; +Field Type Null Key Default Extra +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +redundant_index_name varchar(64) NO NULL +redundant_index_columns mediumtext YES NULL +redundant_index_non_unique bigint(1) YES NULL +dominant_index_name varchar(64) NO NULL +dominant_index_columns mediumtext YES NULL +dominant_index_non_unique bigint(1) YES NULL +subpart_exists int(1) YES NULL +sql_drop_index varchar(223) YES NULL +SELECT * FROM sys.schema_redundant_indexes; +DESC sys.x$schema_flattened_keys; +Field Type Null Key Default Extra +table_schema varchar(64) NO NULL +table_name varchar(64) NO NULL +index_name varchar(64) NO NULL +non_unique bigint(1) YES NULL +subpart_exists bigint(1) YES NULL +index_columns mediumtext YES NULL +SELECT * FROM sys.x$schema_flattened_keys; +CREATE DATABASE rkey; +CREATE TABLE rkey.rkey ( +i INT, +j INT, +k INT, +PRIMARY KEY (i), +KEY (j), +KEY (j, k), +KEY (i, j, k) +); +SELECT * FROM sys.schema_redundant_indexes; +table_schema table_name redundant_index_name redundant_index_columns redundant_index_non_unique dominant_index_name dominant_index_columns dominant_index_non_unique subpart_exists sql_drop_index +rkey rkey j j 1 j_2 j,k 1 0 ALTER TABLE `rkey`.`rkey` DROP INDEX `j` +rkey rkey i i,j,k 1 PRIMARY i 0 0 ALTER TABLE `rkey`.`rkey` DROP INDEX `i` +DROP DATABASE rkey; diff --git a/mysql-test/suite/sysschema/r/v_schema_table_lock_waits.result b/mysql-test/suite/sysschema/r/v_schema_table_lock_waits.result new file mode 100644 index 00000000..e51b3f27 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_table_lock_waits.result @@ -0,0 +1,61 @@ +DESC sys.schema_table_lock_waits; +Field Type Null Key Default Extra +object_schema varchar(64) YES NULL +object_name varchar(64) YES NULL +waiting_thread_id bigint(20) unsigned NO NULL +waiting_pid bigint(20) unsigned YES NULL +waiting_account text YES NULL +waiting_lock_type varchar(32) NO NULL +waiting_lock_duration varchar(32) NO NULL +waiting_query longtext YES NULL +waiting_query_secs bigint(20) YES NULL +waiting_query_rows_affected bigint(20) unsigned YES NULL +waiting_query_rows_examined bigint(20) unsigned YES NULL +blocking_thread_id bigint(20) unsigned NO NULL +blocking_pid bigint(20) unsigned YES NULL +blocking_account text YES NULL +blocking_lock_type varchar(32) NO NULL +blocking_lock_duration varchar(32) NO NULL +sql_kill_blocking_query varchar(31) YES NULL +sql_kill_blocking_connection varchar(25) YES NULL +SELECT * FROM sys.schema_table_lock_waits; +DESC sys.x$schema_table_lock_waits; +Field Type Null Key Default Extra +object_schema varchar(64) YES NULL +object_name varchar(64) YES NULL +waiting_thread_id bigint(20) unsigned NO NULL +waiting_pid bigint(20) unsigned YES NULL +waiting_account text YES NULL +waiting_lock_type varchar(32) NO NULL +waiting_lock_duration varchar(32) NO NULL +waiting_query longtext YES NULL +waiting_query_secs bigint(20) YES NULL +waiting_query_rows_affected bigint(20) unsigned YES NULL +waiting_query_rows_examined bigint(20) unsigned YES NULL +blocking_thread_id bigint(20) unsigned NO NULL +blocking_pid bigint(20) unsigned YES NULL +blocking_account text YES NULL +blocking_lock_type varchar(32) NO NULL +blocking_lock_duration varchar(32) NO NULL +sql_kill_blocking_query varchar(31) YES NULL +sql_kill_blocking_connection varchar(25) YES NULL +SELECT * FROM sys.x$schema_table_lock_waits; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; +CREATE TABLE test.lock_waits (i INT PRIMARY KEY, j INT) ENGINE = InnoDB; +LOCK TABLE lock_waits WRITE; +connection con2; +ALTER TABLE test.lock_waits ADD k VARCHAR(20); +connection default; +SELECT object_schema, object_name, +waiting_account, waiting_lock_type, waiting_query, +blocking_account, blocking_lock_type, blocking_lock_duration +FROM sys.schema_table_lock_waits; +object_schema object_name waiting_account waiting_lock_type waiting_query blocking_account blocking_lock_type blocking_lock_duration +test lock_waits root@localhost SHARED_UPGRADABLE ALTER TABLE test.lock_waits ADD k VARCHAR(20) root@localhost SHARED_NO_READ_WRITE TRANSACTION +disconnect con1; +connection default; +disconnect con2; +connection default; +DROP TABLE test.lock_waits; diff --git a/mysql-test/suite/sysschema/r/v_schema_table_statistics.result b/mysql-test/suite/sysschema/r/v_schema_table_statistics.result new file mode 100644 index 00000000..fda0d7da --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_table_statistics.result @@ -0,0 +1,44 @@ +DESC sys.schema_table_statistics; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +total_latency text YES NULL +rows_fetched bigint(20) unsigned NO NULL +fetch_latency text YES NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency text YES NULL +rows_updated bigint(20) unsigned NO NULL +update_latency text YES NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency text YES NULL +io_read_requests decimal(42,0) YES NULL +io_read text YES NULL +io_read_latency text YES NULL +io_write_requests decimal(42,0) YES NULL +io_write text YES NULL +io_write_latency text YES NULL +io_misc_requests decimal(42,0) YES NULL +io_misc_latency text YES NULL +SELECT * FROM sys.schema_table_statistics; +DESC sys.x$schema_table_statistics; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +total_latency bigint(20) unsigned NO NULL +rows_fetched bigint(20) unsigned NO NULL +fetch_latency bigint(20) unsigned NO NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency bigint(20) unsigned NO NULL +rows_updated bigint(20) unsigned NO NULL +update_latency bigint(20) unsigned NO NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency bigint(20) unsigned NO NULL +io_read_requests decimal(42,0) YES NULL +io_read decimal(41,0) YES NULL +io_read_latency decimal(42,0) YES NULL +io_write_requests decimal(42,0) YES NULL +io_write decimal(41,0) YES NULL +io_write_latency decimal(42,0) YES NULL +io_misc_requests decimal(42,0) YES NULL +io_misc_latency decimal(42,0) YES NULL +SELECT * FROM sys.x$schema_table_statistics; diff --git a/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result b/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result new file mode 100644 index 00000000..809e8a4e --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result @@ -0,0 +1,56 @@ +DESC sys.schema_table_statistics_with_buffer; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +rows_fetched bigint(20) unsigned NO NULL +fetch_latency text YES NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency text YES NULL +rows_updated bigint(20) unsigned NO NULL +update_latency text YES NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency text YES NULL +io_read_requests decimal(42,0) YES NULL +io_read text YES NULL +io_read_latency text YES NULL +io_write_requests decimal(42,0) YES NULL +io_write text YES NULL +io_write_latency text YES NULL +io_misc_requests decimal(42,0) YES NULL +io_misc_latency text YES NULL +innodb_buffer_allocated text YES NULL +innodb_buffer_data text YES NULL +innodb_buffer_free text YES NULL +innodb_buffer_pages bigint(21) YES 0 +innodb_buffer_pages_hashed bigint(21) YES 0 +innodb_buffer_pages_old bigint(21) YES 0 +innodb_buffer_rows_cached decimal(44,0) YES 0 +SELECT * FROM sys.schema_table_statistics_with_buffer; +DESC sys.x$schema_table_statistics_with_buffer; +Field Type Null Key Default Extra +table_schema varchar(64) YES NULL +table_name varchar(64) YES NULL +rows_fetched bigint(20) unsigned NO NULL +fetch_latency bigint(20) unsigned NO NULL +rows_inserted bigint(20) unsigned NO NULL +insert_latency bigint(20) unsigned NO NULL +rows_updated bigint(20) unsigned NO NULL +update_latency bigint(20) unsigned NO NULL +rows_deleted bigint(20) unsigned NO NULL +delete_latency bigint(20) unsigned NO NULL +io_read_requests decimal(42,0) YES NULL +io_read decimal(41,0) YES NULL +io_read_latency decimal(42,0) YES NULL +io_write_requests decimal(42,0) YES NULL +io_write decimal(41,0) YES NULL +io_write_latency decimal(42,0) YES NULL +io_misc_requests decimal(42,0) YES NULL +io_misc_latency decimal(42,0) YES NULL +innodb_buffer_allocated decimal(43,0) YES NULL +innodb_buffer_data decimal(43,0) YES NULL +innodb_buffer_free decimal(44,0) YES NULL +innodb_buffer_pages bigint(21) YES 0 +innodb_buffer_pages_hashed bigint(21) YES 0 +innodb_buffer_pages_old bigint(21) YES 0 +innodb_buffer_rows_cached decimal(44,0) YES 0 +SELECT * FROM sys.x$schema_table_statistics_with_buffer; diff --git a/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result b/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result new file mode 100644 index 00000000..a6aca341 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result @@ -0,0 +1,51 @@ +DESC sys.schema_tables_with_full_table_scans; +Field Type Null Key Default Extra +object_schema varchar(64) YES NULL +object_name varchar(64) YES NULL +rows_full_scanned bigint(20) unsigned NO NULL +latency text YES NULL +SELECT * FROM sys.schema_tables_with_full_table_scans; +DESC sys.x$schema_tables_with_full_table_scans; +Field Type Null Key Default Extra +object_schema varchar(64) YES NULL +object_name varchar(64) YES NULL +rows_full_scanned bigint(20) unsigned NO NULL +latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$schema_tables_with_full_table_scans; +CREATE TABLE test.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb; +INSERT INTO test.t (j) VALUES (1), (2), (3); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); +CALL sys.ps_truncate_all_tables(false); +summary +Truncated 44 tables +SELECT i, j, RAND() FROM test.t WHERE j = 12; +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 768 +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 768 +SELECT i, j, RAND() FROM test.t WHERE j = 12; +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 1536 +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 1536 +SELECT * FROM test.t WHERE i = 10; +i j +10 4 +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 1536 +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; +object_schema object_name rows_full_scanned +test t 1536 +DROP TABLE test.t; diff --git a/mysql-test/suite/sysschema/r/v_schema_unused_indexes.result b/mysql-test/suite/sysschema/r/v_schema_unused_indexes.result new file mode 100644 index 00000000..fc8395dc --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_schema_unused_indexes.result @@ -0,0 +1,6 @@ +DESC sys.schema_unused_indexes; +Field Type Null Key Default Extra +object_schema varchar(64) YES NULL +object_name varchar(64) YES NULL +index_name varchar(64) YES NULL +SELECT * FROM sys.schema_unused_indexes; diff --git a/mysql-test/suite/sysschema/r/v_session.result b/mysql-test/suite/sysschema/r/v_session.result new file mode 100644 index 00000000..fd88b8f1 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_session.result @@ -0,0 +1,62 @@ +DESC sys.session; +Field Type Null Key Default Extra +thd_id bigint(20) unsigned NO NULL +conn_id bigint(20) unsigned YES NULL +user varchar(384) YES NULL +db varchar(64) YES NULL +command varchar(16) YES NULL +state varchar(64) YES NULL +time bigint(20) YES NULL +current_statement longtext YES NULL +statement_latency mediumtext YES NULL +progress decimal(26,2) YES NULL +lock_latency text YES NULL +rows_examined bigint(20) unsigned YES NULL +rows_sent bigint(20) unsigned YES NULL +rows_affected bigint(20) unsigned YES NULL +tmp_tables bigint(20) unsigned YES NULL +tmp_disk_tables bigint(20) unsigned YES NULL +full_scan varchar(3) YES NULL +last_statement longtext YES NULL +last_statement_latency mediumtext YES NULL +current_memory text YES NULL +last_wait varchar(128) YES NULL +last_wait_latency mediumtext YES NULL +source varchar(64) YES NULL +trx_latency text YES NULL +trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL +trx_autocommit enum('YES','NO') YES NULL +pid varchar(1024) YES NULL +program_name varchar(1024) YES NULL +SELECT * FROM sys.session; +DESC sys.x$session; +Field Type Null Key Default Extra +thd_id bigint(20) unsigned NO NULL +conn_id bigint(20) unsigned YES NULL +user varchar(384) YES NULL +db varchar(64) YES NULL +command varchar(16) YES NULL +state varchar(64) YES NULL +time bigint(20) YES NULL +current_statement longtext YES NULL +statement_latency bigint(20) unsigned YES NULL +progress decimal(26,2) YES NULL +lock_latency bigint(20) unsigned YES NULL +rows_examined bigint(20) unsigned YES NULL +rows_sent bigint(20) unsigned YES NULL +rows_affected bigint(20) unsigned YES NULL +tmp_tables bigint(20) unsigned YES NULL +tmp_disk_tables bigint(20) unsigned YES NULL +full_scan varchar(3) YES NULL +last_statement longtext YES NULL +last_statement_latency bigint(20) unsigned YES NULL +current_memory decimal(41,0) YES NULL +last_wait varchar(128) YES NULL +last_wait_latency varchar(20) YES NULL +source varchar(64) YES NULL +trx_latency bigint(20) unsigned YES NULL +trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL +trx_autocommit enum('YES','NO') YES NULL +pid varchar(1024) YES NULL +program_name varchar(1024) YES NULL +SELECT * FROM sys.x$session; diff --git a/mysql-test/suite/sysschema/r/v_session_ssl_status.result b/mysql-test/suite/sysschema/r/v_session_ssl_status.result new file mode 100644 index 00000000..e0e397c3 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_session_ssl_status.result @@ -0,0 +1,7 @@ +DESC sys.session_ssl_status; +Field Type Null Key Default Extra +thread_id bigint(20) unsigned NO NULL +ssl_version varchar(1024) YES NULL +ssl_cipher varchar(1024) YES NULL +ssl_sessions_reused varchar(1024) YES NULL +SELECT * FROM sys.session_ssl_status; diff --git a/mysql-test/suite/sysschema/r/v_statement_analysis.result b/mysql-test/suite/sysschema/r/v_statement_analysis.result new file mode 100644 index 00000000..c3dd167c --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statement_analysis.result @@ -0,0 +1,52 @@ +DESC sys.statement_analysis; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +full_scan varchar(1) NO +exec_count bigint(20) unsigned NO NULL +err_count bigint(20) unsigned NO NULL +warn_count bigint(20) unsigned NO NULL +total_latency text YES NULL +max_latency text YES NULL +avg_latency text YES NULL +lock_latency text YES NULL +rows_sent bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) NO 0 +rows_examined bigint(20) unsigned NO NULL +rows_examined_avg decimal(21,0) NO 0 +rows_affected bigint(20) unsigned NO NULL +rows_affected_avg decimal(21,0) NO 0 +tmp_tables bigint(20) unsigned NO NULL +tmp_disk_tables bigint(20) unsigned NO NULL +rows_sorted bigint(20) unsigned NO NULL +sort_merge_passes bigint(20) unsigned NO NULL +digest varchar(32) YES NULL +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +SELECT * FROM sys.statement_analysis; +DESC sys.x$statement_analysis; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +full_scan varchar(1) NO +exec_count bigint(20) unsigned NO NULL +err_count bigint(20) unsigned NO NULL +warn_count bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +lock_latency bigint(20) unsigned NO NULL +rows_sent bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) NO 0 +rows_examined bigint(20) unsigned NO NULL +rows_examined_avg decimal(21,0) NO 0 +rows_affected bigint(20) unsigned NO NULL +rows_affected_avg decimal(21,0) NO 0 +tmp_tables bigint(20) unsigned NO NULL +tmp_disk_tables bigint(20) unsigned NO NULL +rows_sorted bigint(20) unsigned NO NULL +sort_merge_passes bigint(20) unsigned NO NULL +digest varchar(32) YES NULL +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +SELECT * FROM sys.x$statement_analysis; diff --git a/mysql-test/suite/sysschema/r/v_statements_with_errors_or_warnings.result b/mysql-test/suite/sysschema/r/v_statements_with_errors_or_warnings.result new file mode 100644 index 00000000..250f4ec1 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statements_with_errors_or_warnings.result @@ -0,0 +1,26 @@ +DESC sys.statements_with_errors_or_warnings; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +errors bigint(20) unsigned NO NULL +error_pct decimal(27,4) NO 0.0000 +warnings bigint(20) unsigned NO NULL +warning_pct decimal(27,4) NO 0.0000 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.statements_with_errors_or_warnings; +DESC sys.x$statements_with_errors_or_warnings; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +errors bigint(20) unsigned NO NULL +error_pct decimal(27,4) NO 0.0000 +warnings bigint(20) unsigned NO NULL +warning_pct decimal(27,4) NO 0.0000 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.x$statements_with_errors_or_warnings; diff --git a/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result b/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result new file mode 100644 index 00000000..a762cfd7 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result @@ -0,0 +1,69 @@ +DESC sys.statements_with_full_table_scans; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency text YES NULL +no_index_used_count bigint(20) unsigned NO NULL +no_good_index_used_count bigint(20) unsigned NO NULL +no_index_used_pct decimal(24,0) NO 0 +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) unsigned YES NULL +rows_examined_avg decimal(21,0) unsigned YES NULL +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.statements_with_full_table_scans; +DESC sys.x$statements_with_full_table_scans; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +no_index_used_count bigint(20) unsigned NO NULL +no_good_index_used_count bigint(20) unsigned NO NULL +no_index_used_pct decimal(24,0) NO 0 +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) unsigned YES NULL +rows_examined_avg decimal(21,0) unsigned YES NULL +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.x$statements_with_full_table_scans; +CREATE DATABASE v_statements_with_full_table_scans; +CREATE TABLE v_statements_with_full_table_scans.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb; +INSERT INTO v_statements_with_full_table_scans.t (j) VALUES (1), (2), (3); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); +CALL sys.ps_truncate_all_tables(false); +summary +Truncated 44 tables +SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12; +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 768 +SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12; +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 1536 +SELECT * FROM v_statements_with_full_table_scans.t WHERE i = 10; +i j +10 4 +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; +db query rows_examined +test SELECT `i` , `j` , `RAND` ( ) FROM `v_statements_with_full_table_scans` . `t` WHERE `j` = ? 1536 +DROP DATABASE v_statements_with_full_table_scans; diff --git a/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result b/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result new file mode 100644 index 00000000..5cc05f27 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result @@ -0,0 +1,38 @@ +DESC sys.statements_with_runtimes_in_95th_percentile; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +full_scan varchar(1) NO +exec_count bigint(20) unsigned NO NULL +err_count bigint(20) unsigned NO NULL +warn_count bigint(20) unsigned NO NULL +total_latency text YES NULL +max_latency text YES NULL +avg_latency text YES NULL +rows_sent bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) NO 0 +rows_examined bigint(20) unsigned NO NULL +rows_examined_avg decimal(21,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.statements_with_runtimes_in_95th_percentile; +DESC sys.x$statements_with_runtimes_in_95th_percentile; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +full_scan varchar(1) NO +exec_count bigint(20) unsigned NO NULL +err_count bigint(20) unsigned NO NULL +warn_count bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +rows_sent bigint(20) unsigned NO NULL +rows_sent_avg decimal(21,0) NO 0 +rows_examined bigint(20) unsigned NO NULL +rows_examined_avg decimal(21,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.x$statements_with_runtimes_in_95th_percentile; diff --git a/mysql-test/suite/sysschema/r/v_statements_with_sorting.result b/mysql-test/suite/sysschema/r/v_statements_with_sorting.result new file mode 100644 index 00000000..034987b8 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statements_with_sorting.result @@ -0,0 +1,32 @@ +DESC sys.statements_with_sorting; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency text YES NULL +sort_merge_passes bigint(20) unsigned NO NULL +avg_sort_merges decimal(21,0) NO 0 +sorts_using_scans bigint(20) unsigned NO NULL +sort_using_range bigint(20) unsigned NO NULL +rows_sorted bigint(20) unsigned NO NULL +avg_rows_sorted decimal(21,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.statements_with_sorting; +DESC sys.x$statements_with_sorting; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +sort_merge_passes bigint(20) unsigned NO NULL +avg_sort_merges decimal(21,0) NO 0 +sorts_using_scans bigint(20) unsigned NO NULL +sort_using_range bigint(20) unsigned NO NULL +rows_sorted bigint(20) unsigned NO NULL +avg_rows_sorted decimal(21,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.x$statements_with_sorting; diff --git a/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result b/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result new file mode 100644 index 00000000..52683a56 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result @@ -0,0 +1,28 @@ +DESC sys.statements_with_temp_tables; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency text YES NULL +memory_tmp_tables bigint(20) unsigned NO NULL +disk_tmp_tables bigint(20) unsigned NO NULL +avg_tmp_tables_per_query decimal(21,0) NO 0 +tmp_tables_to_disk_pct decimal(24,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.statements_with_temp_tables; +DESC sys.x$statements_with_temp_tables; +Field Type Null Key Default Extra +query longtext YES NULL +db varchar(64) YES NULL +exec_count bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +memory_tmp_tables bigint(20) unsigned NO NULL +disk_tmp_tables bigint(20) unsigned NO NULL +avg_tmp_tables_per_query decimal(21,0) NO 0 +tmp_tables_to_disk_pct decimal(24,0) NO 0 +first_seen timestamp NO 0000-00-00 00:00:00 +last_seen timestamp NO 0000-00-00 00:00:00 +digest varchar(32) YES NULL +SELECT * FROM sys.x$statements_with_temp_tables; diff --git a/mysql-test/suite/sysschema/r/v_user_summary.result b/mysql-test/suite/sysschema/r/v_user_summary.result new file mode 100644 index 00000000..233fcccc --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary.result @@ -0,0 +1,30 @@ +DESC sys.user_summary; +Field Type Null Key Default Extra +user varchar(128) YES NULL +statements decimal(64,0) YES NULL +statement_latency text YES NULL +statement_avg_latency text YES NULL +table_scans decimal(65,0) YES NULL +file_ios decimal(64,0) YES NULL +file_io_latency text YES NULL +current_connections decimal(41,0) YES NULL +total_connections decimal(41,0) YES NULL +unique_hosts bigint(21) NO 0 +current_memory text YES NULL +total_memory_allocated text YES NULL +SELECT * FROM sys.user_summary; +DESC sys.x$user_summary; +Field Type Null Key Default Extra +user varchar(128) YES NULL +statements decimal(64,0) YES NULL +statement_latency decimal(64,0) YES NULL +statement_avg_latency decimal(65,4) NO 0.0000 +table_scans decimal(65,0) YES NULL +file_ios decimal(64,0) YES NULL +file_io_latency decimal(64,0) YES NULL +current_connections decimal(41,0) YES NULL +total_connections decimal(41,0) YES NULL +unique_hosts bigint(21) NO 0 +current_memory decimal(63,0) YES NULL +total_memory_allocated decimal(64,0) YES NULL +SELECT * FROM sys.x$user_summary; diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result new file mode 100644 index 00000000..f6f106a5 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result @@ -0,0 +1,12 @@ +DESC sys.user_summary_by_file_io; +Field Type Null Key Default Extra +user varchar(128) YES NULL +ios decimal(42,0) YES NULL +io_latency text YES NULL +SELECT * FROM sys.user_summary_by_file_io; +DESC sys.x$user_summary_by_file_io; +Field Type Null Key Default Extra +user varchar(128) YES NULL +ios decimal(42,0) YES NULL +io_latency decimal(42,0) YES NULL +SELECT * FROM sys.x$user_summary_by_file_io; diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result new file mode 100644 index 00000000..c143697c --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result @@ -0,0 +1,16 @@ +DESC sys.user_summary_by_file_io_type; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.user_summary_by_file_io_type; +DESC sys.x$user_summary_by_file_io_type; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$user_summary_by_file_io_type; diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result b/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result new file mode 100644 index 00000000..9b90fe9c --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result @@ -0,0 +1,16 @@ +DESC sys.user_summary_by_stages; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +SELECT * FROM sys.user_summary_by_stages; +DESC sys.x$user_summary_by_stages; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event_name varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$user_summary_by_stages; diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result new file mode 100644 index 00000000..36dadc29 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result @@ -0,0 +1,24 @@ +DESC sys.user_summary_by_statement_latency; +Field Type Null Key Default Extra +user varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency text YES NULL +max_latency text YES NULL +lock_latency text YES NULL +rows_sent decimal(42,0) YES NULL +rows_examined decimal(42,0) YES NULL +rows_affected decimal(42,0) YES NULL +full_scans decimal(43,0) YES NULL +SELECT * FROM sys.user_summary_by_statement_latency; +DESC sys.x$user_summary_by_statement_latency; +Field Type Null Key Default Extra +user varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency decimal(42,0) YES NULL +max_latency decimal(42,0) YES NULL +lock_latency decimal(42,0) YES NULL +rows_sent decimal(42,0) YES NULL +rows_examined decimal(42,0) YES NULL +rows_affected decimal(42,0) YES NULL +full_scans decimal(43,0) YES NULL +SELECT * FROM sys.x$user_summary_by_statement_latency; diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result new file mode 100644 index 00000000..bd006c87 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result @@ -0,0 +1,26 @@ +DESC sys.user_summary_by_statement_type; +Field Type Null Key Default Extra +user varchar(128) YES NULL +statement varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +max_latency text YES NULL +lock_latency text YES NULL +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_affected bigint(20) unsigned NO NULL +full_scans bigint(21) unsigned NO 0 +SELECT * FROM sys.user_summary_by_statement_type; +DESC sys.x$user_summary_by_statement_type; +Field Type Null Key Default Extra +user varchar(128) YES NULL +statement varchar(128) YES NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +lock_latency bigint(20) unsigned NO NULL +rows_sent bigint(20) unsigned NO NULL +rows_examined bigint(20) unsigned NO NULL +rows_affected bigint(20) unsigned NO NULL +full_scans bigint(21) unsigned NO 0 +SELECT * FROM sys.x$user_summary_by_statement_type; diff --git a/mysql-test/suite/sysschema/r/v_version.result b/mysql-test/suite/sysschema/r/v_version.result new file mode 100644 index 00000000..ac914fc8 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_version.result @@ -0,0 +1,3 @@ +SELECT sys_version FROM sys.version; +sys_version +1.5.1 diff --git a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result new file mode 100644 index 00000000..f6559cb7 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result @@ -0,0 +1,18 @@ +DESC sys.wait_classes_global_by_avg_latency; +Field Type Null Key Default Extra +event_class varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency text YES NULL +min_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.wait_classes_global_by_avg_latency; +DESC sys.x$wait_classes_global_by_avg_latency; +Field Type Null Key Default Extra +event_class varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency decimal(42,0) YES NULL +min_latency bigint(20) unsigned YES NULL +avg_latency decimal(46,4) NO 0.0000 +max_latency bigint(20) unsigned YES NULL +SELECT * FROM sys.x$wait_classes_global_by_avg_latency; diff --git a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result new file mode 100644 index 00000000..10db5ead --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result @@ -0,0 +1,18 @@ +DESC sys.wait_classes_global_by_latency; +Field Type Null Key Default Extra +event_class varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency text YES NULL +min_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.wait_classes_global_by_latency; +DESC sys.x$wait_classes_global_by_latency; +Field Type Null Key Default Extra +event_class varchar(128) YES NULL +total decimal(42,0) YES NULL +total_latency decimal(42,0) YES NULL +min_latency bigint(20) unsigned YES NULL +avg_latency decimal(46,4) NO 0.0000 +max_latency bigint(20) unsigned YES NULL +SELECT * FROM sys.x$wait_classes_global_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result new file mode 100644 index 00000000..5e595d9c --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result @@ -0,0 +1,18 @@ +DESC sys.waits_by_host_by_latency; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.waits_by_host_by_latency; +DESC sys.x$waits_by_host_by_latency; +Field Type Null Key Default Extra +host varchar(255) YES NULL +event varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$waits_by_host_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result new file mode 100644 index 00000000..860db68c --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result @@ -0,0 +1,18 @@ +DESC sys.waits_by_user_by_latency; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.waits_by_user_by_latency; +DESC sys.x$waits_by_user_by_latency; +Field Type Null Key Default Extra +user varchar(128) YES NULL +event varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$waits_by_user_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result new file mode 100644 index 00000000..1e32a9b8 --- /dev/null +++ b/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result @@ -0,0 +1,16 @@ +DESC sys.waits_global_by_latency; +Field Type Null Key Default Extra +events varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency text YES NULL +avg_latency text YES NULL +max_latency text YES NULL +SELECT * FROM sys.waits_global_by_latency; +DESC sys.x$waits_global_by_latency; +Field Type Null Key Default Extra +events varchar(128) NO NULL +total bigint(20) unsigned NO NULL +total_latency bigint(20) unsigned NO NULL +avg_latency bigint(20) unsigned NO NULL +max_latency bigint(20) unsigned NO NULL +SELECT * FROM sys.x$waits_global_by_latency; diff --git a/mysql-test/suite/sysschema/r/version_functions.result b/mysql-test/suite/sysschema/r/version_functions.result new file mode 100644 index 00000000..57082ebc --- /dev/null +++ b/mysql-test/suite/sysschema/r/version_functions.result @@ -0,0 +1,6 @@ +SELECT sys.version_major(); +SELECT sys.version_minor(); +SELECT sys.version_patch(); +SELECT @my_version = SUBSTRING(VERSION(), 1, CHAR_LENGTH(@my_version)); +@my_version = SUBSTRING(VERSION(), 1, CHAR_LENGTH(@my_version)) +1 diff --git a/mysql-test/suite/sysschema/suite.opt b/mysql-test/suite/sysschema/suite.opt new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/mysql-test/suite/sysschema/suite.opt @@ -0,0 +1,2 @@ + + diff --git a/mysql-test/suite/sysschema/suite.pm b/mysql-test/suite/sysschema/suite.pm new file mode 100644 index 00000000..679362b3 --- /dev/null +++ b/mysql-test/suite/sysschema/suite.pm @@ -0,0 +1,8 @@ +package My::Suite::Sysschema; + +@ISA = qw(My::Suite); + +use strict; + +return "Need perfschema engine" unless exists($::mysqld_variables{'performance-schema'}) ; +bless { }; diff --git a/mysql-test/suite/sysschema/t/all_sys_objects_exist.test b/mysql-test/suite/sysschema/t/all_sys_objects_exist.test new file mode 100644 index 00000000..f4c8ee36 --- /dev/null +++ b/mysql-test/suite/sysschema/t/all_sys_objects_exist.test @@ -0,0 +1,16 @@ +-- source include/not_embedded.inc +# Ensure database exists +USE sys; + +# Ensure all views are created +SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sys' ORDER BY TABLE_NAME; + +# Ensure all functions and routines are created +SELECT ROUTINE_NAME, ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'sys' ORDER BY ROUTINE_TYPE, ROUTINE_NAME; + +# Ensure all triggers are created +SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA = 'sys' ORDER BY TRIGGER_NAME; + +# Check the version of the schema (and ensure no updates slip in undetected) +SELECT sys_version FROM sys.version; + diff --git a/mysql-test/suite/sysschema/t/fn_extract_schema_from_file_name.test b/mysql-test/suite/sysschema/t/fn_extract_schema_from_file_name.test new file mode 100644 index 00000000..f3051947 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_extract_schema_from_file_name.test @@ -0,0 +1,9 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.extract_schema_from_file_name() function perfoms as expected + +# Passing NULL should return NULL +SELECT sys.extract_schema_from_file_name(NULL); + +# Ensure the right part of the path is extracted +SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); diff --git a/mysql-test/suite/sysschema/t/fn_extract_table_from_file_name.test b/mysql-test/suite/sysschema/t/fn_extract_table_from_file_name.test new file mode 100644 index 00000000..6e459174 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_extract_table_from_file_name.test @@ -0,0 +1,9 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.extract_table_from_file_name() function perfoms as expected + +# Passing NULL should return NULL +SELECT sys.extract_table_from_file_name(NULL); + +# Ensure the right part of the path is extracted +SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); diff --git a/mysql-test/suite/sysschema/t/fn_format_bytes.test b/mysql-test/suite/sysschema/t/fn_format_bytes.test new file mode 100644 index 00000000..418c85c7 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_format_bytes.test @@ -0,0 +1,30 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.format_bytes() function perfoms as expected + +# Passing NULL/nothing should return NULL +SELECT sys.format_bytes(NULL); + +# Format bytes +SELECT sys.format_bytes(1); +SELECT sys.format_bytes(1023); + +# Format kilobytes +SELECT sys.format_bytes(1024); +SELECT sys.format_bytes(1048575); + +# Format megabytes +SELECT sys.format_bytes(1048576); +SELECT sys.format_bytes(1073741823); + +# Format gigabytes +SELECT sys.format_bytes(1073741824); +SELECT sys.format_bytes(1099511627775); + +# Format terabytes +SELECT sys.format_bytes(1099511627776); +SELECT sys.format_bytes(1125899906842623); + +# Formate petabytes +SELECT sys.format_bytes(1125899906842624); +SELECT sys.format_bytes(1125899906842624238947293); diff --git a/mysql-test/suite/sysschema/t/fn_format_path.test b/mysql-test/suite/sysschema/t/fn_format_path.test new file mode 100644 index 00000000..24f78f76 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_format_path.test @@ -0,0 +1,17 @@ +-- source include/not_embedded.inc +-- source include/not_windows.inc + + +# Passing NULL should return NULL +SELECT sys.format_path(NULL); +# Ensure datadir is recognized and stripped +SET @mypath := CONCAT(@@global.datadir, 'foo/bar.foo'); + +SELECT sys.format_path(@mypath); + +# Ensure tmpdir is recognized and stripped +SET @mypath := CONCAT(@@global.tmpdir, '/foo/bar.foo'); +SELECT sys.format_path(@mypath); + +# Unrecognized paths should return the full path +SELECT sys.format_path('/foo/bar/baz.foo'); diff --git a/mysql-test/suite/sysschema/t/fn_format_statement.test b/mysql-test/suite/sysschema/t/fn_format_statement.test new file mode 100644 index 00000000..a4cffef0 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_format_statement.test @@ -0,0 +1,13 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.format_statement() function perfoms as expected + +# Passing NULL should return NULL +SELECT sys.format_statement(NULL); + +# Ensure long statements are truncated correctly +SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement; + +# Increase truncation limit and test that it takes effect +SET @sys.statement_truncate_len = 80; +SELECT sys.format_statement('SELECT foo, bar, baz, foobar, foobaz FROM foo JOIN bar USING (foobar) JOIN baz USING (foobar) WHERE foo = \'foo\' AND bar = \'bar\'') AS statement; diff --git a/mysql-test/suite/sysschema/t/fn_format_time.test b/mysql-test/suite/sysschema/t/fn_format_time.test new file mode 100644 index 00000000..9973443e --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_format_time.test @@ -0,0 +1,42 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.format_time() function perfoms as expected + +# Passing NULL should return NULL +SELECT sys.format_time(NULL); + +# Format picoseconds +SELECT sys.format_time(1); +SELECT sys.format_time(999); + +# Format nanoseconds +SELECT sys.format_time(1000); +SELECT sys.format_time(999999); + +# Format microseconds +SELECT sys.format_time(1000000); +SELECT sys.format_time(999999999); + +# Format milliseconds +SELECT sys.format_time(1000000000); +SELECT sys.format_time(999999999999); + +# Format seconds +SELECT sys.format_time(1000000000000); +SELECT sys.format_time(59999999999999); + +# Format minutes +SELECT sys.format_time(60000000000000); +SELECT sys.format_time(3599999999999999); + +# Format hours +SELECT sys.format_time(3600000000000000); +SELECT sys.format_time(86399999999999988); + +# Format days +SELECT sys.format_time(86400000000000000); +SELECT sys.format_time(604799999999999888); + +# Format weeks +SELECT sys.format_time(604800000000000000); +SELECT sys.format_time(2389472398472389748237429837423984728374); diff --git a/mysql-test/suite/sysschema/t/fn_list_add.test b/mysql-test/suite/sysschema/t/fn_list_add.test new file mode 100644 index 00000000..d2e479ed --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_list_add.test @@ -0,0 +1,39 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.list_add() function perfoms as expected + +# Should init with a single value +SELECT sys.list_add(NULL, 'foo'); + +# Should init with a single value +SELECT sys.list_add('', 'foo'); + +# Should add to the list with a comma +SELECT sys.list_add('bar', 'foo'); + +# Should add to the list with a single comma +SELECT sys.list_add('bar, ', 'foo'); + +# Should return an error with a NULL value to add +--error 1138 +SELECT sys.list_add('foo', NULL); + +# Test the sql mode update use case +# save old mode to restore +SET @sqlmode := @@sql_mode; + +SELECT @@sql_mode; + +SET SESSION sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); + +SELECT @@sql_mode; + +# restore old mode +SET SESSION sql_mode = @sqlmode; +SET @sqlmode := NULL; + +# Check too large a value +SET @input := REPEAT('a', 4194304); +-- error 1406 +SELECT sys.list_add(@input, 'foo'); +SET @input := NULL; diff --git a/mysql-test/suite/sysschema/t/fn_list_drop.test b/mysql-test/suite/sysschema/t/fn_list_drop.test new file mode 100644 index 00000000..f7b0d16b --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_list_drop.test @@ -0,0 +1,35 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.sql_mode_drop() function perfoms as expected + +# Remove from front of list +SELECT sys.list_drop('1,2,3,4,5', '1'); + +# Remove from middle of list +SELECT sys.list_drop('1,2,3,4,5', '3'); + +# Remove from end of list +SELECT sys.list_drop('1,2,3,4,5', '5'); + +# Make sure spaces are appropriately dealt with +SELECT sys.list_drop('1, 2, 3, 4, 5', '1'); +SELECT sys.list_drop('1, 2, 3, 4, 5', '3'); +SELECT sys.list_drop('1, 2, 3, 4, 5', '5'); + +# Should return an error with a NULL value to drop +--error 1138 +SELECT sys.list_drop('1,2,3,4,5', NULL); + +# Test the sql mode update use case +# save old mode to restore +SET @sqlmode := @@sql_mode; + +SELECT @@sql_mode; + +SET SESSION sql_mode = sys.list_drop(@@sql_mode, 'STRICT_TRANS_TABLES'); + +SELECT @@sql_mode; + +# restore old mode +SET SESSION sql_mode = @sqlmode; +SET @sqlmode := NULL; diff --git a/mysql-test/suite/sysschema/t/fn_ps_is_account_enabled.test b/mysql-test/suite/sysschema/t/fn_ps_is_account_enabled.test new file mode 100644 index 00000000..c3bc7a25 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_is_account_enabled.test @@ -0,0 +1,20 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_is_account_enabled() function perfoms as expected + +# First test with the default "all enabled" for any random user +SELECT sys.ps_is_account_enabled('foo', 'bar'); + +# Now remove the wild card entry, and add some specific users to testx +DELETE FROM performance_schema.setup_actors; + +INSERT INTO performance_schema.setup_actors VALUES + ('test', 'test', '%', 'YES', 'NO'); + +# Now the random account should not be enabled +SELECT sys.ps_is_account_enabled('foo', 'bar'); + +# But the specified one should +SELECT sys.ps_is_account_enabled('test', 'test'); + +--source ../include/ps_setup_actors_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/fn_ps_is_consumer_enabled.test b/mysql-test/suite/sysschema/t/fn_ps_is_consumer_enabled.test new file mode 100644 index 00000000..e6e5fac0 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_is_consumer_enabled.test @@ -0,0 +1,39 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_is_consumer_enabled() function perfoms as expected + +# Should be disabled by default +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_history'; +SELECT sys.ps_is_consumer_enabled('events_stages_history'); + +# Should be enabled by default +SELECT sys.ps_is_consumer_enabled('global_instrumentation'); + +# +# Check that hierarchy is properly reflected +# + +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'events_stages_current'; +UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_history'; + +# Should still be disabled, as events_stages_current not enabled +SELECT sys.ps_is_consumer_enabled('events_stages_history'); + +UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name = 'events_stages_current'; + +# Now it should be enabled +SELECT sys.ps_is_consumer_enabled('events_stages_history'); + +# Toggling global_instrumentation should disable all other consumers +UPDATE performance_schema.setup_consumers SET enabled = 'NO' WHERE name = 'global_instrumentation'; + +SELECT sys.ps_is_consumer_enabled('thread_instrumentation'); +SELECT sys.ps_is_consumer_enabled('statements_digest'); +SELECT sys.ps_is_consumer_enabled('events_stages_current'); +SELECT sys.ps_is_consumer_enabled('events_stages_history'); +SELECT sys.ps_is_consumer_enabled('events_stages_history_long'); +SELECT sys.ps_is_consumer_enabled('events_statements_current'); +SELECT sys.ps_is_consumer_enabled('events_statements_history'); +SELECT sys.ps_is_consumer_enabled('events_statements_history_long'); + +--source ../include/ps_setup_consumers_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_enabled.test b/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_enabled.test new file mode 100644 index 00000000..a3eb67f1 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_enabled.test @@ -0,0 +1,23 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_is_instrument_default_enabled() function perfoms as expected + +# Should all be enabled +SELECT sys.ps_is_instrument_default_enabled('memory/performance_schema/internal_buffers'); +SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +SELECT sys.ps_is_instrument_default_enabled('statement/sp/error'); +SELECT sys.ps_is_instrument_default_enabled('statement/com/Prepare'); +SELECT sys.ps_is_instrument_default_enabled('wait/io/file/sql/binlog'); +SELECT sys.ps_is_instrument_default_enabled('wait/io/table/sql/handler'); +SELECT sys.ps_is_instrument_default_enabled('wait/lock/table/sql/handler'); +SELECT sys.ps_is_instrument_default_enabled('idle'); + +# Should all be disabled +SELECT sys.ps_is_instrument_default_enabled('wait/synch/mutex/sql/LOCK_plugin'); +SELECT sys.ps_is_instrument_default_enabled('wait/synch/rwlock/sql/LOCK_grant'); +SELECT sys.ps_is_instrument_default_enabled('wait/synch/sxlock/innodb/btr_search_latch'); +SELECT sys.ps_is_instrument_default_enabled('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond'); +SELECT sys.ps_is_instrument_default_enabled('stage/sql/end'); +SELECT sys.ps_is_instrument_default_enabled('transaction'); +SELECT sys.ps_is_instrument_default_enabled('wait/io/socket/sql/server_tcpip_socket'); +SELECT sys.ps_is_instrument_default_enabled('wait/lock/metadata/sql/mdl'); diff --git a/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_timed.test b/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_timed.test new file mode 100644 index 00000000..1d53a96f --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_is_instrument_default_timed.test @@ -0,0 +1,23 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_is_instrument_default_timed() function perfoms as expected + +# Should all be enabled +SELECT sys.ps_is_instrument_default_timed('wait/io/file/sql/binlog'); +SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +SELECT sys.ps_is_instrument_default_timed('statement/sp/error'); +SELECT sys.ps_is_instrument_default_timed('statement/com/Prepare'); +SELECT sys.ps_is_instrument_default_timed('wait/io/table/sql/handler'); +SELECT sys.ps_is_instrument_default_timed('wait/lock/table/sql/handler'); +SELECT sys.ps_is_instrument_default_timed('idle'); + +# Should all be disabled +SELECT sys.ps_is_instrument_default_timed('wait/synch/mutex/sql/LOCK_plugin'); +SELECT sys.ps_is_instrument_default_timed('wait/synch/rwlock/sql/LOCK_grant'); +SELECT sys.ps_is_instrument_default_timed('wait/synch/sxlock/innodb/btr_search_latch'); +SELECT sys.ps_is_instrument_default_timed('wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond'); +SELECT sys.ps_is_instrument_default_timed('stage/sql/end'); +SELECT sys.ps_is_instrument_default_timed('transaction'); +SELECT sys.ps_is_instrument_default_timed('wait/io/socket/sql/server_tcpip_socket'); +SELECT sys.ps_is_instrument_default_timed('memory/performance_schema/internal_buffers'); +SELECT sys.ps_is_instrument_default_timed('wait/lock/metadata/sql/mdl'); diff --git a/mysql-test/suite/sysschema/t/fn_ps_is_thread_instrumented.test b/mysql-test/suite/sysschema/t/fn_ps_is_thread_instrumented.test new file mode 100644 index 00000000..0ee9bb50 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_is_thread_instrumented.test @@ -0,0 +1,18 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_is_thread_instrumented() function perfoms as expected + +# Passing NULL/nothing should return NULL +SELECT sys.ps_is_thread_instrumented(NULL); + +# By default current thread should be instrumented +SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); + +# Now toggle our thread to off and re-check +UPDATE performance_schema.threads SET instrumented = 'NO' WHERE processlist_id = CONNECTION_ID(); +SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); + +# Try some huge number to check unknown connections +SELECT sys.ps_is_thread_instrumented(234623462376); + +--source ../include/ps_threads_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/fn_ps_thread_account.test b/mysql-test/suite/sysschema/t/fn_ps_thread_account.test new file mode 100644 index 00000000..77b6241a --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_thread_account.test @@ -0,0 +1,11 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_thread_account() function perfoms as expected + +# Passing NULL, or an unknown connection id, should return NULL +SELECT sys.ps_thread_account(NULL); +SELECT sys.ps_thread_account(234623462376); + + +# Check result +SELECT sys.ps_thread_account(sys.ps_thread_id(NULL)); diff --git a/mysql-test/suite/sysschema/t/fn_ps_thread_id.test b/mysql-test/suite/sysschema/t/fn_ps_thread_id.test new file mode 100644 index 00000000..ca8b4fb4 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_thread_id.test @@ -0,0 +1,18 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.ps_thread_id() function perfoms as expected + +# Passing unknown connection id should return NULL +SELECT sys.ps_thread_id(234623462376); + +# Grab the thread_id for this connection directly from Performance Schema +let $MY_THREAD_ID=`SELECT thread_id FROM performance_schema.threads + WHERE PROCESSLIST_ID = connection_id()`; + +--disable_query_log ONCE +eval SET @ps_thread_id = $MY_THREAD_ID; + +SELECT sys.ps_thread_id(CONNECTION_ID()) = @ps_thread_id; + +# Passing NULL should also return the current connection thread id +SELECT sys.ps_thread_id(NULL) = @ps_thread_id; diff --git a/mysql-test/suite/sysschema/t/fn_ps_thread_trx_info.test b/mysql-test/suite/sysschema/t/fn_ps_thread_trx_info.test new file mode 100644 index 00000000..ddf46247 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_ps_thread_trx_info.test @@ -0,0 +1,91 @@ +# Tests for sys schema +# Verify the sys.ps_thread_trx_info() function perfoms as expected + +-- source include/not_embedded.inc +# Performance schema tracks prepared statements separately, and does not +# yet have a summary view that we can use for this view. +# Until then, we disable this test with --ps-protocol +-- source include/no_protocol.inc + +# Passing unknown connection id should return NULL +SELECT sys.ps_thread_trx_info(234623462376); + +# Make sure current thread returns a valid JSON object +SELECT JSON_VALID(sys.ps_thread_trx_info(sys.ps_thread_id(NULL))); + +# Dummy up some transactions and inspect +CREATE DATABASE trx; +CREATE TABLE trx.info (id INT PRIMARY KEY, info VARCHAR(20)); + +--connect(con1,localhost,root,,) +connection con1; +let $NEW_TRX_ID=`SELECT thread_id FROM performance_schema.threads + WHERE PROCESSLIST_ID = connection_id()`; + +USE trx; +START TRANSACTION; +INSERT INTO info VALUES (1, 'foo'); +COMMIT; +START TRANSACTION; +INSERT INTO info VALUES (2, 'bar'); +COMMIT; + +connection default; +--disable_query_log ONCE +eval SET @ps_thread_id = $NEW_TRX_ID; + +# Get the JSON dump of the transaction info +SET @json_doc := sys.ps_thread_trx_info(@ps_thread_id); + +# JSON should be valid +SELECT JSON_VALID(@json_doc); + +# Should have two transactions in the array +SELECT JSON_LENGTH(@json_doc); + +# Expected keys are returned for first transaction details +SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0]')); + +# Expected values are returned for the transaction details +SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].time'); +SELECT JSON_CONTAINS(@json_doc, '"COMMITTED"', '$[0].state'); +SELECT JSON_CONTAINS(@json_doc, '"READ WRITE"', '$[0].mode'); +SELECT JSON_CONTAINS(@json_doc, '"NO"', '$[0].autocommitted'); +SELECT JSON_CONTAINS(@json_doc, '"AUTOMATIC"', '$[0].gtid'); +SELECT JSON_CONTAINS(@json_doc, '"REPEATABLE READ"', '$[0].isolation'); + +# Expected keys are returned for first transaction statements_executed details +SELECT JSON_KEYS(JSON_EXTRACT(@json_doc, '$[0].statements_executed[0]')); + +# Confirm statement details values +SELECT JSON_CONTAINS_PATH(@json_doc, 'one', '$[0].statements_executed[0].time'); +SELECT JSON_CONTAINS(@json_doc, '"INSERT INTO info VALUES (1, \'foo\')"', '$[0].statements_executed[0].sql_text'); +SELECT JSON_CONTAINS(@json_doc, '"trx"', '$[0].statements_executed[0].schema'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_examined'); +SELECT JSON_CONTAINS(@json_doc, '1', '$[0].statements_executed[0].rows_affected'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].rows_sent'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_tables'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].tmp_disk_tables'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_rows'); +SELECT JSON_CONTAINS(@json_doc, '0', '$[0].statements_executed[0].sort_merge_passes'); + +# Second statement in transaction should be a COMMIT +SELECT JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_text'); + +# Simulate a truncated set of output by lowering the @sys.ps_thread_trx_info.max_length user variable +# This also tests the user variable works appropriately, incidentally + +SET @sys.ps_thread_trx_info.max_length = 100; + +# Should return an error JSON object +--replace_regex /Row 1[1-2] was/Row 1X was/ +SELECT sys.ps_thread_trx_info(@ps_thread_id); + +# Setting the user variable back to NULL should reset to 65535 from sys_config, and no truncation +SET @sys.ps_thread_trx_info.max_length = NULL; +SELECT JSON_VALID(sys.ps_thread_trx_info(@ps_thread_id)); + +# Clean up + +disconnect con1; +DROP DATABASE trx; diff --git a/mysql-test/suite/sysschema/t/fn_quote_identifier.test b/mysql-test/suite/sysschema/t/fn_quote_identifier.test new file mode 100644 index 00000000..0beb7fb2 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_quote_identifier.test @@ -0,0 +1,25 @@ +########### suite/sysschema/t/fn_quote_identifier.test ############# +# # +# Testing of of the sys.quote_identifier() function # +# # +# Creation: # +# 2016-05-23 jkrogh Implement this test as part of bug 22011361 # +# # +#################################################################### + +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.quote_identifer() function perfoms as expected + +# Passing NULL should return NULL +SELECT sys.quote_identifier(NULL); + +# Passing a simple string +SELECT sys.quote_identifier('abc'); + +# Passing a string containing backticks (`) +SELECT sys.quote_identifier('ab`c'); +SELECT sys.quote_identifier('ab``c'); +SELECT sys.quote_identifier('ab```c'); +SELECT sys.quote_identifier('a`b`c'); +SELECT sys.quote_identifier('a`b``c'); diff --git a/mysql-test/suite/sysschema/t/fn_sys_get_config.test b/mysql-test/suite/sysschema/t/fn_sys_get_config.test new file mode 100644 index 00000000..1bdf87f1 --- /dev/null +++ b/mysql-test/suite/sysschema/t/fn_sys_get_config.test @@ -0,0 +1,13 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.sys_get_config() function perfoms as expected + +# Check a known parameter +SET @sys.statement_truncate_len := IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 128)); + +SELECT @sys.statement_truncate_len; + +# Check an unknown parameter +SET @sys.foo := IFNULL(@sys.foo, sys.sys_get_config('foo', 'foobar')); + +SELECT @sys.foo; diff --git a/mysql-test/suite/sysschema/t/mysqldump.test b/mysql-test/suite/sysschema/t/mysqldump.test new file mode 100644 index 00000000..35abc704 --- /dev/null +++ b/mysql-test/suite/sysschema/t/mysqldump.test @@ -0,0 +1,35 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc +# Dump all databases +--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug20902791.sql + +# Save a copy of the user/tables_priv, to restore later +# Otherwise the final mysql_upgrade will REPLACE and update timestamps etc. +CREATE TEMPORARY TABLE tmp_global_priv AS SELECT * FROM mysql.global_priv; +CREATE TEMPORARY TABLE tmp_tables_priv AS SELECT * FROM mysql.tables_priv; + +# Remove the sys schema +DROP DATABASE sys; + +# Reload the dump +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20902791.sql + +# The sys schema should not exist +SHOW DATABASES; + +# Finally reload the sys schema to return to normal +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 +SHOW DATABASES; + +# Restore the saved privileges +TRUNCATE TABLE mysql.global_priv; +INSERT INTO mysql.global_priv (SELECT * FROM tmp_global_priv); +DROP TEMPORARY TABLE tmp_global_priv; + +TRUNCATE TABLE mysql.tables_priv; +INSERT INTO mysql.tables_priv (SELECT * FROM tmp_tables_priv); +DROP TEMPORARY TABLE tmp_tables_priv; + +FLUSH PRIVILEGES; +--let $MYSQLD_DATADIR= `select @@datadir` +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info diff --git a/mysql-test/suite/sysschema/t/pr_create_synonym_db.test b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test new file mode 100644 index 00000000..30c6f502 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test @@ -0,0 +1,69 @@ +########### suite/sysschema/t/pr_create_synonym_db.test ############# +# # +# Testing of of the sys.pr_create_synonym_db() procedure # +# # +# Creation: # +# 2016-05-23 jkrogh Implement this test as part of bug 22011361 # +# # +##################################################################### + +-- source include/not_embedded.inc +# Create a couple of tables and a view +CREATE TABLE t1 (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TABLE t2 (t2_id int PRIMARY KEY, t1_id int, t2_val int, INDEX (t1_id)); +CREATE TABLE `is` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE SQL SECURITY INVOKER VIEW myview AS SELECT * FROM t1 NATURAL JOIN t2; + +# Make synonym db of test into test1 +CALL sys.create_synonym_db('test', 'test1'); +# Verify there's one view in test1 per table and view in test +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'test1' ORDER BY TABLE_NAME; +# Try again (should fail) +-- error ER_SIGNAL_EXCEPTION +CALL sys.create_synonym_db('test', 'test1'); + +# Try to make the synonym db for an existing empty schema +CREATE SCHEMA test2; +-- error ER_SIGNAL_EXCEPTION +CALL sys.create_synonym_db('test', 'test2'); +# Ensure test2 is still empty +SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test2'; + +# Use a reserved identifer, Bug #22011361 +CALL sys.create_synonym_db('test', 'is'); +# Verify there's one view in is per table and view in test +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'is' ORDER BY TABLE_NAME; + +# Copy the is schema to i`s schema: +CALL sys.create_synonym_db('is', 'i`s'); +# Verify there's one view in i`s per table and view in is +SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'i`s' ORDER BY TABLE_NAME; + +# Clean up +DROP SCHEMA test1; +DROP SCHEMA test2; +DROP SCHEMA `is`; +DROP SCHEMA `i``s`; +DROP VIEW test.myview; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP TABLE `is`; +DROP TABLE `ab``c`; + +--echo # +--echo # MDEV-28342: sys.create_synonym_db fails +--echo # when a temporary table masks a base table +--echo # + +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +--error ER_SIGNAL_EXCEPTION +call sys.create_synonym_db('db','db_copy'); + +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/sysschema/t/pr_diagnostics.test b/mysql-test/suite/sysschema/t/pr_diagnostics.test new file mode 100644 index 00000000..40ea9000 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_diagnostics.test @@ -0,0 +1,35 @@ +########### suite/sysschema/t/pr_diagnostics.test ############# +# # +# Testing of of the sys.diagnostics()) procedure # +# # +# Creation: # +# 2015-07-28 jkrogh Implement this test as part of # +# WL#7804 REPORT FOR SUPPORT # +# # +############################################################### + +-- source include/not_embedded.inc + +# Sanity check that the procedure completes two iterations with full debug, +# raw output, and Information Schema table outputs without generating +# any warnings. + +--disable_result_log +SET @sys.debug = 'ON', + @sys.diagnostics.allow_i_s_tables = 'ON', + @sys.diagnostics.include_raw = 'ON'; + +CALL sys.diagnostics(4, 2, 'full'); + +SET @sys.debug = 'OFF', + @sys.diagnostics.allow_i_s_tables = 'OFF', + @sys.diagnostics.include_raw = 'OFF'; +--enable_result_log + +# Check input variable validation +-- error S45000 +CALL sys.diagnostics(0, 0, 'full'); +-- error S45000 +CALL sys.diagnostics(2, 0, 'full'); +-- error S45000 +CALL sys.diagnostics(1, 2, 'full'); diff --git a/mysql-test/suite/sysschema/t/pr_execute_prepared_stmt.test b/mysql-test/suite/sysschema/t/pr_execute_prepared_stmt.test new file mode 100644 index 00000000..17a54aad --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_execute_prepared_stmt.test @@ -0,0 +1,25 @@ +-- source include/not_embedded.inc + +# Do some valid changes, ensure they are successful +SET @sql := "CREATE TABLE test.t1 (i INT) Engine=MEMORY"; +CALL sys.execute_prepared_stmt(@sql); + +SHOW CREATE TABLE test.t1; + +SET @sql := CONCAT('INSERT INTO test.t1 VALUES (', 1, ')'); +CALL sys.execute_prepared_stmt(@sql); + +SELECT * FROM test.t1; + +SET @sql := "DROP TABLE test.t1"; +CALL sys.execute_prepared_stmt(@sql); + +SHOW TABLES; + +SET @sql = NULL; + +# Invalid inputs +-- error S45000 +CALL sys.execute_prepared_stmt(NULL); +-- error S45000 +CALL sys.execute_prepared_stmt('foo'); diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_reset_to_default.test b/mysql-test/suite/sysschema/t/pr_ps_setup_reset_to_default.test new file mode 100644 index 00000000..1622957f --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_reset_to_default.test @@ -0,0 +1,15 @@ +########### suite/sysschema/t/pr_ps_setup_reset_to_default.test ############# +# # +# Testing of of the sys.ps_setup_reset_to_default() procedure # +# # +# Creation: # +# 2015-08-14 jkrogh Implement this test as part of Bug 21550271/Bug77927 # +# # +############################################################################# + +-- source include/not_embedded.inc + +# Currently just a sanity check +CALL sys.ps_setup_reset_to_default(TRUE); + +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled.test new file mode 100644 index 00000000..8d6f03fa --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled.test @@ -0,0 +1,37 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +# Add to users to the setup_actors table: one enabled, and one disabled +INSERT INTO performance_schema.setup_actors +VALUES ('localhost', 'foo', '%', 'YES', 'YES'), + ('localhost', 'bar', '%', 'NO', 'NO'); + +# Disable a few instruments +UPDATE performance_schema.setup_instruments + SET ENABLED = 'NO' + WHERE NAME LIKE 'stage/innodb/%' + OR NAME LIKE 'statement/com/%' + OR NAME = 'idle'; + +# Disable the history_long consumers: +UPDATE performance_schema.setup_consumers + SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; + +# Disable some of the background threads: +UPDATE performance_schema.threads SET INSTRUMENTED = 'NO' WHERE NAME LIKE 'thread/innodb/srv\_%'; + +# Show limited info (no thread or instrument info) +CALL sys.ps_setup_show_disabled(FALSE, FALSE); + +# Should show instrument data, but not thread info +CALL sys.ps_setup_show_disabled(TRUE, FALSE); + +# Should show thread info, but no instrument data +CALL sys.ps_setup_show_disabled(FALSE, TRUE); + +# Should show all info +CALL sys.ps_setup_show_disabled(TRUE, TRUE); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_consumers.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_consumers.test new file mode 100644 index 00000000..f362784b --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_consumers.test @@ -0,0 +1,11 @@ +-- source include/not_embedded.inc + +# Disable the history_long consumers: +UPDATE performance_schema.setup_consumers + SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; + +CALL sys.ps_setup_show_disabled_consumers(); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_instruments.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_instruments.test new file mode 100644 index 00000000..4ea78a15 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_disabled_instruments.test @@ -0,0 +1,14 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +# Disable a few instruments +UPDATE performance_schema.setup_instruments + SET ENABLED = 'NO' + WHERE NAME LIKE 'stage/innodb/%' + OR NAME LIKE 'statement/com/%' + OR NAME = 'idle'; + +CALL sys.ps_setup_show_disabled_instruments(); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test new file mode 100644 index 00000000..b8ef622b --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled.test @@ -0,0 +1,44 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +# Add to users to the setup_actors table: one enabled, and one disabled +INSERT INTO performance_schema.setup_actors +VALUES ('localhost', 'foo', '%', 'YES', 'YES'), + ('localhost', 'bar', '%', 'NO', 'NO'); + +# Disable all but a few instruments (reduces output as well) +# It is not possible to disable memory/performance_schema/% +# so don't even try. +UPDATE performance_schema.setup_instruments + SET ENABLED = 'NO' + WHERE NAME NOT LIKE 'memory/performance_schema/%' + AND NAME NOT LIKE 'stage/innodb/%' + AND NAME NOT LIKE 'statement/com/%' + AND NAME <> 'idle'; + +# Disable the history_long consumers: +UPDATE performance_schema.setup_consumers + SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; + +# Disable some of the background threads (including those that differ between unix like and Windows systems): +UPDATE performance_schema.threads + SET INSTRUMENTED = 'NO' + WHERE NAME LIKE 'thread/innodb/srv\_%' + OR NAME LIKE '%con\_%' + OR NAME LIKE '%signal_handler%'; + +# Show limited info (no thread or instrument info) +CALL sys.ps_setup_show_enabled(FALSE, FALSE); + +# Should show instrument data, but not thread info +CALL sys.ps_setup_show_enabled(TRUE, FALSE); + +# Should show thread info, but no instrument data +CALL sys.ps_setup_show_enabled(FALSE, TRUE); + +# Should show all info +CALL sys.ps_setup_show_enabled(TRUE, TRUE); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_consumers.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_consumers.test new file mode 100644 index 00000000..62b4d808 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_consumers.test @@ -0,0 +1,11 @@ +-- source include/not_embedded.inc + +# Disable the history_long consumers: +UPDATE performance_schema.setup_consumers + SET ENABLED = 'NO' + WHERE NAME LIKE '%\_history\_long'; + +CALL sys.ps_setup_show_enabled_consumers(); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_instruments.test b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_instruments.test new file mode 100644 index 00000000..507741f4 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_setup_show_enabled_instruments.test @@ -0,0 +1,18 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc + + +# Disable all but a few instruments (reduces output as well) +# It is not possible to disable memory/performance_schema/% +# so don't even try. +UPDATE performance_schema.setup_instruments + SET ENABLED = 'NO' + WHERE NAME NOT LIKE 'memory/performance_schema/%' + AND NAME NOT LIKE 'stage/innodb/%' + AND NAME NOT LIKE 'statement/com/%' + AND NAME <> 'idle'; + +CALL sys.ps_setup_show_enabled_instruments(); + +# Clean up +-- source ../include/ps_setup_reset_to_default_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_ps_trace_statement_digest.test b/mysql-test/suite/sysschema/t/pr_ps_trace_statement_digest.test new file mode 100644 index 00000000..a569210d --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_ps_trace_statement_digest.test @@ -0,0 +1,65 @@ +########### suite/sysschema/t/pr_ps_trace_statement_digest.test ############# +# # +# Testing of of the sys.ps_trace_statement_digest() procedure # +# # +# Creation: # +# 2016-06-21 jkrogh Implement this test as part of # +# Bug 23621189 PS_TRACE_STATEMENT_DIGEST FAILS AT EXPLAIN # +# # +############################################################################# + +-- source include/not_embedded.inc +# The ps_trace_statement_digest does not work with prepared statements +# So disable this test with --ps-protocol +-- source include/no_protocol.inc + +use test; + +# Get the thread id of this thread +# Store it in a user variable as otherwise repeated calls to sys.ps_thread_id() +# will keep changing performance_schema.events_statements_history +SET @threadid = sys.ps_thread_id(NULL); + +# Create a table +CREATE TABLE t1 (id INT PRIMARY KEY, val int) ENGINE=MEMORY; + +# Get digest of an INSERT statement with a qualified table name +INSERT INTO test.t1 VALUES (1, 9); +SET @digest.insert = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'INSERT INTO test.t1 VALUES (1, 9)'); + +# Get digest of an SELECT statement using the default schema +SELECT * FROM t1; +SET @digest.select = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SELECT * FROM t1'); + +# Get digets of a SHOW statement (doesn't support EXPLAIN) +SHOW CREATE TABLE test.t1; +SET @digest.show = (SELECT DIGEST FROM performance_schema.events_statements_history WHERE THREAD_ID = @threadid AND SQL_TEXT LIKE 'SHOW CREATE TABLE test.t1'); + +# Don't execute ps_trace_statement_digest() in the same schema as the queries +# to monitor - to ensure we handle queries using the default schema. +CREATE SCHEMA test_sys; +use test_sys; + +# Only do sanity checks - no error should occur, but the actual output is non-deterministic +--disable_result_log +# Regular EXPLAINable SELECT with a qualified table name +CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, FALSE, FALSE); +# Table in query is not qualified and is not in the current default schema +CALL sys.ps_trace_statement_digest(@digest.select, 0.5, 0.1, FALSE, FALSE); +# SHOW queries doesn't work with EXPLAIN +CALL sys.ps_trace_statement_digest(@digest.show , 0.5, 0.1, FALSE, FALSE); +# Test that finding no queries works - the TRUE argument resets the P_S tables +# used in ps_trace_statement_digest() +CALL sys.ps_trace_statement_digest(@digest.insert, 0.5, 0.1, TRUE , FALSE); +--enable_result_log + + + +# Clean up +use test; +DROP SCHEMA test_sys; +DROP TABLE t1; +SET @threadid = NULL, + @digest.insert = NULL, + @digest.select = NULL, + @digest.show = NULL; diff --git a/mysql-test/suite/sysschema/t/pr_statement_performance_analyzer.test b/mysql-test/suite/sysschema/t/pr_statement_performance_analyzer.test new file mode 100644 index 00000000..b8932381 --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_statement_performance_analyzer.test @@ -0,0 +1,298 @@ +########### suite/sysschema/t/pr_statement_performance_analyzer.test ############# +# # +# Testing of of the sys.statement_performance_analyzer() procedure # +# # +# Creation: # +# 2015-07-28 jkrogh Implement this test as part of # +# WL#7804 REPORT FOR SUPPORT # +# # +################################################################################## + +-- source include/not_embedded.inc +# Performance schema tracks prepared statements separately, and does not +# yet have a summary view that we can use for this view. +# Until then, we disable this test with --ps-protocol +-- source include/no_protocol.inc +# Bug #23290879 - For reasons unknown to man this test fails randomly only on Windows +#-- source include/not_windows.inc + +use test; +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TEMPORARY TABLE IF EXISTS tmp_digests_ini; +DROP VIEW IF EXISTS view_digests; +--enable_warnings + +# Create a table +CREATE TABLE t1 (id INT PRIMARY KEY, val int); + +# Create a new connection to make the actual changes +# Create the connection now to ensure queries like "SELECT @@`version_comment` LIMIT 1" are excluded +connect (con1,localhost,root,,); +connection con1; +use test; +--let $con1_thread_id= `SELECT THREAD_ID FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID()` + +# Disable instrumentation for all other threads other than the one that will +# my monitored for this test ($con1_thread_id) +connection default; +--disable_result_log +--replace_result $con1_thread_id CON1_THREAD_ID +eval UPDATE performance_schema.threads SET INSTRUMENTED = IF(THREAD_ID = $con1_thread_id, 'YES', 'NO'); +CALL sys.ps_setup_enable_consumer('events_statements_history_long'); +CALL sys.ps_truncate_all_tables(FALSE); +--enable_result_log + +# Start with some initial queries +# Don't rely on the digests being constant across MySQL releases and versions, so find the +# digest for each of the three queries by getting the last event from performance_schema.events_statements_current +# for the con1 connection. +connection con1; +INSERT INTO t1 VALUES (1, 0); +connection default; +--let $wait_condition= SELECT SUBSTRING(SQL_TEXT, 1, 7) = 'INSERT ' FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id AND DIGEST IS NOT NULL +--source include/wait_condition.inc +--let $digest_insert= `SELECT DIGEST FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` +--let $query_insert= `SELECT sys.format_statement(DIGEST_TEXT) FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` +connection con1; +UPDATE t1 SET val = 1 WHERE id = 1; +connection default; +--let $wait_condition= SELECT SUBSTRING(SQL_TEXT, 1, 7) = 'UPDATE ' FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id AND DIGEST IS NOT NULL +--source include/wait_condition.inc +--let $digest_update= `SELECT DIGEST FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` +--let $query_update= `SELECT sys.format_statement(DIGEST_TEXT) FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` +connection con1; +SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id; +connection default; +--let $wait_condition= SELECT SUBSTRING(SQL_TEXT, 1, 7) = 'SELECT ' FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id AND DIGEST IS NOT NULL +--source include/wait_condition.inc +--let $digest_select= `SELECT DIGEST FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` +--let $query_select= `SELECT sys.format_statement(DIGEST_TEXT) FROM performance_schema.events_statements_current WHERE THREAD_ID = $con1_thread_id ORDER BY EVENT_ID DESC LIMIT 1` + +# Enable to debug if some digests are not found +# --output /tmp/digest +# --eval SELECT '$digest_insert' AS DigestInsert, '$digest_update' AS DigestUpdate, '$digest_select' AS DigestSelect +# --output /tmp/digest_text +# --eval SELECT '$query_insert' AS DigestInsert, '$query_update' AS DigestUpdate, '$query_select' AS DigestSelect +# --output /tmp/ps_history +# SELECT THREAD_ID, EVENT_ID, END_EVENT_ID, DIGEST, SQL_TEXT FROM performance_schema.events_statements_history_long ORDER BY EVENT_ID; + +# Start collecting data +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL); +CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +CALL sys.statement_performance_analyzer('save', 'test.tmp_digests_ini', NULL); + +# Make sure the last_seen times will be different from the SELECT statement's first_seen. +DO SLEEP(1.2); + +# Make some more changes +connection con1; +INSERT INTO t1 VALUES (2, 0); +UPDATE t1 SET val = 1 WHERE id = 2; +SELECT t1a.* FROM t1 AS t1a LEFT OUTER JOIN (SELECT * FROM t1 AS t1b1 INNER JOIN t1 AS t1b2 USING (id, val)) AS t1b ON t1b.id > t1a.id ORDER BY t1a.val, t1a.id; +disconnect con1; + +# Make the second collection of data and create the output +connection default; +# Make sure all of the queries executing in con1 has been recorded in performance_schema.events_statements_summary_by_digest +# before continuing with the actual tests of pr_statement_performance_analyzer() +--let $wait_condition= SELECT COUNT_STAR = 2 FROM performance_schema.events_statements_summary_by_digest WHERE DIGEST = '$digest_select' +--source include/wait_condition.inc + +# Get all values to be used in replacements now to minimize the risk of the +# values disappearing out of the performance_schema tables +--let $o_upd_total_latency= `SELECT total_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_upd_max_latency= `SELECT max_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_upd_avg_latency= `SELECT avg_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_upd_first_seen= `SELECT first_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_upd_last_seen= `SELECT last_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_sel_total_latency= `SELECT total_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_sel_max_latency= `SELECT max_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_sel_avg_latency= `SELECT avg_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_sel_first_seen= `SELECT first_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_sel_last_seen= `SELECT last_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_ins_total_latency= `SELECT total_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $o_ins_max_latency= `SELECT max_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $o_ins_avg_latency= `SELECT avg_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $o_ins_first_seen= `SELECT first_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $o_ins_last_seen= `SELECT last_seen FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $o_upd_lock_latency= `SELECT lock_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_update'` +--let $o_sel_lock_latency= `SELECT lock_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_select'` +--let $o_ins_lock_latency= `SELECT lock_latency FROM sys.statement_analysis WHERE db = 'test' AND digest = '$digest_insert'` +--let $d_upd_total_latency= `SELECT sys.format_time(TIMER_WAIT) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_update' ORDER BY EVENT_ID DESC LIMIT 1` +--let $d_sel_total_latency= `SELECT sys.format_time(TIMER_WAIT) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_select' ORDER BY EVENT_ID DESC LIMIT 1` +--let $d_ins_total_latency= `SELECT sys.format_time(TIMER_WAIT) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_insert' ORDER BY EVENT_ID DESC LIMIT 1` +--let $d_upd_tock_latency= `SELECT sys.format_time(LOCK_TIME) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_update' ORDER BY EVENT_ID DESC LIMIT 1` +--let $d_sel_tock_latency= `SELECT sys.format_time(LOCK_TIME) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_select' ORDER BY EVENT_ID DESC LIMIT 1` +--let $d_ins_tock_latency= `SELECT sys.format_time(LOCK_TIME) FROM performance_schema.events_statements_history_long WHERE CURRENT_SCHEMA = 'test' AND DIGEST = '$digest_insert' ORDER BY EVENT_ID DESC LIMIT 1` + +CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); + +# Do a sanity check to ensure we are assuming the queries has the digests they have and that there is nothing else in the events_statements_summary_by_digest than there actually is. +--replace_result $digest_insert DIGEST_INSERT $digest_update DIGEST_UPDATE $digest_select DIGEST_SELECT +--sorted_result +SELECT DIGEST, COUNT_STAR FROM performance_schema.events_statements_summary_by_digest; + +# with_runtimes_in_95th_percentile +# It is unknown what the result will be since the execution times for each query are unknown +# So just check that no warning or error occurs +--disable_result_log +CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +--enable_result_log + +# analysis - as there's no control of the various latencies, it may be the same for two or more of the queries. +# So replace_result cannot be used to give it a unique value. Instead just use LATENCY for all rows. +--replace_result $query_insert QUERY_INSERT $query_select QUERY_SELECT $query_update QUERY_UPDATE $digest_insert DIGEST_INSERT $digest_update DIGEST_UPDATE $digest_select DIGEST_SELECT $o_upd_total_latency LATENCY $o_upd_max_latency LATENCY $o_upd_avg_latency LATENCY $o_upd_lock_latency LATENCY $o_upd_first_seen FIRST_SEEN $o_upd_last_seen LAST_SEEN $o_sel_total_latency LATENCY $o_sel_max_latency LATENCY $o_sel_avg_latency LATENCY $o_sel_lock_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN $o_ins_total_latency LATENCY $o_ins_max_latency LATENCY $o_ins_avg_latency LATENCY $o_ins_lock_latency LATENCY $o_ins_first_seen FIRST_SEEN $o_ins_last_seen LAST_SEEN +--sorted_result +CALL sys.statement_performance_analyzer('overall', NULL, 'analysis'); + +--replace_result $query_insert QUERY_INSERT $query_select QUERY_SELECT $query_update QUERY_UPDATE $digest_insert DIGEST_INSERT $digest_update DIGEST_UPDATE $digest_select DIGEST_SELECT $d_upd_total_latency LATENCY $o_upd_max_latency LATENCY $o_upd_first_seen FIRST_SEEN $o_upd_last_seen LAST_SEEN $d_upd_tock_latency LATENCY $d_sel_total_latency LATENCY $o_sel_max_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN $d_sel_tock_latency LATENCY $d_ins_total_latency LATENCY $o_ins_max_latency LATENCY $o_ins_first_seen FIRST_SEEN $o_ins_last_seen LAST_SEEN $d_ins_tock_latency LATENCY +--sorted_result +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis'); + +# Should give an empty result except for the banner generated by the procedure +CALL sys.statement_performance_analyzer('overall', NULL, 'with_errors_or_warnings'); +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_errors_or_warnings'); + +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $o_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('overall', NULL, 'with_full_table_scans'); +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $d_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_full_table_scans'); + +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $o_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('overall', NULL, 'with_sorting'); +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $d_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_sorting'); + +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $o_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('overall', NULL, 'with_temp_tables'); +--replace_result $query_select QUERY_SELECT $digest_select DIGEST_SELECT $d_sel_total_latency LATENCY $o_sel_first_seen FIRST_SEEN $o_sel_last_seen LAST_SEEN +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'with_temp_tables'); + +# Try a custom view +# Sort by the query, then we know the order will be INSERT, SELECT, UPDATE +CREATE VIEW test.view_digests AS +SELECT sys.format_statement(DIGEST_TEXT) AS query, + SCHEMA_NAME AS db, + COUNT_STAR AS exec_count, + sys.format_time(SUM_TIMER_WAIT) AS total_latency, + sys.format_time(AVG_TIMER_WAIT) AS avg_latency, + ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, + ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg, + ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg, + DIGEST AS digest + FROM performance_schema.events_statements_summary_by_digest + ORDER BY SUBSTRING(query, 1, 6); +SET @sys.statement_performance_analyzer.view = 'test.view_digests'; +--replace_result $query_insert QUERY_INSERT $query_select QUERY_SELECT $query_update QUERY_UPDATE $digest_insert DIGEST_INSERT $digest_update DIGEST_UPDATE $digest_select DIGEST_SELECT $o_upd_total_latency LATENCY $o_upd_avg_latency LATENCY $o_sel_total_latency LATENCY $o_sel_avg_latency LATENCY $o_ins_total_latency LATENCY $o_ins_avg_latency LATENCY +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +--replace_result $query_insert QUERY_INSERT $query_select QUERY_SELECT $query_update QUERY_UPDATE $digest_insert DIGEST_INSERT $digest_update DIGEST_UPDATE $digest_select DIGEST_SELECT $d_upd_total_latency LATENCY $d_sel_total_latency LATENCY $d_ins_total_latency LATENCY +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'custom'); + +# Verify that setting a limit works +SET @sys.statement_performance_analyzer.limit = 2; +--replace_result $query_insert QUERY_INSERT $query_select QUERY_SELECT $digest_insert DIGEST_INSERT $digest_select DIGEST_SELECT $o_ins_total_latency LATENCY $o_ins_avg_latency LATENCY $o_sel_total_latency LATENCY $o_sel_avg_latency LATENCY +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); + +# Test for error conditions - some of the errors depend on the sql_mode so set it explicitly +# Which sql_modes are deprecated depends on the release, so disable warnings while setting the sql_mode + + +# Use non-strict sql_mode - keep NO_AUTO_CREATE_USER as this sql_mode will be mandatory in the future: +SET SESSION sql_mode = 'NO_AUTO_CREATE_USER'; +# Ask for a non-supported action - since strict more is not used, this will give the error: ERROR 1644 (45000): Unknown action: '' +# Note: the action passed to the procedure is actually lost because it's truncated. +--error ER_SIGNAL_EXCEPTION +CALL sys.statement_performance_analyzer('do magic', NULL, NULL); + + +# Use 5.7.9+ default: +--disable_warnings +SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; +--enable_warnings +# Ask for a non-supported action - since strict mode is used, this will give the error: ERROR 1265 (01000): Data truncated for column 'in_action' at row 1 +--error 1265 +CALL sys.statement_performance_analyzer('do magic', NULL, NULL); +# Try to create reserved table name +-- error S45000 +CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests', NULL); +-- error S45000 +CALL sys.statement_performance_analyzer('create_tmp', 'sys.tmp_digests_delta', NULL); +-- error S45000 +CALL sys.statement_performance_analyzer('create_tmp', 'tmp_digests', NULL); +# This should succeed +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests', NULL); +CREATE TABLE test.tmp_unsupported LIKE test.tmp_digests_ini; +# Try to create a temporary table that already exists +-- error S45000 +CALL sys.statement_performance_analyzer('create_tmp', 'test.tmp_digests_ini', NULL); +# Try to create a base table that already exists +-- error S45000 +CALL sys.statement_performance_analyzer('create_table', 'test.tmp_digests_ini', NULL); +-- error S45000 +CALL sys.statement_performance_analyzer('create_table', 'test.tmp_unsupported', NULL); +# Verify that the sanity check for the input table e.g. for saving snapshots works +ALTER TABLE test.tmp_unsupported ADD COLUMN myvar int DEFAULT 0; +-- error S45000 +CALL sys.statement_performance_analyzer('save', 'test.tmp_unsupported', NULL); +# Try to create a snapshot or overall output with the wrong in_table +-- error S45000 +CALL sys.statement_performance_analyzer('snapshot', 'test.new_table', NULL); +-- error S45000 +CALL sys.statement_performance_analyzer('overall', 'test.new_table', 'analysis'); +# Try to create a delta output or save a snapshot specifying a non-existing table. +-- error S45000 +CALL sys.statement_performance_analyzer('delta', 'test.new_table', 'analysis'); +-- error S45000 +CALL sys.statement_performance_analyzer('save', 'test.new_table', NULL); +# Verify custom views doesn't work without the user variable set +SET @sys.statement_performance_analyzer.view = NULL; +DELETE FROM sys.sys_config WHERE variable = 'statement_performance_analyzer.view'; +-- error S45000 +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); +# Set the custom view to a regular table - should not work +SET @sys.statement_performance_analyzer.view = 'test.tmp_unsupported'; +-- error S45000 +CALL sys.statement_performance_analyzer('overall', NULL, 'custom'); + + +# Remove the temporary tables created by the procedure +# First ensure the tables actually exists (to avoid passing the test if the table names are changed) +CALL sys.table_exists('sys', 'tmp_digests', @exists); +SELECT @exists; +CALL sys.table_exists('sys', 'tmp_digests_delta', @exists); +SELECT @exists; +CALL sys.statement_performance_analyzer('cleanup', NULL, NULL); +# Verify the internal tables really were removed +-- error ER_BAD_TABLE_ERROR +DROP TEMPORARY TABLE sys.tmp_digests; +-- error ER_BAD_TABLE_ERROR +DROP TEMPORARY TABLE sys.tmp_digests_delta; + +# An attempt to create a delta view should fail now as there's no longer an existing snapshot. +-- error S45000 +CALL sys.statement_performance_analyzer('delta', 'test.tmp_digests_ini', 'analysis'); +# Ensure no delta table was created. +-- error ER_BAD_TABLE_ERROR +DROP TEMPORARY TABLE sys.tmp_digests_delta; + +# Try and use a table.db name > 129 +SET @identifier := REPEAT('a', 65); +-- error 1406 +CALL sys.statement_performance_analyzer('snapshot', CONCAT(@identifier, '.', @identifier), NULL); + +# Clean up +DROP TEMPORARY TABLE test.tmp_digests_ini; +DROP TEMPORARY TABLE test.tmp_digests; +DROP TABLE test.tmp_unsupported; +DROP TABLE test.t1; +DROP VIEW view_digests; +SET @identifier := NULL; + +SET SESSION sql_mode = @@global.sql_mode; +SET @sys.statement_performance_analyzer.limit = NULL; +SET @sys.statement_performance_analyzer.view = NULL; +--source ../include/ps_setup_consumers_cleanup.inc +--source ../include/ps_threads_cleanup.inc +--source ../include/sys_config_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/pr_table_exists.test b/mysql-test/suite/sysschema/t/pr_table_exists.test new file mode 100644 index 00000000..83e1dc0b --- /dev/null +++ b/mysql-test/suite/sysschema/t/pr_table_exists.test @@ -0,0 +1,69 @@ +-- source include/not_embedded.inc + + +# Create a base table and a view +CREATE TABLE t1 (id INT PRIMARY KEY); +# Verify the base table and view is supported +CALL sys.table_exists('test', 't1', @exists); +SELECT @exists; +DROP TABLE t1; + +CREATE view v_t1 AS SELECT 1; +CALL sys.table_exists('test', 'v_t1', @exists); +SELECT @exists; +DROP VIEW v_t1; + +CREATE TABLE tv (i int) with system versioning; +CALL sys.table_exists('test','tv',@exists); +SELECT @exists; +DROP TABLE tv; + +CREATE SEQUENCE s; +CALL sys.table_exists('test','s',@exists); +SELECT @exists; +DROP SEQUENCE s; + +# Replace the base table with a temporary table +CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); +CALL sys.table_exists('test', 't1', @exists); +SELECT @exists; +DROP TEMPORARY TABLE t1; + +CALL sys.table_exists('information_schema', 'all_plugins', @exists); +SELECT @exists; + +# Try a non-existing table +CALL sys.table_exists('test', 't2', @exists); +SELECT @exists; + +# Try variables longer than expected +SET @identifier := REPEAT('a', 65); + +-- error 1406 +CALL sys.table_exists(@identifier, 't1', @exists); + +-- error 1406 +CALL sys.table_exists('test', @identifier, @exists); + +SET @identifier := NULL; + +--echo # +--echo # MDEV-28391: table_exists procedure fails with +--echo # Incorrect table name with backtick identifiers +--echo # +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`; +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`; +CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CREATE TEMPORARY TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); +CALL sys.table_exists('test', 'ab`c', @tbl_type); +SELECT @tbl_type; +--echo # We cannot send quoted identifer to the procedure, no table will be found +CALL sys.table_exists('test', '`ab``c`', @tbl_type); +SELECT @tbl_type; +DROP TABLE `ab``c`;
\ No newline at end of file diff --git a/mysql-test/suite/sysschema/t/t_sys_config.test b/mysql-test/suite/sysschema/t/t_sys_config.test new file mode 100644 index 00000000..d78f8c9f --- /dev/null +++ b/mysql-test/suite/sysschema/t/t_sys_config.test @@ -0,0 +1,18 @@ +-- source include/not_embedded.inc +# Tests for sys schema +# Verify the sys.sys_config table is as expected +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='sys'; +DESC sys.sys_config; + +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; + +# Ensure the sys.sys_config_update_set_user trigger functions correctly +UPDATE sys.sys_config SET value = 128 WHERE variable = 'statement_truncate_len'; + +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; + +INSERT INTO sys.sys_config (variable, value) VALUES ('foo', 'bar'); + +SELECT variable, value, set_by FROM sys.sys_config ORDER BY 1; + +--source ../include/sys_config_cleanup.inc diff --git a/mysql-test/suite/sysschema/t/v_host_summary.test b/mysql-test/suite/sysschema/t/v_host_summary.test new file mode 100644 index 00000000..7cea0d5b --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary view + +# Ensure structure changes don't slip in +DESC sys.host_summary; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_host_summary_by_file_io.test b/mysql-test/suite/sysschema/t/v_host_summary_by_file_io.test new file mode 100644 index 00000000..f4b31509 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary_by_file_io.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary_by_file_io view + +# Ensure structure changes don't slip in +DESC sys.host_summary_by_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary_by_file_io; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary_by_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary_by_file_io; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_host_summary_by_file_io_type.test b/mysql-test/suite/sysschema/t/v_host_summary_by_file_io_type.test new file mode 100644 index 00000000..9ae9475c --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary_by_file_io_type.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary_by_file_io_type view + +# Ensure structure changes don't slip in +DESC sys.host_summary_by_file_io_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary_by_file_io_type; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary_by_file_io_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary_by_file_io_type; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_host_summary_by_stages.test b/mysql-test/suite/sysschema/t/v_host_summary_by_stages.test new file mode 100644 index 00000000..37918012 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary_by_stages.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary_by_stages view + +# Ensure structure changes don't slip in +DESC sys.host_summary_by_stages; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary_by_stages; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary_by_stages; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary_by_stages; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_host_summary_by_statement_latency.test b/mysql-test/suite/sysschema/t/v_host_summary_by_statement_latency.test new file mode 100644 index 00000000..29639e33 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary_by_statement_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary_by_statement_latency view + +# Ensure structure changes don't slip in +DESC sys.host_summary_by_statement_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary_by_statement_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary_by_statement_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary_by_statement_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_host_summary_by_statement_type.test b/mysql-test/suite/sysschema/t/v_host_summary_by_statement_type.test new file mode 100644 index 00000000..e9fd3981 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_host_summary_by_statement_type.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.host_summary_by_statement_type view + +# Ensure structure changes don't slip in +DESC sys.host_summary_by_statement_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.host_summary_by_statement_type; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$host_summary_by_statement_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$host_summary_by_statement_type; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_schema.test b/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_schema.test new file mode 100644 index 00000000..f44b87d4 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_schema.test @@ -0,0 +1,23 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +-- source include/have_innodb.inc + +# Tests for sys schema +# Verify the sys.innodb_buffer_stats_by_schema view + +# Ensure structure changes don't slip in +DESC sys.innodb_buffer_stats_by_schema; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.innodb_buffer_stats_by_schema; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$innodb_buffer_stats_by_schema; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$innodb_buffer_stats_by_schema; +--enable_result_log diff --git a/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_table.test b/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_table.test new file mode 100644 index 00000000..d65c28ff --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_innodb_buffer_stats_by_table.test @@ -0,0 +1,23 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +-- source include/have_innodb.inc + +# Tests for sys schema +# Verify the sys.innodb_buffer_stats_by_table view + +# Ensure structure changes don't slip in +DESC sys.innodb_buffer_stats_by_table; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.innodb_buffer_stats_by_table; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$innodb_buffer_stats_by_table; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$innodb_buffer_stats_by_table; +--enable_result_log diff --git a/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test b/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test new file mode 100644 index 00000000..b784587d --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_innodb_lock_waits.test @@ -0,0 +1,41 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +-- source include/have_innodb.inc +# Tests for sys schema +# Verify the sys.innodb_lock_waits view + +# Ensure structure changes don't slip in +DESC sys.innodb_lock_waits; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.innodb_lock_waits; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$innodb_lock_waits; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$innodb_lock_waits; +--enable_result_log + + +--echo # +--echo # Start of 10.6 tests +--echo # + +--echo # +--echo # MDEV-26507 Assertion `tmp != ((long long) 0x8000000000000000LL)' failed in TIME_from_longlong_datetime_packed +--echo # + +SET SESSION sql_mode='ALLOW_INVALID_DATES'; +--disable_result_log +SELECT * FROM sys.x$innodb_lock_waits; +--enable_result_log +SET SESSION sql_mode=DEFAULT; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/mysql-test/suite/sysschema/t/v_io_by_thread_by_latency.test b/mysql-test/suite/sysschema/t/v_io_by_thread_by_latency.test new file mode 100644 index 00000000..38a1f7a2 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_io_by_thread_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.io_by_thread_by_latency view + +# Ensure structure changes don't slip in +DESC sys.io_by_thread_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.io_by_thread_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$io_by_thread_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$io_by_thread_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_io_global_by_file_by_bytes.test b/mysql-test/suite/sysschema/t/v_io_global_by_file_by_bytes.test new file mode 100644 index 00000000..ded74ae9 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_io_global_by_file_by_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.io_global_by_file_by_bytes view + +# Ensure structure changes don't slip in +DESC sys.io_global_by_file_by_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.io_global_by_file_by_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$io_global_by_file_by_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$io_global_by_file_by_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_io_global_by_file_by_latency.test b/mysql-test/suite/sysschema/t/v_io_global_by_file_by_latency.test new file mode 100644 index 00000000..893d9804 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_io_global_by_file_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.io_global_by_file_by_latency view + +# Ensure structure changes don't slip in +DESC sys.io_global_by_file_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.io_global_by_file_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$io_global_by_file_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$io_global_by_file_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_bytes.test b/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_bytes.test new file mode 100644 index 00000000..102d8dbe --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.io_global_by_wait_by_bytes view + +# Ensure structure changes don't slip in +DESC sys.io_global_by_wait_by_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.io_global_by_wait_by_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$io_global_by_wait_by_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$io_global_by_wait_by_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_latency.test b/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_latency.test new file mode 100644 index 00000000..8843841b --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_io_global_by_wait_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.io_global_by_wait_by_latency view + +# Ensure structure changes don't slip in +DESC sys.io_global_by_wait_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.io_global_by_wait_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$io_global_by_wait_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$io_global_by_wait_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_latest_file_io.test b/mysql-test/suite/sysschema/t/v_latest_file_io.test new file mode 100644 index 00000000..f6b7c789 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_latest_file_io.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.latest_file_io view + +# Ensure structure changes don't slip in +DESC sys.latest_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.latest_file_io; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$latest_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$latest_file_io; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_memory_by_host_by_current_bytes.test b/mysql-test/suite/sysschema/t/v_memory_by_host_by_current_bytes.test new file mode 100644 index 00000000..6e3477e8 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_memory_by_host_by_current_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.memory_by_host_by_current_bytes view + +# Ensure structure changes don't slip in +DESC sys.memory_by_host_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.memory_by_host_by_current_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$memory_by_host_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$memory_by_host_by_current_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_memory_by_thread_by_current_bytes.test b/mysql-test/suite/sysschema/t/v_memory_by_thread_by_current_bytes.test new file mode 100644 index 00000000..c097ea7e --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_memory_by_thread_by_current_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.memory_by_thread_by_current_bytes view + +# Ensure structure changes don't slip in +DESC sys.memory_by_thread_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.memory_by_thread_by_current_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$memory_by_thread_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$memory_by_thread_by_current_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_memory_by_user_by_current_bytes.test b/mysql-test/suite/sysschema/t/v_memory_by_user_by_current_bytes.test new file mode 100644 index 00000000..4d104285 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_memory_by_user_by_current_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.memory_by_user_by_current_bytes view + +# Ensure structure changes don't slip in +DESC sys.memory_by_user_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.memory_by_user_by_current_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$memory_by_user_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$memory_by_user_by_current_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_memory_global_by_current_bytes.test b/mysql-test/suite/sysschema/t/v_memory_global_by_current_bytes.test new file mode 100644 index 00000000..1bed9c98 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_memory_global_by_current_bytes.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.memory_global_by_current_bytes view + +# Ensure structure changes don't slip in +DESC sys.memory_global_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.memory_global_by_current_bytes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$memory_global_by_current_bytes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$memory_global_by_current_bytes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_memory_global_total.test b/mysql-test/suite/sysschema/t/v_memory_global_total.test new file mode 100644 index 00000000..572581d5 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_memory_global_total.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.memory_global_total view + +# Ensure structure changes don't slip in +DESC sys.memory_global_total; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.memory_global_total; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$memory_global_total; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$memory_global_total; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_metrics.test b/mysql-test/suite/sysschema/t/v_metrics.test new file mode 100644 index 00000000..a8ff1cd9 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_metrics.test @@ -0,0 +1,12 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.metrics and sys.metrics_56 views + +# Ensure structure changes don't slip in +DESC sys.metrics; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.metrics; +--enable_result_log diff --git a/mysql-test/suite/sysschema/t/v_processlist.test b/mysql-test/suite/sysschema/t/v_processlist.test new file mode 100644 index 00000000..fd3f0110 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_processlist.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.processlist view + +# Ensure structure changes don't slip in +DESC sys.processlist; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.processlist; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$processlist; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$processlist; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_ps_check_lost_instrumentation.test b/mysql-test/suite/sysschema/t/v_ps_check_lost_instrumentation.test new file mode 100644 index 00000000..b5c7fd19 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_ps_check_lost_instrumentation.test @@ -0,0 +1,13 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.ps_check_lost_instrumentation view + +# Ensure structure changes don't slip in +DESC sys.ps_check_lost_instrumentation; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.ps_check_lost_instrumentation; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_ps_digest_95th_percentile_by_avg_us.test b/mysql-test/suite/sysschema/t/v_ps_digest_95th_percentile_by_avg_us.test new file mode 100644 index 00000000..6f111b7f --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_ps_digest_95th_percentile_by_avg_us.test @@ -0,0 +1,24 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc + +DESC sys.x$ps_digest_95th_percentile_by_avg_us; + +DESC sys.x$ps_digest_95th_percentile_by_avg_us; + +# Ensure structure changes don't slip in +DESC sys.x$ps_digest_95th_percentile_by_avg_us; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$ps_digest_95th_percentile_by_avg_us; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_digest_95th_percentile_by_avg_us; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_ps_digest_avg_latency_distribution.test b/mysql-test/suite/sysschema/t/v_ps_digest_avg_latency_distribution.test new file mode 100644 index 00000000..6074ca3f --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_ps_digest_avg_latency_distribution.test @@ -0,0 +1,24 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc + +DESC sys.x$ps_digest_avg_latency_distribution; + +DESC sys.x$ps_digest_avg_latency_distribution; + +# Ensure structure changes don't slip in +DESC sys.x$ps_digest_avg_latency_distribution; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_digest_avg_latency_distribution; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$ps_digest_avg_latency_distribution; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_digest_avg_latency_distribution; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_ps_schema_table_statistics_io.test b/mysql-test/suite/sysschema/t/v_ps_schema_table_statistics_io.test new file mode 100644 index 00000000..cfb222b9 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_ps_schema_table_statistics_io.test @@ -0,0 +1,24 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc + +DESC sys.x$ps_schema_table_statistics_io; + +DESC sys.x$ps_schema_table_statistics_io; + +# Ensure structure changes don't slip in +DESC sys.x$ps_schema_table_statistics_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_schema_table_statistics_io; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$ps_schema_table_statistics_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$ps_schema_table_statistics_io; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_schema_auto_increment_columns.test b/mysql-test/suite/sysschema/t/v_schema_auto_increment_columns.test new file mode 100644 index 00000000..b3cae841 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_auto_increment_columns.test @@ -0,0 +1,159 @@ +-- source include/big_test.inc +-- source include/not_embedded.inc +-- source include/have_innodb.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_auto_increment_columns view + +# Ensure structure changes don't slip in +DESC sys.schema_auto_increment_columns; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_auto_increment_columns; +--enable_result_log + +# Test the output of the view is as expected +CREATE DATABASE auto_incs; + +CREATE TABLE auto_incs.tinyintcol ( + id TINYINT AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.tinyintcol (foo) VALUES (100); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); +INSERT INTO auto_incs.tinyintcol (foo) (SELECT foo FROM auto_incs.tinyintcol); + +CREATE TABLE auto_incs.tinyintcolunsigned ( + id TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.tinyintcolunsigned (foo) (SELECT foo FROM auto_incs.tinyintcol); + +CREATE TABLE auto_incs.smallintcol ( + id SMALLINT AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.smallintcol (foo) VALUES (200); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); +INSERT INTO auto_incs.smallintcol (foo) (SELECT foo FROM auto_incs.smallintcol); + +CREATE TABLE auto_incs.smallintcolunsigned ( + id SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + foo INT +); + + +INSERT INTO auto_incs.smallintcolunsigned (foo) (SELECT foo FROM auto_incs.smallintcol); + +CREATE TABLE auto_incs.mediumintcol ( + id MEDIUMINT AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.mediumintcol (foo) VALUES (300); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); +INSERT INTO auto_incs.mediumintcol (foo) (SELECT foo FROM auto_incs.mediumintcol); + +CREATE TABLE auto_incs.mediumintcolunsigned ( + id MEDIUMINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + foo INT +); + + +INSERT INTO auto_incs.mediumintcolunsigned (foo) (SELECT foo FROM auto_incs.mediumintcol); + +CREATE TABLE auto_incs.intcol ( + id INT AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.intcol (foo) VALUES (400); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); +INSERT INTO auto_incs.intcol (foo) (SELECT foo FROM auto_incs.intcol); + +CREATE TABLE auto_incs.intcolunsigned ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.intcolunsigned (foo) (SELECT foo FROM auto_incs.intcol); + +CREATE TABLE auto_incs.bigintcol ( + id BIGINT AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.bigintcol (foo) VALUES (500); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); +INSERT INTO auto_incs.bigintcol (foo) (SELECT foo FROM auto_incs.bigintcol); + +CREATE TABLE auto_incs.bigintcolunsigned ( + id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + foo INT +); + +INSERT INTO auto_incs.bigintcolunsigned (foo) (SELECT foo FROM auto_incs.bigintcol); + +SELECT * FROM sys.schema_auto_increment_columns; + +DROP DATABASE auto_incs; diff --git a/mysql-test/suite/sysschema/t/v_schema_index_statistics.test b/mysql-test/suite/sysschema/t/v_schema_index_statistics.test new file mode 100644 index 00000000..660eb0db --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_index_statistics.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_index_statistics view + +# Ensure structure changes don't slip in +DESC sys.schema_index_statistics; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_index_statistics; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$schema_index_statistics; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_index_statistics; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_schema_object_overview.test b/mysql-test/suite/sysschema/t/v_schema_object_overview.test new file mode 100644 index 00000000..2d142c82 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_object_overview.test @@ -0,0 +1,13 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_object_overview view + +# Ensure structure changes don't slip in +DESC sys.schema_object_overview; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_object_overview; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_schema_redundant_indexes.test b/mysql-test/suite/sysschema/t/v_schema_redundant_indexes.test new file mode 100644 index 00000000..0cd2ac91 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_redundant_indexes.test @@ -0,0 +1,39 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_redundant_indexes / x$schema_flattened_keys views + +# Ensure structure changes don't slip in +DESC sys.schema_redundant_indexes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_redundant_indexes; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$schema_flattened_keys; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_flattened_keys; +--enable_result_log + +# Test correctly identifies keys + +CREATE DATABASE rkey; + +CREATE TABLE rkey.rkey ( + i INT, + j INT, + k INT, + PRIMARY KEY (i), + KEY (j), + KEY (j, k), + KEY (i, j, k) + ); + + SELECT * FROM sys.schema_redundant_indexes; + + DROP DATABASE rkey; diff --git a/mysql-test/suite/sysschema/t/v_schema_table_lock_waits.test b/mysql-test/suite/sysschema/t/v_schema_table_lock_waits.test new file mode 100644 index 00000000..eef77708 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_table_lock_waits.test @@ -0,0 +1,55 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_table_lock_waits view + +# Ensure structure changes don't slip in +DESC sys.schema_table_lock_waits; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_table_lock_waits; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$schema_table_lock_waits; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_table_lock_waits; +--enable_result_log + +# Ensure lock waits show up correctly +--connect(con1,localhost,root,,) +--connect(con2,localhost,root,,) + +connection con1; +CREATE TABLE test.lock_waits (i INT PRIMARY KEY, j INT) ENGINE = InnoDB; +LOCK TABLE lock_waits WRITE; + +connection con2; +send ALTER TABLE test.lock_waits ADD k VARCHAR(20); + +connection default; +while (`SELECT COUNT(*)=0 FROM sys.schema_table_lock_waits`) +{ + --sleep 0.5 +} +SELECT object_schema, object_name, + waiting_account, waiting_lock_type, waiting_query, + blocking_account, blocking_lock_type, blocking_lock_duration + FROM sys.schema_table_lock_waits; + +disconnect con1; + +connection default; +while (`SELECT COUNT(*)<> 0 FROM sys.schema_table_lock_waits`) +{ + --sleep 0.5 +} +disconnect con2; +connection default; + +DROP TABLE test.lock_waits; diff --git a/mysql-test/suite/sysschema/t/v_schema_table_statistics.test b/mysql-test/suite/sysschema/t/v_schema_table_statistics.test new file mode 100644 index 00000000..bb72de71 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_table_statistics.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_table_statistics view + +# Ensure structure changes don't slip in +DESC sys.schema_table_statistics; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_table_statistics; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$schema_table_statistics; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_table_statistics; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_schema_table_statistics_with_buffer.test b/mysql-test/suite/sysschema/t/v_schema_table_statistics_with_buffer.test new file mode 100644 index 00000000..9fbe5231 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_table_statistics_with_buffer.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_table_statistics_with_buffer view + +# Ensure structure changes don't slip in +DESC sys.schema_table_statistics_with_buffer; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_table_statistics_with_buffer; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$schema_table_statistics_with_buffer; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_table_statistics_with_buffer; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_schema_tables_with_full_table_scans.test b/mysql-test/suite/sysschema/t/v_schema_tables_with_full_table_scans.test new file mode 100644 index 00000000..80c43bb3 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_tables_with_full_table_scans.test @@ -0,0 +1,91 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_tables_with_full_table_scans view + +# Ensure structure changes don't slip in +DESC sys.schema_tables_with_full_table_scans; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_tables_with_full_table_scans; +--enable_result_log + +# Ensure structure changes don't slip in +DESC sys.x$schema_tables_with_full_table_scans; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$schema_tables_with_full_table_scans; +--enable_result_log + +# Create a dummy table, force some full table scans, verify the results +CREATE TABLE test.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb; + +INSERT INTO test.t (j) VALUES (1), (2), (3); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +INSERT INTO test.t (j) (SELECT j*2 FROM test.t); + +# The table should now have 768 rows + +# Now truncate the P_S tables, to get fresh results +CALL sys.ps_truncate_all_tables(false); + +# Following returns 28 rows, but should full scan as j has no index +# Using RAND() to force no query caching, so ignore results, they are not important +--disable_ps2_protocol +--disable_result_log +SELECT i, j, RAND() FROM test.t WHERE j = 12; +--enable_result_log +--enable_ps2_protocol + +# Ensure the base performance schema data is aggregated first +--let $wait_condition= SELECT COUNT_STAR = 768 FROM performance_schema.table_io_waits_summary_by_index_usage WHERE object_schema = 'test' AND object_name = 't' AND index_name IS NULL +--source include/wait_condition.inc + +# Now verify the table shows up in the views with the right row count (should be 768) +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; + +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; + +# Scan again +--disable_ps2_protocol +--disable_result_log +SELECT i, j, RAND() FROM test.t WHERE j = 12; +--enable_result_log +--enable_ps2_protocol + +# Again ensure the base performance schema data is aggregated first +--let $wait_condition= SELECT COUNT_STAR = 1536 FROM performance_schema.table_io_waits_summary_by_index_usage WHERE object_schema = 'test' AND object_name = 't' AND index_name IS NULL +--source include/wait_condition.inc + +# Now verify that double the amount of rows in the table should be shown as scanned (should be 1536) +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; + +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; + +# Do a point lookup +SELECT * FROM test.t WHERE i = 10; + +# The number of rows scanned should not have changed (should still be 1536) +SELECT object_schema, object_name, rows_full_scanned FROM sys.schema_tables_with_full_table_scans; + +SELECT object_schema, object_name, rows_full_scanned FROM sys.x$schema_tables_with_full_table_scans; + +# Cleanup +DROP TABLE test.t; diff --git a/mysql-test/suite/sysschema/t/v_schema_unused_indexes.test b/mysql-test/suite/sysschema/t/v_schema_unused_indexes.test new file mode 100644 index 00000000..a9000c25 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_schema_unused_indexes.test @@ -0,0 +1,13 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.schema_unused_indexes view + +# Ensure structure changes don't slip in +DESC sys.schema_unused_indexes; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.schema_unused_indexes; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_session.test b/mysql-test/suite/sysschema/t/v_session.test new file mode 100644 index 00000000..44431653 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_session.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.session view + +# Ensure structure changes don't slip in +DESC sys.session; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.session; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$session; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$session; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_session_ssl_status.test b/mysql-test/suite/sysschema/t/v_session_ssl_status.test new file mode 100644 index 00000000..00d60737 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_session_ssl_status.test @@ -0,0 +1,12 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.session_ssl_status view + +# Ensure structure changes don't slip in +DESC sys.session_ssl_status; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.session_ssl_status; +--enable_result_log diff --git a/mysql-test/suite/sysschema/t/v_statement_analysis.test b/mysql-test/suite/sysschema/t/v_statement_analysis.test new file mode 100644 index 00000000..0a4d3e88 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statement_analysis.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.statement_analysis view + +# Ensure structure changes don't slip in +DESC sys.statement_analysis; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statement_analysis; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statement_analysis; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statement_analysis; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_statements_with_errors_or_warnings.test b/mysql-test/suite/sysschema/t/v_statements_with_errors_or_warnings.test new file mode 100644 index 00000000..400b6f83 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statements_with_errors_or_warnings.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.statements_with_errors_or_warnings view + +# Ensure structure changes don't slip in +DESC sys.statements_with_errors_or_warnings; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statements_with_errors_or_warnings; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statements_with_errors_or_warnings; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statements_with_errors_or_warnings; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_statements_with_full_table_scans.test b/mysql-test/suite/sysschema/t/v_statements_with_full_table_scans.test new file mode 100644 index 00000000..8ec48527 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statements_with_full_table_scans.test @@ -0,0 +1,87 @@ +-- source include/not_embedded.inc +-- source include/have_innodb.inc +-- source ../include/ps_truncate_all_tables.inc +# Performance schema tracks prepared statements separately, and does not +# yet have a summary view that we can use for this view. +# Until then, we disable this test with --ps-protocol +-- source include/no_protocol.inc + +# Tests for sys schema +# Verify the sys.statements_with_full_table_scans view + +# Ensure structure changes don't slip in +DESC sys.statements_with_full_table_scans; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statements_with_full_table_scans; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statements_with_full_table_scans; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statements_with_full_table_scans; +--enable_result_log + +# Create a dummy table, force some full table scans, verify the results +CREATE DATABASE v_statements_with_full_table_scans; + +CREATE TABLE v_statements_with_full_table_scans.t (i BIGINT AUTO_INCREMENT PRIMARY KEY, j BIGINT) ENGINE = innodb; + +INSERT INTO v_statements_with_full_table_scans.t (j) VALUES (1), (2), (3); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +INSERT INTO v_statements_with_full_table_scans.t (j) (SELECT j*2 FROM v_statements_with_full_table_scans.t); + +# The table should now have 768 rows + +# Now truncate the P_S tables, to get fresh results +CALL sys.ps_truncate_all_tables(false); + +# Following returns 28 rows, but should full scan as j has no index +# Using RAND() to force no query caching, so ignore results, they are not important +--disable_result_log +SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12; +--enable_result_log + +# Now verify the statement shows up in the views with the right row count (should be 768) +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +# Scan again +--disable_result_log +SELECT i, j, RAND() FROM v_statements_with_full_table_scans.t WHERE j = 12; +--enable_result_log + +# Now verify that double the amount of rows for the statement should be shown as scanned (should be 1536) +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +# Do a point lookup +SELECT * FROM v_statements_with_full_table_scans.t WHERE i = 10; + +# The number of rows scanned should not have changed (should still be 1536) +SELECT db, query, rows_examined FROM sys.statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +SELECT db, query, rows_examined FROM sys.x$statements_with_full_table_scans WHERE query LIKE '%v_statements_with_full_table_scans%' ORDER BY rows_examined DESC; + +# Cleanup +DROP DATABASE v_statements_with_full_table_scans; diff --git a/mysql-test/suite/sysschema/t/v_statements_with_runtimes_in_95th_percentile.test b/mysql-test/suite/sysschema/t/v_statements_with_runtimes_in_95th_percentile.test new file mode 100644 index 00000000..ec2865e1 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statements_with_runtimes_in_95th_percentile.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.statements_with_runtimes_in_95th_percentile view + +# Ensure structure changes don't slip in +DESC sys.statements_with_runtimes_in_95th_percentile; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statements_with_runtimes_in_95th_percentile; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statements_with_runtimes_in_95th_percentile; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statements_with_runtimes_in_95th_percentile; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_statements_with_sorting.test b/mysql-test/suite/sysschema/t/v_statements_with_sorting.test new file mode 100644 index 00000000..cf692c6e --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statements_with_sorting.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.statements_with_sorting view + +# Ensure structure changes don't slip in +DESC sys.statements_with_sorting; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statements_with_sorting; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statements_with_sorting; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statements_with_sorting; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_statements_with_temp_tables.test b/mysql-test/suite/sysschema/t/v_statements_with_temp_tables.test new file mode 100644 index 00000000..5d88e8d6 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_statements_with_temp_tables.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.statements_with_temp_tables view + +# Ensure structure changes don't slip in +DESC sys.statements_with_temp_tables; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.statements_with_temp_tables; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$statements_with_temp_tables; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$statements_with_temp_tables; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary.test b/mysql-test/suite/sysschema/t/v_user_summary.test new file mode 100644 index 00000000..19d8824b --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary view + +# Ensure structure changes don't slip in +DESC sys.user_summary; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary_by_file_io.test b/mysql-test/suite/sysschema/t/v_user_summary_by_file_io.test new file mode 100644 index 00000000..2818a70a --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary_by_file_io.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary_by_file_io view + +# Ensure structure changes don't slip in +DESC sys.user_summary_by_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary_by_file_io; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary_by_file_io; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary_by_file_io; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary_by_file_io_type.test b/mysql-test/suite/sysschema/t/v_user_summary_by_file_io_type.test new file mode 100644 index 00000000..44d0edd4 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary_by_file_io_type.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary_by_file_io_type view + +# Ensure structure changes don't slip in +DESC sys.user_summary_by_file_io_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary_by_file_io_type; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary_by_file_io_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary_by_file_io_type; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary_by_stages.test b/mysql-test/suite/sysschema/t/v_user_summary_by_stages.test new file mode 100644 index 00000000..8977d067 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary_by_stages.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary_by_stages view + +# Ensure structure changes don't slip in +DESC sys.user_summary_by_stages; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary_by_stages; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary_by_stages; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary_by_stages; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary_by_statement_latency.test b/mysql-test/suite/sysschema/t/v_user_summary_by_statement_latency.test new file mode 100644 index 00000000..4c962c3f --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary_by_statement_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary_by_statement_latency view + +# Ensure structure changes don't slip in +DESC sys.user_summary_by_statement_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary_by_statement_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary_by_statement_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary_by_statement_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_user_summary_by_statement_type.test b/mysql-test/suite/sysschema/t/v_user_summary_by_statement_type.test new file mode 100644 index 00000000..a2176215 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_user_summary_by_statement_type.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.user_summary_by_statement_type view + +# Ensure structure changes don't slip in +DESC sys.user_summary_by_statement_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.user_summary_by_statement_type; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$user_summary_by_statement_type; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$user_summary_by_statement_type; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_version.test b/mysql-test/suite/sysschema/t/v_version.test new file mode 100644 index 00000000..bb60de8d --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_version.test @@ -0,0 +1,11 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.version view + +# We do not do a DESC of this view, as the size of the version field +# can change depending on the build. +# Instead, we just select the sys_version, to ensure no errors/unwanted updates + +SELECT sys_version FROM sys.version; + diff --git a/mysql-test/suite/sysschema/t/v_wait_classes_global_by_avg_latency.test b/mysql-test/suite/sysschema/t/v_wait_classes_global_by_avg_latency.test new file mode 100644 index 00000000..63eb79fb --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_wait_classes_global_by_avg_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.wait_classes_global_by_avg_latency view + +# Ensure structure changes don't slip in +DESC sys.wait_classes_global_by_avg_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.wait_classes_global_by_avg_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$wait_classes_global_by_avg_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$wait_classes_global_by_avg_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_wait_classes_global_by_latency.test b/mysql-test/suite/sysschema/t/v_wait_classes_global_by_latency.test new file mode 100644 index 00000000..87923996 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_wait_classes_global_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.wait_classes_global_by_latency view + +# Ensure structure changes don't slip in +DESC sys.wait_classes_global_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.wait_classes_global_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$wait_classes_global_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$wait_classes_global_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_waits_by_host_by_latency.test b/mysql-test/suite/sysschema/t/v_waits_by_host_by_latency.test new file mode 100644 index 00000000..56235abc --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_waits_by_host_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.waits_by_host_by_latency view + +# Ensure structure changes don't slip in +DESC sys.waits_by_host_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.waits_by_host_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$waits_by_host_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$waits_by_host_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_waits_by_user_by_latency.test b/mysql-test/suite/sysschema/t/v_waits_by_user_by_latency.test new file mode 100644 index 00000000..0f98c3a2 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_waits_by_user_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.waits_by_user_by_latency view + +# Ensure structure changes don't slip in +DESC sys.waits_by_user_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.waits_by_user_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$waits_by_user_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$waits_by_user_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/v_waits_global_by_latency.test b/mysql-test/suite/sysschema/t/v_waits_global_by_latency.test new file mode 100644 index 00000000..a41aff01 --- /dev/null +++ b/mysql-test/suite/sysschema/t/v_waits_global_by_latency.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc +-- source ../include/ps_truncate_all_tables.inc +# Tests for sys schema +# Verify the sys.waits_global_by_latency view + +# Ensure structure changes don't slip in +DESC sys.waits_global_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.waits_global_by_latency; +--enable_result_log + + +# Ensure structure changes don't slip in +DESC sys.x$waits_global_by_latency; + +# Make sure view select does not error, but ignore results +--disable_result_log +SELECT * FROM sys.x$waits_global_by_latency; +--enable_result_log + diff --git a/mysql-test/suite/sysschema/t/version_functions.test b/mysql-test/suite/sysschema/t/version_functions.test new file mode 100644 index 00000000..29a0d744 --- /dev/null +++ b/mysql-test/suite/sysschema/t/version_functions.test @@ -0,0 +1,27 @@ +########### suite/sysschema/t/version_functions.test ############# +# # +# Testing of the sys.version_major(), sys.version_minor(), # +# and sys.version_patch() functions # +# # +# Creation: # +# 2015-08-14 jkrogh Implement this test # +# # +################################################################## + +-- source include/not_embedded.inc + +# Sanity check - the functions should not return any warnings or errors +--disable_result_log +SELECT sys.version_major(); +SELECT sys.version_minor(); +SELECT sys.version_patch(); +--enable_result_log + +# Check that concatenating the three version parts gives the beginning of the output of VERSION() +# This is not truly an independent test, but there isn't really anywhere else to get the actual version, +# so it at least verifies that the three parts go back together in the right way. +let $MY_VERSION=`SELECT CONCAT(sys.version_major(), '.', sys.version_minor(), '.', sys.version_patch())`; +--disable_query_log ONCE +eval SET @my_version = '$MY_VERSION'; + +SELECT @my_version = SUBSTRING(VERSION(), 1, CHAR_LENGTH(@my_version)); |