Commit b090747
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: 55ee7f30816dfa75228f97e0e3c1edd99091e3051 parent b88b0fa commit b090747
File tree
76 files changed
+5493
-1244
lines changed- mysql-test
- include
- r
- suite
- perfschema
- r
- t
- rpl/r
- t
- sql
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 changedBinary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1545 | 1545 | | |
1546 | 1546 | | |
1547 | 1547 | | |
1548 | | - | |
1549 | | - | |
1550 | 1548 | | |
1551 | 1549 | | |
1552 | 1550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
421 | 433 | | |
422 | 434 | | |
423 | 435 | | |
| |||
0 commit comments