Skip to content

Commit b090747

Browse files
Dmitry LenevDmitry Lenev
authored andcommitted
Patch that refactors global read lock implementation and fixes
bug #57006 "Deadlock between HANDLER and FLUSH TABLES WITH READ LOCK" and bug #54673 "It takes too long to get readlock for 'FLUSH TABLES WITH READ LOCK'". The first bug manifested itself as a deadlock which occurred when a connection, which had some table open through HANDLER statement, tried to update some data through DML statement while another connection tried to execute FLUSH TABLES WITH READ LOCK concurrently. What happened was that FTWRL in the second connection managed to perform first step of GRL acquisition and thus blocked all upcoming DML. After that it started to wait for table open through HANDLER statement to be flushed. When the first connection tried to execute DML it has started to wait for GRL/the second connection creating deadlock. The second bug manifested itself as starvation of FLUSH TABLES WITH READ LOCK statements in cases when there was a constant stream of concurrent DML statements (in two or more connections). This has happened because requests for protection against GRL which were acquired by DML statements were ignoring presence of pending GRL and thus the latter was starved. This patch solves both these problems by re-implementing GRL using metadata locks. Similar to the old implementation acquisition of GRL in new implementation is two-step. During the first step we block all concurrent DML and DDL statements by acquiring global S metadata lock (each DML and DDL statement acquires global IX lock for its duration). During the second step we block commits by acquiring global S lock in COMMIT namespace (commit code acquires global IX lock in this namespace). Note that unlike in old implementation acquisition of protection against GRL in DML and DDL is semi-automatic. We assume that any statement which should be blocked by GRL will either open and acquires write-lock on tables or acquires metadata locks on objects it is going to modify. For any such statement global IX metadata lock is automatically acquired for its duration. The first problem is solved because waits for GRL become visible to deadlock detector in metadata locking subsystem and thus deadlocks like one in the first bug become impossible. The second problem is solved because global S locks which are used for GRL implementation are given preference over IX locks which are acquired by concurrent DML (and we can switch to fair scheduling in future if needed). Important change: FTWRL/GRL no longer blocks DML and DDL on temporary tables. Before this patch behavior was not consistent in this respect: in some cases DML/DDL statements on temporary tables were blocked while in others they were not. Since the main use cases for FTWRL are various forms of backups and temporary tables are not preserved during backups we have opted for consistently allowing DML/DDL on temporary tables during FTWRL/GRL. Important change: This patch changes thread state names which are used when DML/DDL of FTWRL is waiting for global read lock. It is now either "Waiting for global read lock" or "Waiting for commit lock" depending on the stage on which FTWRL is. Incompatible change: To solve deadlock in events code which was exposed by this patch we have to replace LOCK_event_metadata mutex with metadata locks on events. As result we have to prohibit DDL on events under LOCK TABLES. This patch also adds extensive test coverage for interaction of DML/DDL and FTWRL. Performance of new and old global read lock implementations in sysbench tests were compared. There were no significant difference between new and old implementations. --BZR-- revision-id: [email protected] property-branch-nick: mysql-5.5-rt-grl-2 property-file-info: ld7:file_id54:check_ftwrl_compatib-20101111053121-4y0hlfpui0pcdk1a-17:message106:Added helper script which allows to check that a statement is property-file-info: compatible with FLUSH TABLES WITH READ LOCK.4:path45:mysql-test/include/check_ftwrl_compatible.inced7:file_id54:check_ftwrl_incompat-20101111053126-qkyblxgmuxbh9e24-17:message108:Added helper script which allows to check that a statement is property-file-info: incompatible with FLUSH TABLES WITH READ LOCK.4:path47:mysql-test/include/check_ftwrl_incompatible.inced7:file_id65:sp1f-handler.test-20010406221832-gfvg6n4rp4py6lunazzembziuu5qxvi57:message157:Adjusted test case to the fact that now DROP TABLE closes property-file-info: open HANDLERs for the table to be dropped before checking property-file-info: if there active FTWRL in this connection.4:path30:mysql-test/include/handler.inced7:file_id54:wait_show_condition.-20090430104219-5wpgiqbtxqntaln6-17:message147:Fixed small error in the timeout message. The correct name property-file-info: of variable used as parameter for this script is "$condition" property-file-info: and not "$wait_condition".4:path42:mysql-test/include/wait_show_condition.inced7:file_id67:sp1f-delayed.result-20001228015633-d5brh5c3ulnb2qshtfvxu5cvvvxf4lsr7:message86:Added test coverage for scenario which triggered assert in property-file-info: metadata locking subsystem.4:path27:mysql-test/r/delayed.resulted7:file_id68:sp1f-events_2.result-20080220134043-aw2wj6et6tusosgnc5gwdxgmg5izv56z7:message78:Updated test results after prohibiting event DDL operations property-file-info: under LOCK TABLES.4:path28:mysql-test/r/events_2.resulted7:file_id65:sp1f-flush.result-20010323030458-fknoht4a4rohnwlkdtjcyx653fk3jumx7:message94:Added test coverage for bug #57006 "Deadlock between HANDLER property-file-info: and FLUSH TABLES WITH READ LOCK".4:path25:mysql-test/r/flush.resulted7:file_id54:flush_read_lock.resu-20101111053145-jlvu4glgv0sbkg5j-17:message85:Added test coverage for various aspects of FLUSH TABLES WITH property-file-info: READ LOCK functionality.4:path35:mysql-test/r/flush_read_lock.resulted7:file_id73:sp1f-flush_read_lock_kill-20041202220228-z2od4huv6466dfdd2nmbcgvn762q2wk67:message209:Adjusted test case after replacing custom global read lock property-file-info: implementation with one based on metadata locks. Use new property-file-info: debug_sync point. Do not disable concurrent inserts as now property-file-info: InnoDB we always use InnoDB table.4:path40:mysql-test/r/flush_read_lock_kill.resulted7:file_id73:sp1f-innodb_handler.resul-20020821205505-jopsqbjuqwwxb5hvf3r2wn37vobunxru7:message157:Adjusted test case to the fact that now DROP TABLE closes property-file-info: open HANDLERs for the table to be dropped before checking property-file-info: if there active FTWRL in this connection.4:path34:mysql-test/r/handler_innodb.resulted7:file_id67:sp1f-handler.result-20010406221832-ybo3cgjo6qapqc6776ivjpdngwmk6plu7:message157:Adjusted test case to the fact that now DROP TABLE closes property-file-info: open HANDLERs for the table to be dropped before checking property-file-info: if there active FTWRL in this connection.4:path34:mysql-test/r/handler_myisam.resulted7:file_id49:mdl_sync.result-20090302184602-k11i6o8vh2s5umno-17:message198:Adjusted test case after replacing custom global read lock property-file-info: implementation with one based on metadata locks. Replaced property-file-info: usage of GRL-specific debug_sync's with appropriate sync property-file-info: points in MDL subsystem.4:path28:mysql-test/r/mdl_sync.resulted7:file_id55:dml_setup_instrument-20100112014603-ubwjo2a0fk4thccy-517:message84:Updated test results after removing global property-file-info: COND_global_read_lock condition variable.4:path58:mysql-test/suite/perfschema/r/dml_setup_instruments.resulted7:file_id54:func_file_io.result-20100112014603-ubwjo2a0fk4thccy-547:message154:Ensure that this test doesn't affect subsequent tests. property-file-info: At the end of its execution enable back P_S instrumentation property-file-info: which this test disables at some point.4:path49:mysql-test/suite/perfschema/r/func_file_io.resulted7:file_id52:func_mutex.result-20100112014603-ubwjo2a0fk4thccy-557:message154:Ensure that this test doesn't affect subsequent tests. property-file-info: At the end of its execution enable back P_S instrumentation property-file-info: which this test disables at some point.4:path47:mysql-test/suite/perfschema/r/func_mutex.resulted7:file_id55:global_read_lock.res-20100112014603-ubwjo2a0fk4thccy-567:message84:Adjusted test case to take into account that new GRL property-file-info: implementation is based on MDL.4:path53:mysql-test/suite/perfschema/r/global_read_lock.resulted7:file_id53:server_init.result-20100112014603-ubwjo2a0fk4thccy-677:message155:Adjusted test case after replacing custom global read property-file-info: lock implementation with one based on MDL and replacing property-file-info: LOCK_event_metadata mutex with metadata lock.4:path48:mysql-test/suite/perfschema/r/server_init.resulted7:file_id53:func_file_io.test-20100112014603-ubwjo2a0fk4thccy-1277:message154:Ensure that this test doesn't affect subsequent tests. property-file-info: At the end of its execution enable back P_S instrumentation property-file-info: which this test disables at some point.4:path47:mysql-test/suite/perfschema/t/func_file_io.tested7:file_id51:func_mutex.test-20100112014603-ubwjo2a0fk4thccy-1287:message154:Ensure that this test doesn't affect subsequent tests. property-file-info: At the end of its execution enable back P_S instrumentation property-file-info: which this test disables at some point.4:path45:mysql-test/suite/perfschema/t/func_mutex.tested7:file_id56:global_read_lock.tes-20100112014603-ubwjo2a0fk4thccy-1297:message84:Adjusted test case to take into account that new GRL property-file-info: implementation is based on MDL.4:path51:mysql-test/suite/perfschema/t/global_read_lock.tested7:file_id52:server_init.test-20100112014603-ubwjo2a0fk4thccy-1447:message155:Adjusted test case after replacing custom global read property-file-info: lock implementation with one based on MDL and replacing property-file-info: LOCK_event_metadata mutex with metadata lock.4:path46:mysql-test/suite/perfschema/t/server_init.tested7:file_id54:rpl_tmp_table_and_dd-20091231103048-p7b9555jbqbbdi62-17:message68:Updated test results after prohibiting event DDL under property-file-info: LOCK TABLES. property-file-info: 4:path51:mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.resulted7:file_id65:sp1f-delayed.test-20001228015635-nfs6w3ic7qt55pnm6uld7wmmq4p73afq7:message86:Added test coverage for scenario which triggered assert in property-file-info: metadata locking subsystem.4:path25:mysql-test/t/delayed.tested7:file_id66:sp1f-events_2.test-20080220134043-okh45hgcrlp22r6sdwuzjmhcup7cfrdi7:message75:Updated test case after prohibiting event DDL operations property-file-info: under LOCK TABLES.4:path26:mysql-test/t/events_2.tested7:file_id63:sp1f-flush.test-20010323030458-7rtnbsox2xqacdijdaxl3yeinfs233eo7:message94:Added test coverage for bug #57006 "Deadlock between HANDLER property-file-info: and FLUSH TABLES WITH READ LOCK".4:path23:mysql-test/t/flush.tested7:file_id73:sp1f-flush_block_commit.t-20040820143520-5zriaxfh3i5xupxtwy6rt2g3vr2vp6ce7:message184:Adjusted test case after changing thread state name which property-file-info: is used when COMMIT waits for FLUSH TABLES WITH READ LOCK property-file-info: from "Waiting for release of readlock" to "Waiting for commit property-file-info: lock".4:path36:mysql-test/t/flush_block_commit.tested7:file_id73:sp1f-flush_block_commit_n-20061113160642-an6kkzh55ysli5obfvhvwomhgxpgm7ks7:message169:Adjusted test case after changing thread state name which is property-file-info: used when DML waits for FLUSH TABLES WITH READ LOCK. Now we property-file-info: use "Waiting for global read lock" in this case.4:path48:mysql-test/t/flush_block_commit_notembedded.tested7:file_id54:flush_read_lock.test-20101111053138-u9iwnkh3s6z4l1zn-17:message85:Added test coverage for various aspects of FLUSH TABLES WITH property-file-info: READ LOCK functionality.4:path33:mysql-test/t/flush_read_lock.tested7:file_id73:sp1f-flush_read_lock_kill-20041202220229-vtkips5ugeknksjxnoruxntpw4itzidi7:message152:We no longer need to use make_global_read_lock_block_commit_loop property-file-info: debug tag in this test. Instead we rely on an appropriate property-file-info: debug_sync point in MDL code.4:path44:mysql-test/t/flush_read_lock_kill-master.opted7:file_id73:sp1f-flush_read_lock_kill-20041202220229-cx7dgk5hubrznmauw6vq6lnvahvcwew57:message209:Adjusted test case after replacing custom global read lock property-file-info: implementation with one based on metadata locks. Use new property-file-info: debug_sync point. Do not disable concurrent inserts as now property-file-info: InnoDB we always use InnoDB table.4:path38:mysql-test/t/flush_read_lock_kill.tested7:file_id68:sp1f-lock_multi.test-20011008015806-67rpwlsigaymaevma2l42r5edbtot3fp7:message156:Adjusted test case after changing thread state names which property-file-info: are used when DML or DDL waits for FLUSH TABLES WITH READ property-file-info: LOCK to "Waiting for global read lock".4:path28:mysql-test/t/lock_multi.tested7:file_id47:mdl_sync.test-20090302184558-2nfnp7wh7pj6ra6e-17:message266:Adjusted test case after replacing custom global read lock property-file-info: implementation with one based on metadata locks. Replaced property-file-info: usage of GRL-specific debug_sync's with appropriate sync property-file-info: points in MDL subsystem. Updated thread state names which property-file-info: are used when DDL waits for FTWRL.4:path26:mysql-test/t/mdl_sync.tested7:file_id70:sp1f-triggergrant.test-20051110192456-j6hwzoi4loitpk57ccqotlhkzrm6ucsv7:message156:Adjusted test case after changing thread state names which property-file-info: are used when DML or DDL waits for FLUSH TABLES WITH READ property-file-info: LOCK to "Waiting for global read lock".4:path37:mysql-test/t/trigger_notembedded.tested7:file_id67:sp1f-event_timed.cc-20051205104456-ckd2gzuwhr4u5umqbncmt43nvv45pxmf7:message385:Removed Event_queue_element::status/last_executed_changed property-file-info: members and Event_queue_element::update_timing_fields() property-file-info: method. We no longer use this class for updating mysql.events property-file-info: once event is chosen for execution. Accesses to instances of property-file-info: this class in scheduler thread require protection by property-file-info: Event_queue::LOCK_event_queue mutex and we try to avoid property-file-info: updating table while holding this lock.4:path25:sql/event_data_objects.cced7:file_id66:sp1f-event_timed.h-20060620150533-lr25djmuizh5be5nbkd5g2hfysngecpn7:message385:Removed Event_queue_element::status/last_executed_changed property-file-info: members and Event_queue_element::update_timing_fields() property-file-info: method. We no longer use this class for updating mysql.events property-file-info: once event is chosen for execution. Accesses to instances of property-file-info: this class in scheduler thread require protection by property-file-info: Event_queue::LOCK_event_queue mutex and we try to avoid property-file-info: updating table while holding this lock.4:path24:sql/event_data_objects.hed7:file_id73:sp1f-event_db_repository.-20060627064838-k6rpjg72omnihtxhbubu6ht7wjvxggb77:message561:- Changed Event_db_repository methods to not release all property-file-info: metadata locks once they are done updating mysql.events property-file-info: table. This allows to keep metadata lock protecting property-file-info: against GRL and lock protecting particular event around property-file-info: until corresponding DDL statement is written to the binary property-file-info: log. property-file-info: - Removed logic for conditional update of "status" and property-file-info: "last_executed" fields from update_timing_fields_for_event() property-file-info: method. In the only case when this method is called now property-file-info: "last_executed" is always modified and tracking change property-file-info: of "status" is too much hassle.4:path26:sql/event_db_repository.cced7:file_id73:sp1f-event_db_repository.-20060627064839-ckucodefgivl3ypogwzecknmh6sftsdl7:message284:Removed logic for conditional update of "status" and property-file-info: "last_executed" fields from Event_db_repository:: property-file-info: update_timing_fields_for_event() method. property-file-info: In the only case when this method is called now "last_executed" property-file-info: is always modified and tracking change of "status" field is property-file-info: too much hassle.4:path25:sql/event_db_repository.hed7:file_id67:sp1f-event_queue.cc-20060627064839-q7xu2afcpcxmo57guv6fg4r5lc3eepwb7:message473:Changed event scheduler code not to update mysql.events property-file-info: table while holding Event_queue::LOCK_event_queue mutex. property-file-info: Doing so led to a deadlock with a new GRL implementation. property-file-info: This deadlock didn't occur with old implementation due to property-file-info: fact that code acquiring protection against GRL ignored property-file-info: pending GRL requests (which lead to GRL starvation). property-file-info: One of goals of new implementation is to disallow GRL property-file-info: starvation and so we have to solve problem with this property-file-info: deadlock in a different way.4:path18:sql/event_queue.cced7:file_id61:sp1f-event.cc-20051202122200-as66hughd4bhrhu2uqbb6mpogou2yihk7:message506:Changed methods of Events class to acquire protection property-file-info: against GRL while perfoming DDL statement and keep it property-file-info: until statement is written to the binary log. property-file-info: Unfortunately this step together with new GRL implementation property-file-info: exposed deadlock involving Events::LOCK_event_metadata property-file-info: and GRL. To solve it Events::LOCK_event_metadata mutex was property-file-info: replaced with a metadata lock on event. As a side-effect property-file-info: events DDL has to be prohibited under LOCK TABLES even in property-file-info: cases when mysql.events table was explicitly locked for property-file-info: write.4:path13:sql/events.cced7:file_id60:sp1f-event.h-20051202122201-5zk35gz7st76sbull4634hwsro2wrq5d7:message73:Replaced Events::LOCK_event_metadata mutex with a metadata property-file-info: lock on event.4:path12:sql/events.hed7:file_id69:sp1f-ha_ndbcluster.cc-20040414175836-rvqnoxrkqexyhfu3d62s4t345ip7rez27:message235:Updated code after replacing custom global read lock property-file-info: implementation with one based on MDL. Since MDL subsystem property-file-info: should now be able to detect deadlocks involving metadata property-file-info: locks and GRL there is no need for special handling of property-file-info: active GRL.4:path20:sql/ha_ndbcluster.cced7:file_id63:sp1f-handler.cc-19700101030959-ta6zfrlbxzucylciyro3musjsdpocrdh7:message243:Replaced custom implementation of global read lock with property-file-info: one based on metadata locks. Consequently when doing property-file-info: commit instead of calling method of Global_read_lock property-file-info: class to acquire protection against GRL we simply acquire property-file-info: IX in COMMIT namespace.4:path14:sql/handler.cced7:file_id60:sp1f-lock.cc-19700101030959-lzrt5tyolna3dcihuenjh7nlicr7llt77:message2195:Replaced custom implementation of global read lock with property-file-info: one based on metadata locks. This step allows to expose property-file-info: wait for GRL to deadlock detector of MDL subsystem and property-file-info: thus succesfully resolve deadlocks similar to one behind property-file-info: bug #57006 "Deadlock between HANDLER and FLUSH TABLES property-file-info: WITH READ LOCK". It also solves problem with GRL starvation property-file-info: described in bug #54673 "It takes too long to get readlock property-file-info: for 'FLUSH TABLES WITH READ LOCK'" since metadata locks used property-file-info: by GRL give preference to FTWRL statement instead of DML property-file-info: statements (if needed in future this can be changed to property-file-info: fair scheduling). property-file-info: property-file-info: Similar to old implementation of acquisition of GRL is property-file-info: two-step. During the first step we block all concurrent property-file-info: DML and DDL statements by acquiring global S metadata lock property-file-info: (each DML and DDL statement acquires global IX lock for property-file-info: its duration). During the second step we block commits by property-file-info: acquiring global S lock in COMMIT namespace (commit code property-file-info: acquires global IX lock in this namespace). property-file-info: property-file-info: Note that unlike in old implementation acquisition of property-file-info: protection against GRL in DML and DDL is semi-automatic. property-file-info: We assume that any statement which should be blocked by GRL property-file-info: will either open and acquires write-lock on tables or acquires property-file-info: metadata locks on objects it is going to modify. For any such property-file-info: statement global IX metadata lock is automatically acquired property-file-info: for its duration. property-file-info: property-file-info: To support this change: property-file-info: - Global_read_lock::lock/unlock_global_read_lock and property-file-info: make_global_read_lock_block_commit methods were changed property-file-info: accordingly. property-file-info: - Global_read_lock::wait_if_global_read_lock() and property-file-info: start_waiting_global_read_lock() methods were dropped. property-file-info: It is now responsibility of code acquiring metadata locks property-file-info: opening tables to acquire protection against GRL by property-file-info: explicitly taking global IX lock with statement duration. property-file-info: - Global variables, mutex and condition variable used by property-file-info: old implementation was removed. property-file-info: - lock_routine_name() was changed to use statement duration for property-file-info: its global IX lock. It was also renamed to lock_object_name() property-file-info: as it now also used to take metadata locks on events. property-file-info: - Global_read_lock::set_explicit_lock_duration() was added which property-file-info: allows not to release locks used for GRL when leaving prelocked property-file-info: mode.4:path11:sql/lock.cced7:file_id41:lock.h-20100331135644-cgcb6oowzqyx7fi3-107:message204:- Renamed lock_routine_name() to lock_object_name() and changed property-file-info: its signature to allow its usage for events. property-file-info: - Removed broadcast_refresh() function. It is no longer needed property-file-info: with new GRL implementation.4:path10:sql/lock.hed7:file_id65:sp1f-log_event.cc-19700101030959-msmqlflsngxosswid2hpzxly5vfqdddc7:message217:Release metadata locks with statement duration at the end property-file-info: of processing legacy event for LOAD DATA. This ensures that property-file-info: replication thread processing such event properly releases property-file-info: its protection against global read lock.4:path16:sql/log_event.cced7:file_id40:mdl.cc-20080523121737-j62pi0m62eaw1hq6-17:message1991:Changed MDL subsystem to support new MDL-based implementation property-file-info: of global read lock. property-file-info: property-file-info: Added COMMIT and EVENTS namespaces for metadata locks. Changed property-file-info: thread state name for GLOBAL namespace to "Waiting for global property-file-info: read lock". property-file-info: property-file-info: Optimized MDL_map::find_or_insert() method to avoid taking property-file-info: m_mutex mutex when looking up MDL_lock objects for GLOBAL property-file-info: or COMMIT namespaces. We keep pre-created MDL_lock objects property-file-info: for these namespaces around and simply return pointers to property-file-info: these global objects when needed. property-file-info: property-file-info: Changed MDL_lock/MDL_scoped_lock to properly handle property-file-info: notification of insert delayed handler threads when FTWRL property-file-info: takes global S lock. property-file-info: property-file-info: Introduced concept of lock duration. In addition to locks with property-file-info: transaction duration which work in the way which is similar to property-file-info: how locks worked before (i.e. they are released at the end of property-file-info: transaction), locks with statement and explicit duration were property-file-info: introduced. property-file-info: Locks with statement duration are automatically released at the property-file-info: end of statement. Locks with explicit duration require explicit property-file-info: release and obsolete concept of transactional sentinel. property-file-info: property-file-info: * Changed MDL_request and MDL_ticket classes to support notion property-file-info: of duration. property-file-info: * Changed MDL_context to keep locks with different duration in property-file-info: different lists. Changed code handling ticket list to take property-file-info: this into account. property-file-info: * Changed methods responsible for releasing locks to take into property-file-info: account duration of tickets. Particularly public property-file-info: MDL_context::release_lock() method now only can release property-file-info: tickets with explicit duration (there is still internal property-file-info: method which allows to specify duration). To release locks property-file-info: with statement or transaction duration one have to use property-file-info: release_statement/transactional_locks() methods. property-file-info: * Concept of savepoint for MDL subsystem now has to take into property-file-info: account locks with statement duration. Consequently property-file-info: MDL_savepoint class was introduced and methods working with property-file-info: savepoints were updated accordingly. property-file-info: * Added methods which allow to set duration for one or all property-file-info: locks in the context.4:path10:sql/mdl.cced7:file_id39:mdl.h-20080523121748-o4y2wcq3maotb9do-17:message1508:Changed MDL subsystem to support new MDL-based implementation property-file-info: of global read lock. property-file-info: property-file-info: Added COMMIT and EVENTS namespaces for metadata locks. property-file-info: property-file-info: Introduced concept of lock duration. In addition to locks with property-file-info: transaction duration which work in the way which is similar to property-file-info: how locks worked before (i.e. they are released at the end of property-file-info: transaction), locks with statement and explicit duration were property-file-info: introduced. property-file-info: Locks with statement duration are automatically released at the property-file-info: end of statement. Locks with explicit duration require explicit property-file-info: release and obsolete concept of transactional sentinel. property-file-info: property-file-info: * Changed MDL_request and MDL_ticket classes to support notion property-file-info: of duration. property-file-info: * Changed MDL_context to keep locks with different duration in property-file-info: different lists. Changed code handling ticket list to take property-file-info: this into account. property-file-info: * Changed methods responsible for releasing locks to take into property-file-info: account duration of tickets. Particularly public property-file-info: MDL_context::release_lock() method now only can release property-file-info: tickets with explicit duration (there is still internal property-file-info: method which allows to specify duration). To release locks property-file-info: with statement or transaction duration one have to use property-file-info: release_statement/transactional_locks() methods. property-file-info: * Concept of savepoint for MDL subsystem now has to take into property-file-info: account locks with statement duration. Consequently property-file-info: MDL_savepoint class was introduced and methods working with property-file-info: savepoints were updated accordingly. property-file-info: * Added methods which allow to set duration for one or all property-file-info: locks in the context.4:path9:sql/mdl.hed7:file_id62:sp1f-mysqld.cc-19700101030959-zpswdvekpvixxzxf7gdtofzel7nywtfj7:message211:Removed global mutex and condition variables which were used property-file-info: by old implementation of GRL. property-file-info: Also we no longer need to initialize Events::LOCK_event_metadata property-file-info: mutex as it was replaced with metadata locks on events.4:path13:sql/mysqld.cced7:file_id43:mysqld.h-20100331135644-cgcb6oowzqyx7fi3-117:message100:Removed global variable, mutex and condition variables which property-file-info: were used by old implementation of GRL.4:path12:sql/mysqld.hed7:file_id63:sp1f-rpl_rli.cc-20061031112305-25t7pxjrjm24qo5h65c7rml66xu3uw4p7:message159:When slave thread closes tables which were open for handling property-file-info: of RBR events ensure that it releases global IX lock which property-file-info: was acquired as protection against GRL.4:path14:sql/rpl_rli.cced7:file_id58:sp1f-sp.cc-20021212121421-6xwuvxq5bku2b4yv655kp2e5gsvautd57:message245:Adjusted code to the new signature of lock_object/routine_name(), property-file-info: to the fact that one now needs specify duration of lock when property-file-info: initializing MDL_request and to the fact that savepoints for MDL property-file-info: subsystem are now represented by MDL_savepoint class.4:path9:sql/sp.cced7:file_id63:sp1f-sp_head.cc-20021208185920-jtgc5wvyqdnu2gvcdus3gazrfhxbofxd7:message250:Ensure that statements in stored procedures release statement property-file-info: metadata locks and thus release their protectiong against GRL property-file-info: in proper moment in time. property-file-info: Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request.4:path14:sql/sp_head.cced7:file_id54:sql_table_maintenanc-20100813113324-ljhzawblfs477jro-27:message100:Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request.4:path16:sql/sql_admin.cced7:file_id64:sp1f-sql_base.cc-19700101030959-w7tul2gb2n4jzayjwlslj3ybmf3uhk6a7:message1359:- Implemented support for new approach to acquiring protection property-file-info: against global read lock. We no longer acquire such protection property-file-info: explicitly on the basis of statement flags. Instead we always property-file-info: rely on code which is responsible for acquiring metadata locks property-file-info: on object to be changed acquiring this protection. This is property-file-info: achieved by acquiring global IX metadata lock with statement property-file-info: duration. Code doing this also responsible for checking that property-file-info: current connection has no active GRL by calling an property-file-info: Global_read_lock::can_acquire_protection() method. property-file-info: Changed code in open_table() and lock_table_names() property-file-info: accordingly. property-file-info: Note that as result of this change DDL and DML on temporary property-file-info: tables is always compatible with GRL (before it was property-file-info: incompatible in some cases and compatible in other cases). property-file-info: - To speed-up code acquiring protection against GRL introduced property-file-info: m_has_protection_against_grl member in Open_table_context property-file-info: class. It indicates that protection was already acquired property-file-info: sometime during open_tables() execution and new attempts property-file-info: can be skipped. property-file-info: - Thanks to new GRL implementation calls to broadcast_refresh() property-file-info: became unnecessary and were removed. property-file-info: - Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request and to the fact that property-file-info: savepoints for MDL subsystem are now represented by property-file-info: MDL_savepoint class.4:path15:sql/sql_base.cced7:file_id45:sql_base.h-20100331135644-cgcb6oowzqyx7fi3-127:message292:Adjusted code to the fact that savepoints for MDL subsystem are property-file-info: now represented by MDL_savepoint class. property-file-info: Also introduced Open_table_context::m_has_protection_against_grl property-file-info: member which allows to avoid acquiring protection against GRL property-file-info: while opening tables if such protection was already acquired.4:path14:sql/sql_base.hed7:file_id65:sp1f-sql_class.cc-19700101030959-rpotnweaff2pikkozh3butrf7mv3oero7:message150:Changed THD::leave_locked_tables_mode() after transactional property-file-info: sentinel for metadata locks was obsoleted by introduction of property-file-info: locks with explicit duration.4:path16:sql/sql_class.cced7:file_id64:sp1f-sql_class.h-19700101030959-jnqnbrjyqsvgncsibnumsmg3lyi7pa5s7:message993:- Adjusted code to the fact that savepoints for MDL subsystem property-file-info: are now represented by MDL_savepoint class. property-file-info: - Changed Global_read_lock class according to changes in property-file-info: global read lock implementation: property-file-info: * wait_if_global_read_lock and start_waiting_global_read_lock property-file-info: are now gone. Instead code needing protection against GRL property-file-info: has to acquire global IX metadata lock with statement property-file-info: duration itself. To help it new can_acquire_protection() property-file-info: was introduced. Also as result of the above change property-file-info: m_protection_count member is gone too. property-file-info: * Added m_mdl_blocks_commits_lock member to store metadata property-file-info: lock blocking commits. property-file-info: * Adjusted code to the fact that concept of transactional property-file-info: sentinel was obsoleted by concept of lock duration. property-file-info: - Removed CF_PROTECT_AGAINST_GRL flag as it is no longer property-file-info: necessary. New GRL implementation acquires protection property-file-info: against global read lock automagically when statement property-file-info: acquires metadata locks on tables or other objects it property-file-info: is going to change.4:path15:sql/sql_class.hed7:file_id62:sp1f-sql_db.cc-19700101030959-hyw6zjuisjyda5cj5746a2zzuzz5yibr7:message100:Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request.4:path13:sql/sql_db.cced7:file_id67:sp1f-sql_handler.cc-20010406221833-l4tsiortoyipmoyajcoz2tcdppvyeltl7:message251:Removed call to broadcast_refresh() function. It is no longer property-file-info: needed with new GRL implementation. property-file-info: Adjusted code after introducing duration concept for metadata property-file-info: locks. Particularly to the fact transactional sentinel was property-file-info: replaced with explicit duration.4:path18:sql/sql_handler.cced7:file_id48:sql_handler.h-20100331135644-cgcb6oowzqyx7fi3-207:message169:Renamed mysql_ha_move_tickets_after_trans_sentinel() to property-file-info: mysql_ha_set_explicit_lock_duration() after transactional property-file-info: sentinel was obsoleted by locks with explicit duration.4:path17:sql/sql_handler.hed7:file_id66:sp1f-sql_insert.cc-19700101030959-xgwqe5svnimxudzdcuitauljzz2zjk5g7:message371:Adjusted code handling delaying inserts after switching to property-file-info: new GRL implementation. Now connection thread initiating property-file-info: delayed insert has to acquire global IX lock in addition property-file-info: to metadata lock on table being inserted into. This IX lock property-file-info: protects against GRL and similarly to SW lock on table being property-file-info: inserted into has to be passed to handler thread in order to property-file-info: avoid deadlocks.4:path17:sql/sql_insert.cced7:file_id63:sp1f-sql_lex.cc-19700101030959-4pizwlu5rqkti27gcwsvxkawq6bc2kph7:message168:LEX::protect_against_global_read_lock member is no longer property-file-info: necessary since protection against GRL is automatically property-file-info: taken by code acquiring metadata locks/opening tables.4:path14:sql/sql_lex.cced7:file_id62:sp1f-sql_lex.h-19700101030959-sgldb2sooc7twtw5q7pgjx7qzqiaa3sn7:message168:LEX::protect_against_global_read_lock member is no longer property-file-info: necessary since protection against GRL is automatically property-file-info: taken by code acquiring metadata locks/opening tables.4:path13:sql/sql_lex.hed7:file_id65:sp1f-sql_parse.cc-19700101030959-ehcre3rwhv5l3mlxqhaxg36ujenxnrcd7:message833:- Implemented support for new approach to acquiring protection property-file-info: against global read lock. We no longer acquire such protection property-file-info: explicitly on the basis of statement flags. Instead we always property-file-info: rely on code which is responsible for acquiring metadata locks property-file-info: on object to be changed acquiring this protection. This is property-file-info: achieved by acquiring global IX metadata lock with statement property-file-info: duration. This lock is automatically released at the end of property-file-info: statement execution. property-file-info: - Changed implementation of CREATE/DROP PROCEDURE/FUNCTION not property-file-info: to release metadata locks and thus protection against of GRL property-file-info: in the middle of statement execution. property-file-info: - Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request and to the fact that property-file-info: savepoints for MDL subsystem are now represented by property-file-info: MDL_savepoint class.4:path16:sql/sql_parse.cced7:file_id67:sp1f-sql_prepare.cc-20020612210720-gtqjjiu7vpmfxb5xct2qke7urmqcabli7:message110:Adjusted code to the to the fact that savepoints for MDL property-file-info: subsystem are now represented by MDL_savepoint class.4:path18:sql/sql_prepare.cced7:file_id66:sp1f-sql_rename.cc-20000821000147-ltbepgfv52umnrkaxzycedl5p2tlr3fp7:message203:With new GRL implementation there is no need to explicitly property-file-info: acquire protection against GRL before renaming tables. property-file-info: This happens automatically in code which acquires metadata property-file-info: locks on tables being renamed.4:path17:sql/sql_rename.cced7:file_id64:sp1f-sql_show.cc-19700101030959-umlljfnpplg452h7reeyqr4xnbmlkvfj7:message193:Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request and to the fact that property-file-info: savepoints for MDL subsystem are now represented by property-file-info: MDL_savepoint class.4:path15:sql/sql_show.cced7:file_id65:sp1f-sql_table.cc-19700101030959-tzdkvgigezpuaxnldqh3fx2h7h2ggslu7:message481:- With new GRL implementation there is no need to explicitly property-file-info: acquire protection against GRL before dropping tables. property-file-info: This happens automatically in code which acquires metadata property-file-info: locks on tables being dropped. property-file-info: - Changed mysql_alter_table() not to release lock on new table property-file-info: name explicitly and to rely on automatic release of locks property-file-info: at the end of statement instead. This was necessary since property-file-info: now MDL_context::release_lock() is supported only for locks property-file-info: for explicit duration.4:path16:sql/sql_table.cced7:file_id67:sp1f-sql_trigger.cc-20040907122911-35k3wamrp6g7qsupxe7hisftpobcwin57:message230:With new GRL implementation there is no need to explicitly property-file-info: acquire protection against GRL before changing table triggers. property-file-info: This happens automatically in code which acquires metadata property-file-info: locks on tables which triggers are to be changed.4:path18:sql/sql_trigger.cced7:file_id66:sp1f-sql_update.cc-19700101030959-edlgskfuer2ylczbw2znrr5gzfefiyw77:message201:Fix bug exposed by GRL testing. During prepare phase acquire property-file-info: only S metadata locks instead of SW locks to keep prepare of property-file-info: multi-UPDATE compatible with concurrent LOCK TABLES WRITE property-file-info: and global read lock.4:path17:sql/sql_update.cced7:file_id64:sp1f-sql_view.cc-20040715221517-nw4p4mja6nzzlvwwhzfgfqb4umxqobe47:message198:With new GRL implementation there is no need to explicitly property-file-info: acquire protection against GRL before creating view. property-file-info: This happens automatically in code which acquires metadata property-file-info: lock on view to be created.4:path15:sql/sql_view.cced7:file_id64:sp1f-sql_yacc.yy-19700101030959-wvn4qyy2drpmge7kaq3dysprbhlrv27j7:message168:LEX::protect_against_global_read_lock member is no longer property-file-info: necessary since protection against GRL is automatically property-file-info: taken by code acquiring metadata locks/opening tables.4:path15:sql/sql_yacc.yyed7:file_id61:sp1f-table.cc-19700101030959-nsxtem2adyqzwe6nz4cgrpcmts3o54v77:message100:Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request.4:path12:sql/table.cced7:file_id60:sp1f-table.h-19700101030959-dv72bajftxj5fbdjuajquappanuv2ija7:message100:Adjusted code to the fact that one now needs specify duration property-file-info: of lock when initializing MDL_request.4:path11:sql/table.hed7:file_id48:transaction.cc-20080807231139-0scowboulgaz4j08-17:message336:Replaced custom implementation of global read lock with property-file-info: one based on metadata locks. Consequently when doing property-file-info: commit instead of calling method of Global_read_lock property-file-info: class to acquire protection against GRL we simply acquire property-file-info: IX in COMMIT namespace. property-file-info: Also adjusted code to the fact that MDL savepoint is now property-file-info: represented by MDL_savepoint class.4:path18:sql/transaction.ccee testament3-sha1: 55ee7f30816dfa75228f97e0e3c1edd99091e305
1 parent b88b0fa commit b090747

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+5493
-1244
lines changed

