Skip to content

Commit

Permalink
WL#9452: Log Position Lock
Browse files Browse the repository at this point in the history
Step-3: Introduce the new performance schema table and a new mutex
------------------------------------------------------------------

DBUG_SIGNAL_WAIT_FOR was moved away from sql/rpl_slave.h.

A global mutex (LOCK_collect_instance_log) was created to protect
against concurrent attempts to collect the instance logs information.

Added JSON support as an output field in a performance schema table.

Added the new performance schema table (instance_log_status).

Added a test case to query the new performance schema table.

Added perfschema specific test cases and updated test.pfs_check_proc()
signature.
  • Loading branch information
Joao Gramacho committed Dec 13, 2017
1 parent 38bdab5 commit 798ab78
Show file tree
Hide file tree
Showing 26 changed files with 698 additions and 67 deletions.
1 change: 1 addition & 0 deletions mysql-test/suite/perfschema/r/all_tests.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ update t2 set test_name= replace(test_name, "user_variables_", "uvar_");
delete from t2 where t2.test_name in (select t1.test_name from t1);
select test_name as `MISSING DDL/DML TESTS` from t2;
MISSING DDL/DML TESTS
idx_instance_log_status.test
idx_replication_applier_filters.test
idx_replication_applier_global_filters.test
idx_user_defined_functions.test
Expand Down
11 changes: 11 additions & 0 deletions mysql-test/suite/perfschema/r/ddl_instance_log_status.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ALTER TABLE performance_schema.instance_log_status
ADD COLUMN foo integer;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
TRUNCATE TABLE performance_schema.instance_log_status;
ERROR 42000: DROP command denied to user 'root'@'localhost' for table 'instance_log_status'
ALTER TABLE performance_schema.instance_log_status
ADD INDEX test_index(server_uuid);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
CREATE UNIQUE INDEX test_index ON
performance_schema.instance_log_status(server_uuid);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
99 changes: 51 additions & 48 deletions mysql-test/suite/perfschema/r/dml_handler.result
Original file line number Diff line number Diff line change
Expand Up @@ -9,150 +9,153 @@ SELECT COUNT(*) FROM table_list INTO @table_count;
# For each table in the performance schema, attempt HANDLER...OPEN,
# which should fail with an error 1031, ER_ILLEGAL_HA.

SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=101;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=102;
HANDLER performance_schema.variables_info OPEN;
ERROR HY000: Table storage engine for 'variables_info' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=100;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=101;
HANDLER performance_schema.variables_by_thread OPEN;
ERROR HY000: Table storage engine for 'variables_by_thread' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=99;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=100;
HANDLER performance_schema.users OPEN;
ERROR HY000: Table storage engine for 'users' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=98;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=99;
HANDLER performance_schema.user_variables_by_thread OPEN;
ERROR HY000: Table storage engine for 'user_variables_by_thread' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=97;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=98;
HANDLER performance_schema.user_defined_functions OPEN;
ERROR HY000: Table storage engine for 'user_defined_functions' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=96;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=97;
HANDLER performance_schema.threads OPEN;
ERROR HY000: Table storage engine for 'threads' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=95;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=96;
HANDLER performance_schema.table_lock_waits_summary_by_table OPEN;
ERROR HY000: Table storage engine for 'table_lock_waits_summary_by_table' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=94;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=95;
HANDLER performance_schema.table_io_waits_summary_by_table OPEN;
ERROR HY000: Table storage engine for 'table_io_waits_summary_by_table' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=93;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=94;
HANDLER performance_schema.table_io_waits_summary_by_index_usage OPEN;
ERROR HY000: Table storage engine for 'table_io_waits_summary_by_index_usage' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=92;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=93;
HANDLER performance_schema.table_handles OPEN;
ERROR HY000: Table storage engine for 'table_handles' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=91;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=92;
HANDLER performance_schema.status_by_user OPEN;
ERROR HY000: Table storage engine for 'status_by_user' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=90;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=91;
HANDLER performance_schema.status_by_thread OPEN;
ERROR HY000: Table storage engine for 'status_by_thread' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=89;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=90;
HANDLER performance_schema.status_by_host OPEN;
ERROR HY000: Table storage engine for 'status_by_host' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=88;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=89;
HANDLER performance_schema.status_by_account OPEN;
ERROR HY000: Table storage engine for 'status_by_account' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=87;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=88;
HANDLER performance_schema.socket_summary_by_instance OPEN;
ERROR HY000: Table storage engine for 'socket_summary_by_instance' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=86;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=87;
HANDLER performance_schema.socket_summary_by_event_name OPEN;
ERROR HY000: Table storage engine for 'socket_summary_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=85;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=86;
HANDLER performance_schema.socket_instances OPEN;
ERROR HY000: Table storage engine for 'socket_instances' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=84;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=85;
HANDLER performance_schema.setup_threads OPEN;
ERROR HY000: Table storage engine for 'setup_threads' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=83;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=84;
HANDLER performance_schema.setup_objects OPEN;
ERROR HY000: Table storage engine for 'setup_objects' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=82;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=83;
HANDLER performance_schema.setup_instruments OPEN;
ERROR HY000: Table storage engine for 'setup_instruments' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=81;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=82;
HANDLER performance_schema.setup_consumers OPEN;
ERROR HY000: Table storage engine for 'setup_consumers' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=80;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=81;
HANDLER performance_schema.setup_actors OPEN;
ERROR HY000: Table storage engine for 'setup_actors' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=79;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=80;
HANDLER performance_schema.session_variables OPEN;
ERROR HY000: Table storage engine for 'session_variables' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=78;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=79;
HANDLER performance_schema.session_status OPEN;
ERROR HY000: Table storage engine for 'session_status' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=77;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=78;
HANDLER performance_schema.session_connect_attrs OPEN;
ERROR HY000: Table storage engine for 'session_connect_attrs' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=76;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=77;
HANDLER performance_schema.session_account_connect_attrs OPEN;
ERROR HY000: Table storage engine for 'session_account_connect_attrs' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=75;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=76;
HANDLER performance_schema.rwlock_instances OPEN;
ERROR HY000: Table storage engine for 'rwlock_instances' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=74;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=75;
HANDLER performance_schema.replication_group_members OPEN;
ERROR HY000: Table storage engine for 'replication_group_members' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=73;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=74;
HANDLER performance_schema.replication_group_member_stats OPEN;
ERROR HY000: Table storage engine for 'replication_group_member_stats' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=72;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=73;
HANDLER performance_schema.replication_connection_status OPEN;
ERROR HY000: Table storage engine for 'replication_connection_status' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=71;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=72;
HANDLER performance_schema.replication_connection_configuration OPEN;
ERROR HY000: Table storage engine for 'replication_connection_configuration' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=70;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=71;
HANDLER performance_schema.replication_applier_status_by_worker OPEN;
ERROR HY000: Table storage engine for 'replication_applier_status_by_worker' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=69;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=70;
HANDLER performance_schema.replication_applier_status_by_coordinator OPEN;
ERROR HY000: Table storage engine for 'replication_applier_status_by_coordinator' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=68;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=69;
HANDLER performance_schema.replication_applier_status OPEN;
ERROR HY000: Table storage engine for 'replication_applier_status' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=67;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=68;
HANDLER performance_schema.replication_applier_global_filters OPEN;
ERROR HY000: Table storage engine for 'replication_applier_global_filters' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=66;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=67;
HANDLER performance_schema.replication_applier_filters OPEN;
ERROR HY000: Table storage engine for 'replication_applier_filters' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=65;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=66;
HANDLER performance_schema.replication_applier_configuration OPEN;
ERROR HY000: Table storage engine for 'replication_applier_configuration' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=64;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=65;
HANDLER performance_schema.prepared_statements_instances OPEN;
ERROR HY000: Table storage engine for 'prepared_statements_instances' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=63;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=64;
HANDLER performance_schema.persisted_variables OPEN;
ERROR HY000: Table storage engine for 'persisted_variables' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=62;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=63;
HANDLER performance_schema.performance_timers OPEN;
ERROR HY000: Table storage engine for 'performance_timers' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=61;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=62;
HANDLER performance_schema.objects_summary_global_by_type OPEN;
ERROR HY000: Table storage engine for 'objects_summary_global_by_type' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=60;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=61;
HANDLER performance_schema.mutex_instances OPEN;
ERROR HY000: Table storage engine for 'mutex_instances' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=59;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=60;
HANDLER performance_schema.metadata_locks OPEN;
ERROR HY000: Table storage engine for 'metadata_locks' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=58;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=59;
HANDLER performance_schema.memory_summary_global_by_event_name OPEN;
ERROR HY000: Table storage engine for 'memory_summary_global_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=57;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=58;
HANDLER performance_schema.memory_summary_by_user_by_event_name OPEN;
ERROR HY000: Table storage engine for 'memory_summary_by_user_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=56;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=57;
HANDLER performance_schema.memory_summary_by_thread_by_event_name OPEN;
ERROR HY000: Table storage engine for 'memory_summary_by_thread_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=55;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=56;
HANDLER performance_schema.memory_summary_by_host_by_event_name OPEN;
ERROR HY000: Table storage engine for 'memory_summary_by_host_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=54;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=55;
HANDLER performance_schema.memory_summary_by_account_by_event_name OPEN;
ERROR HY000: Table storage engine for 'memory_summary_by_account_by_event_name' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=54;
HANDLER performance_schema.instance_log_status OPEN;
ERROR HY000: Table storage engine for 'instance_log_status' doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=53;
HANDLER performance_schema.hosts OPEN;
ERROR HY000: Table storage engine for 'hosts' doesn't have this option
Expand Down
19 changes: 19 additions & 0 deletions mysql-test/suite/perfschema/r/dml_instance_log_status.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SELECT * FROM performance_schema.instance_log_status
LIMIT 1;
INSERT INTO performance_schema.instance_log_status
SET server_uuid='ABC123';
ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'instance_log_status'
UPDATE performance_schema.instance_log_status
SET server_uuid='ABC123' WHERE server_uuid=@@server_uuid;
ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'instance_log_status'
DELETE FROM performance_schema.instance_log_status
WHERE server_uuid=@@server_uuid;
ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'instance_log_status'
DELETE FROM performance_schema.instance_log_status;
ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'instance_log_status'
LOCK TABLES performance_schema.instance_log_status READ;
ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'instance_log_status'
UNLOCK TABLES;
LOCK TABLES performance_schema.instance_log_status WRITE;
ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'instance_log_status'
UNLOCK TABLES;
10 changes: 10 additions & 0 deletions mysql-test/suite/perfschema/r/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ performance_schema global_status def
performance_schema global_variables def
performance_schema host_cache def
performance_schema hosts def
performance_schema instance_log_status def
performance_schema memory_summary_by_account_by_event_name def
performance_schema memory_summary_by_host_by_event_name def
performance_schema memory_summary_by_thread_by_event_name def
Expand Down Expand Up @@ -160,6 +161,7 @@ global_status BASE TABLE PERFORMANCE_SCHEMA
global_variables BASE TABLE PERFORMANCE_SCHEMA
host_cache BASE TABLE PERFORMANCE_SCHEMA
hosts BASE TABLE PERFORMANCE_SCHEMA
instance_log_status BASE TABLE PERFORMANCE_SCHEMA
memory_summary_by_account_by_event_name BASE TABLE PERFORMANCE_SCHEMA
memory_summary_by_host_by_event_name BASE TABLE PERFORMANCE_SCHEMA
memory_summary_by_thread_by_event_name BASE TABLE PERFORMANCE_SCHEMA
Expand Down Expand Up @@ -265,6 +267,7 @@ global_status 10 Dynamic
global_variables 10 Dynamic
host_cache 10 Dynamic
hosts 10 Fixed
instance_log_status 10 Dynamic
memory_summary_by_account_by_event_name 10 Dynamic
memory_summary_by_host_by_event_name 10 Dynamic
memory_summary_by_thread_by_event_name 10 Dynamic
Expand Down Expand Up @@ -369,6 +372,7 @@ file_summary_by_event_name 0
file_summary_by_instance 0
host_cache 0
hosts 0
instance_log_status 0
memory_summary_by_account_by_event_name 0
memory_summary_by_host_by_event_name 0
memory_summary_by_thread_by_event_name 0
Expand Down Expand Up @@ -481,6 +485,7 @@ global_status 0 0
global_variables 0 0
host_cache 0 0
hosts 0 0
instance_log_status 0 0
memory_summary_by_account_by_event_name 0 0
memory_summary_by_host_by_event_name 0 0
memory_summary_by_thread_by_event_name 0 0
Expand Down Expand Up @@ -586,6 +591,7 @@ global_status 0 0 NULL
global_variables 0 0 NULL
host_cache 0 0 NULL
hosts 0 0 NULL
instance_log_status 0 0 NULL
memory_summary_by_account_by_event_name 0 0 NULL
memory_summary_by_host_by_event_name 0 0 NULL
memory_summary_by_thread_by_event_name 0 0 NULL
Expand Down Expand Up @@ -691,6 +697,7 @@ global_status NULL NULL NULL
global_variables NULL NULL NULL
host_cache NULL NULL NULL
hosts NULL NULL NULL
instance_log_status NULL NULL NULL
memory_summary_by_account_by_event_name NULL NULL NULL
memory_summary_by_host_by_event_name NULL NULL NULL
memory_summary_by_thread_by_event_name NULL NULL NULL
Expand Down Expand Up @@ -796,6 +803,7 @@ global_status utf8_general_ci NULL
global_variables utf8_general_ci NULL
host_cache utf8_general_ci NULL
hosts utf8_general_ci NULL
instance_log_status utf8_general_ci NULL
memory_summary_by_account_by_event_name utf8_general_ci NULL
memory_summary_by_host_by_event_name utf8_general_ci NULL
memory_summary_by_thread_by_event_name utf8_general_ci NULL
Expand Down Expand Up @@ -901,6 +909,7 @@ global_status
global_variables
host_cache
hosts
instance_log_status
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
Expand Down Expand Up @@ -1006,6 +1015,7 @@ global_status
global_variables
host_cache
hosts
instance_log_status
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/perfschema/r/schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ global_status
global_variables
host_cache
hosts
instance_log_status
memory_summary_by_account_by_event_name
memory_summary_by_host_by_event_name
memory_summary_by_thread_by_event_name
Expand Down
Loading

0 comments on commit 798ab78

Please sign in to comment.