1# 2# Verify that query results are the same with and without indexes. 3# 4--source include/have_debug_sync.inc 5--source include/have_debug.inc 6 7--echo # Prevent background threads to acquire mdl locks, which 8--echo # the result unstable 9SET GLOBAL innodb_fast_shutdown=0; 10let $restart_parameters = restart: --debug=d,do_not_meta_lock_in_background; 11--source include/restart_mysqld.inc 12 13let $table = "metadata_locks"; 14let $target_type = TABLE; 15let $target_schema = test; 16let $target_name = t1; 17 18--echo TABLE: $table 19--echo INDEXES: PK (OBJECT_INSTANCE_BEGIN), KEY (OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME), KEY (OWNER_THREAD_ID, OWNER_EVENT_ID) 20 21--source ../include/idx_compare_setup.inc 22 23--disable_query_log 24 25# Get an object_instance_begin 26 27--connection con1 28# Get MDL read lock 29LOCK TABLE t1 READ; 30 31--connection con2 32 33# User1 has a READ LOCK 34# User2 waiting for WRITE LOCK 35--send LOCK TABLE t1 write; 36 37--connection default 38 39# Wait for the LOCK TABLE t1 write to block 40let $wait_condition= 41 select count(*) = 1 from performance_schema.events_waits_current 42 where event_name = 'wait/lock/metadata/sql/mdl' 43 and object_name = 't1'; 44--source include/wait_condition.inc 45 46--connection default 47 48eval SELECT object_instance_begin, owner_event_id 49 INTO @object_instance_begin, @target_event_id 50 FROM performance_schema.metadata_locks 51 WHERE lock_type = 'SHARED_READ_ONLY' 52 AND owner_thread_id = $con1_thread_id 53 LIMIT 1; 54 55--enable_query_log 56 57#DEBUG SELECT @object_instance_begin, @owner_event_id; 58 59--echo 60--echo ## Test OBJECT_INSTANCE_BEGIN 61let $key_group = 12; 62--source ../include/idx_compare_load.inc 63 64--echo 65--echo ## Test OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME 66let $key_group = 10; 67--source ../include/idx_compare_load.inc 68 69--echo 70--echo ## Test OWNER_THREAD_ID, OWNER_EVENT_ID 71--disable_query_log 72eval SET @target_thread_id = $con1_thread_id; 73--enable_query_log 74let $key_group = 1.1; 75--source ../include/idx_compare_load.inc 76 77--connection con1 78 79# User1 releases a READ LOCK 80# User2 granted a WRITE LOCK 81UNLOCK TABLES; 82 83--connection con2 84 85# Complete LOCK TABLE t1 write 86--reap 87UNLOCK TABLES; 88 89--connection default 90 91--source ../include/idx_compare_cleanup.inc 92 93let $restart_parameters =; 94--source include/restart_mysqld.inc 95