.bzrfileids

265 Bytes
Binary file not shown.
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#
2+
# SUMMARY
3+
# Check that a statement is compatible with FLUSH TABLES WITH READ LOCK.
4+
#
5+
# PARAMETERS
6+
# $con_aux1 Name of the 1st aux connection to be used by this script.
7+
# $con_aux2 Name of the 2nd aux connection to be used by this script.
8+
# $statement The statement to be checked.
9+
# $cleanup_stmt The statement to be run in order to revert effects of
10+
# the statement to be checked.
11+
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
12+
# stage is to check that metadata locks taken by this
13+
# statement are compatible with metadata locks taken
14+
# by FTWRL.
15+
#
16+
# EXAMPLE
17+
# flush_read_lock.test
18+
#
19+
--disable_result_log
20+
--disable_query_log
21+
22+
# Reset DEBUG_SYNC facility for safety.
23+
set debug_sync= "RESET";
24+
25+
#
26+
# First, check that the statement can be run under FTWRL.
27+
#
28+
flush tables with read lock;
29+
--disable_abort_on_error
30+
--eval $statement
31+
--enable_abort_on_error
32+
let $err= $mysql_errno;
33+
if (!$err)
34+
{
35+
--echo Success: Was able to run '$statement' under FTWRL.
36+
unlock tables;
37+
if (`SELECT "$cleanup_stmt" <> ""`)
38+
{
39+
--eval $cleanup_stmt;
40+
}
41+
}
42+
if ($err)
43+
{
44+
--echo Error: Wasn't able to run '$statement' under FTWRL!
45+
unlock tables;
46+
}
47+
48+
#
49+
# Then check that this statement won't be blocked by FTWRL
50+
# that is active in another connection.
51+
#
52+
connection $con_aux1;
53+
flush tables with read lock;
54+
55+
connection default;
56+
--send_eval $statement;
57+
58+
connection $con_aux1;
59+
60+
--enable_result_log
61+
--enable_query_log
62+
let $wait_condition=
63+
select count(*) = 0 from information_schema.processlist
64+
where info = "$statement";
65+
--source include/wait_condition.inc
66+
--disable_result_log
67+
--disable_query_log
68+
69+
if ($success)
70+
{
71+
--echo Success: Was able to run '$statement' with FTWRL active in another connection.
72+
73+
connection default;
74+
# Apparently statement was successfully executed and so
75+
# was not blocked by FTWRL.
76+
# To be safe against wait_condition.inc succeeding due to
77+
# races let us first reap the statement being checked to
78+
# ensure that it has been successfully executed.
79+
--reap
80+
81+
connection $con_aux1;
82+
unlock tables;
83+
84+
connection default;
85+
}
86+
if (!$success)
87+
{
88+
--echo Error: Wasn't able to run '$statement' with FTWRL active in another connection!
89+
unlock tables;
90+
connection default;
91+
--reap
92+
}
93+
94+
if (`SELECT "$cleanup_stmt" <> ""`)
95+
{
96+
--eval $cleanup_stmt;
97+
}
98+
99+
if (`SELECT "$skip_3rd_check" = ""`)
100+
{
101+
#
102+
# Finally, let us check that FTWRL will succeed if this statement
103+
# is active but has already closed its tables.
104+
#
105+
connection default;
106+
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
107+
--send_eval $statement;
108+
109+
connection $con_aux1;
110+
set debug_sync="now WAIT_FOR parked";
111+
--send flush tables with read lock
112+
113+
connection $con_aux2;
114+
--enable_result_log
115+
--enable_query_log
116+
let $wait_condition=
117+
select count(*) = 0 from information_schema.processlist
118+
where info = "flush tables with read lock";
119+
--source include/wait_condition.inc
120+
--disable_result_log
121+
--disable_query_log
122+
123+
if ($success)
124+
{
125+
--echo Success: Was able to run FTWRL while '$statement' was active in another connection.
126+
connection $con_aux1;
127+
# Apparently FTWRL was successfully executed and so was not blocked by
128+
# the statement being checked. To be safe against wait_condition.inc
129+
# succeeding due to races let us first reap the FTWRL to ensure that it
130+
# has been successfully executed.
131+
--reap
132+
unlock tables;
133+
set debug_sync="now SIGNAL go";
134+
connection default;
135+
--reap
136+
}
137+
if (!$success)
138+
{
139+
--echo Error: Wasn't able to run FTWRL while '$statement' was active in another connection!
140+
set debug_sync="now SIGNAL go";
141+
connection default;
142+
--reap
143+
connection $con_aux1;
144+
--reap
145+
unlock tables;
146+
connection default;
147+
}
148+
149+
set debug_sync= "RESET";
150+
if (`SELECT "$cleanup_stmt" <> ""`)
151+
{
152+
--eval $cleanup_stmt;
153+
}
154+
155+
}
156+
157+
--enable_result_log
158+
--enable_query_log
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#
2+
# SUMMARY
3+
# Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK.
4+
#
5+
# PARAMETERS
6+
# $con_aux1 Name of the 1st aux connection to be used by this script.
7+
# $con_aux2 Name of the 2nd aux connection to be used by this script.
8+
# $statement The statement to be checked.
9+
# $cleanup_stmt1 The 1st statement to be run in order to revert effects
10+
# of statement to be checked.
11+
# $cleanup_stmt2 The 2nd statement to be run in order to revert effects
12+
# of statement to be checked.
13+
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
14+
# stage is to check that metadata locks taken by this
15+
# statement are incompatible with metadata locks taken
16+
# by FTWRL.
17+
#
18+
# EXAMPLE
19+
# flush_read_lock.test
20+
#
21+
--disable_result_log
22+
--disable_query_log
23+
24+
# Reset DEBUG_SYNC facility for safety.
25+
set debug_sync= "RESET";
26+
27+
#
28+
# First, check that the statement cannot be run under FTWRL.
29+
#
30+
flush tables with read lock;
31+
--disable_abort_on_error
32+
--eval $statement
33+
--enable_abort_on_error
34+
let $err= $mysql_errno;
35+
if ($err)
36+
{
37+
--echo Success: Was not able to run '$statement' under FTWRL.
38+
unlock tables;
39+
}
40+
if (!$err)
41+
{
42+
--echo Error: Was able to run '$statement' under FTWRL!
43+
unlock tables;
44+
if (`SELECT "$cleanup_stmt1" <> ""`)
45+
{
46+
--eval $cleanup_stmt1;
47+
}
48+
if (`SELECT "$cleanup_stmt2" <> ""`)
49+
{
50+
--eval $cleanup_stmt2;
51+
}
52+
}
53+
54+
55+
#
56+
# Then check that this statement is blocked by FTWRL
57+
# that is active in another connection.
58+
#
59+
connection $con_aux1;
60+
flush tables with read lock;
61+
62+
connection default;
63+
--send_eval $statement;
64+
65+
connection $con_aux1;
66+
67+
--enable_result_log
68+
--enable_query_log
69+
let $wait_condition=
70+
select count(*) = 1 from information_schema.processlist
71+
where (state = "Waiting for global read lock" or
72+
state = "Waiting for commit lock") and
73+
info = "$statement";
74+
--source include/wait_condition.inc
75+
--disable_result_log
76+
--disable_query_log
77+
78+
if ($success)
79+
{
80+
--echo Success: '$statement' is blocked by FTWRL active in another connection.
81+
}
82+
if (!$success)
83+
{
84+
--echo Error: '$statement' wasn't blocked by FTWRL active in another connection!
85+
}
86+
unlock tables;
87+
88+
connection default;
89+
--reap
90+
91+
if (`SELECT "$cleanup_stmt1" <> ""`)
92+
{
93+
--eval $cleanup_stmt1;
94+
}
95+
if (`SELECT "$cleanup_stmt2" <> ""`)
96+
{
97+
--eval $cleanup_stmt2;
98+
}
99+
100+
if (`SELECT "$skip_3rd_check" = ""`)
101+
{
102+
#
103+
# Finally, let us check that FTWRL will not succeed if this
104+
# statement is active but has already closed its tables.
105+
#
106+
connection default;
107+
--eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
108+
--send_eval $statement;
109+
110+
connection $con_aux1;
111+
set debug_sync="now WAIT_FOR parked";
112+
--send flush tables with read lock
113+
114+
connection $con_aux2;
115+
--enable_result_log
116+
--enable_query_log
117+
let $wait_condition=
118+
select count(*) = 1 from information_schema.processlist
119+
where (state = "Waiting for global read lock" or
120+
state = "Waiting for commit lock") and
121+
info = "flush tables with read lock";
122+
--source include/wait_condition.inc
123+
--disable_result_log
124+
--disable_query_log
125+
126+
if ($success)
127+
{
128+
--echo Success: FTWRL is blocked when '$statement' is active in another connection.
129+
}
130+
if (!$success)
131+
{
132+
--echo Error: FTWRL isn't blocked when '$statement' is active in another connection!
133+
}
134+
set debug_sync="now SIGNAL go";
135+
connection default;
136+
--reap
137+
connection $con_aux1;
138+
--reap
139+
unlock tables;
140+
connection default;
141+
142+
set debug_sync= "RESET";
143+
144+
if (`SELECT "$cleanup_stmt1" <> ""`)
145+
{
146+
--eval $cleanup_stmt1;
147+
}
148+
if (`SELECT "$cleanup_stmt2" <> ""`)
149+
{
150+
--eval $cleanup_stmt2;
151+
}
152+
}
153+
154+
--enable_result_log
155+
--enable_query_log

mysql-test/include/handler.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,8 +1545,6 @@ lock table not_exists_write read;
15451545
--echo # We still have the read lock.
15461546
--error ER_CANT_UPDATE_WITH_READLOCK
15471547
drop table t1;
1548-
handler t1 read next;
1549-
handler t1 close;
15501548
handler t1 open;
15511549
select a from t2;
15521550
handler t1 read next;

mysql-test/include/wait_show_condition.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if (`SELECT '$wait_for_all' = '1'`)
101101

102102
if (!$found)
103103
{
104-
echo # Timeout in include/wait_show_condition.inc for $wait_condition;
104+
echo # Timeout in include/wait_show_condition.inc for $condition;
105105
echo # show_statement : $show_statement;
106106
echo # field : $field;
107107
echo # condition : $condition;

mysql-test/r/delayed.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,18 @@ COMMIT;
418418
UNLOCK TABLES;
419419
# Connection con1
420420
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
421+
# Connection default
422+
# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
423+
# This test has triggered some asserts in metadata locking
424+
# subsystem at some point in time..
425+
LOCK TABLE t1 WRITE;
426+
INSERT DELAYED INTO t2 VALUES (7);
427+
UNLOCK TABLES;
428+
SET AUTOCOMMIT= 0;
429+
LOCK TABLE t1 WRITE;
430+
INSERT DELAYED INTO t2 VALUES (8);
431+
UNLOCK TABLES;
432+
SET AUTOCOMMIT= 1;
421433
# Connection con2
422434
# Connection con1
423435
# Connection default

0 commit comments

Comments
 (0)