mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
ce5c87a3d3
---------------------------------------------------------- revno: 2617.69.20 committer: Konstantin Osipov <kostja@sun.com> branch nick: 5.4-4284-1-assert timestamp: Thu 2009-08-13 18:29:55 +0400 message: WL#4284 "Transactional DDL locking" A review fix. Since WL#4284 implementation separated MDL_request and MDL_ticket, MDL_request becamse a utility object necessary only to get a ticket. Store it by-value in TABLE_LIST with the intent to merge MDL_request::key with table_list->table_name and table_list->db in future. Change the MDL subsystem to not require MDL_requests to stay around till close_thread_tables(). Remove the list of requests from the MDL context. Requests for shared metadata locks acquired in open_tables() are only used as a list in recover_from_failed_open_table_attempt(), which calls mdl_context.wait_for_locks() for this list. To keep such list for recover_from_failed_open_table_attempt(), introduce a context class (Open_table_context), that collects all requests. A lot of minor cleanups and simplications that became possible with this change. sql/event_db_repository.cc: Remove alloc_mdl_requests(). Now MDL_request instance is a member of TABLE_LIST, and init_one_table() initializes it. sql/ha_ndbcluster_binlog.cc: Remove now unnecessary declaration and initialization of binlog_mdl_request. sql/lock.cc: No need to allocate MDL requests in lock_table_names() now. sql/log.cc: Use init_one_table() method, remove alloc_mdl_requests(), which is now unnecessary. sql/log_event.cc: No need to allocate mdl_request separately now. Use init_one_table() method. sql/log_event_old.cc: Update to the new signature of close_tables_for_reopen(). sql/mdl.cc: Update try_acquire_exclusive_lock() to be more easy to use. Function lock_table_name_if_not_cached() has been removed. Make acquire_shared_lock() signature consistent with try_acquire_exclusive_lock() signature. Remove methods that are no longer used. Update comments. sql/mdl.h: Implement an assignment operator that doesn't copy MDL_key (MDL_key::operator= is private and should remain private). This is a hack to work-around assignment of TABLE_LIST by value in several places. Such assignments violate encapsulation, since only perform a shallow copy. In most cases these assignments are a hack on their own. sql/mysql_priv.h: Update signatures of close_thread_tables() and close_tables_for_reopen(). sql/sp.cc: Allocate TABLE_LIST in thd->mem_root. Use init_one_table(). sql/sp_head.cc: Use init_one_table(). Remove thd->locked_tables_root, it's no longer needed. sql/sql_acl.cc: Use init_mdl_requests() and init_one_table(). sql/sql_base.cc: Update to new signatures of try_acquire_shared_lock() and try_acquire_exclusive_lock(). Remove lock_table_name_if_not_cached(). Fix a bug in open_ltable() that would not return ER_LOCK_DEADLOCK in case of a failed lock_tables() and a multi-statement transaction. Fix a bug in open_and_lock_tables_derived() that would not return ER_LOCK_DEADLOCK in case of a multi-statement transaction and a failure of lock_tables(). Move assignment of enum_open_table_action to a method of Open_table_context, a new class that maintains information for backoff actions. Minor rearrangements of the code. Remove alloc_mdl_requests() in functions that work with system tables: instead the patch ensures that callers always initialize TABLE_LIST argument. sql/sql_class.cc: THD::locked_tables_root is no more. sql/sql_class.h: THD::locked_tables_root is no more. Add a declaration for Open_table_context class. sql/sql_delete.cc: Update to use the simplified MDL API. sql/sql_handler.cc: TABLE_LIST::mdl_request is stored by-value now. Ensure that mdl_request.ticket is NULL for every request that is passed into MDL, to satisfy MDL asserts. @ sql/sql_help.cc Function open_system_tables_for_read() no longer initializes mdl_requests. Move TABLE_LIST::mdl_request initialization closer to TABLE_LIST initialization. sql/sql_help.cc: Function open_system_tables_for_read() no longer initializes mdl_requests. Move TABLE_LIST::mdl_request initialization closer to TABLE_LIST initialization. sql/sql_insert.cc: Remove assignment by-value of TABLE_LIST in TABLEOP_HOOKS. We can't carry over a granted MDL ticket from one table list to another. sql/sql_parse.cc: Change alloc_mdl_requests() -> init_mdl_requests(). @todo We can remove init_mdl_requests() altogether in some places: all places that call add_table_to_list() already have mdl requests initialized. sql/sql_plugin.cc: Use init_one_table(). THD::locked_tables_root is no more. sql/sql_servers.cc: Use init_one_table(). sql/sql_show.cc: Update acquire_high_priority_shared_lock() to use TABLE_LIST::mdl_request rather than allocate an own. Fix get_trigger_table_impl() to use init_one_table(), check for out of memory, follow the coding style. sql/sql_table.cc: Update to work with TABLE_LIST::mdl_request by-value. Remove lock_table_name_if_not_cached(). The code that used to delegate to it is quite simple and concise without it now. sql/sql_udf.cc: Use init_one_table(). sql/sql_update.cc: Update to use the new signature of close_tables_for_reopen(). sql/table.cc: Move re-setting of mdl_requests for prepared statements and stored procedures from close_thread_tables() to reinit_stmt_before_use(). Change alloc_mdl_requests() to init_mdl_requests(). init_mdl_requests() is a hack that can't be deleted until we don't have a list-aware TABLE_LIST constructor. Hopefully its use will be minimal sql/table.h: Change alloc_mdl_requests() to init_mdl_requests() TABLE_LIST::mdl_request is stored by value. sql/tztime.cc: We no longer initialize mdl requests in open_system_tables_for*() functions. Move this initialization closer to initialization of the rest of TABLE_LIST members. storage/myisammrg/ha_myisammrg.cc: Simplify mdl_request initialization. |
||
---|---|---|
.. | ||
examples | ||
share | ||
.cvsignore | ||
add_errmsg | ||
authors.h | ||
client_settings.h | ||
CMakeLists.txt | ||
contributors.h | ||
custom_conf.h | ||
debug_sync.cc | ||
debug_sync.h | ||
derror.cc | ||
des_key_file.cc | ||
discover.cc | ||
event_data_objects.cc | ||
event_data_objects.h | ||
event_db_repository.cc | ||
event_db_repository.h | ||
event_parse_data.cc | ||
event_parse_data.h | ||
event_queue.cc | ||
event_queue.h | ||
event_scheduler.cc | ||
event_scheduler.h | ||
events.cc | ||
events.h | ||
field.cc | ||
field.h | ||
field_conv.cc | ||
filesort.cc | ||
frm_crypt.cc | ||
gen_lex_hash.cc | ||
gstream.cc | ||
gstream.h | ||
ha_ndbcluster.cc | ||
ha_ndbcluster.h | ||
ha_ndbcluster_binlog.cc | ||
ha_ndbcluster_binlog.h | ||
ha_ndbcluster_cond.cc | ||
ha_ndbcluster_cond.h | ||
ha_ndbcluster_tables.h | ||
ha_partition.cc | ||
ha_partition.h | ||
handler.cc | ||
handler.h | ||
hash_filo.cc | ||
hash_filo.h | ||
hostname.cc | ||
init.cc | ||
item.cc | ||
item.h | ||
item_buff.cc | ||
item_cmpfunc.cc | ||
item_cmpfunc.h | ||
item_create.cc | ||
item_create.h | ||
item_func.cc | ||
item_func.h | ||
item_geofunc.cc | ||
item_geofunc.h | ||
item_row.cc | ||
item_row.h | ||
item_strfunc.cc | ||
item_strfunc.h | ||
item_subselect.cc | ||
item_subselect.h | ||
item_sum.cc | ||
item_sum.h | ||
item_timefunc.cc | ||
item_timefunc.h | ||
item_xmlfunc.cc | ||
item_xmlfunc.h | ||
key.cc | ||
lex.h | ||
lex_symbol.h | ||
lock.cc | ||
log.cc | ||
log.h | ||
log_event.cc | ||
log_event.h | ||
log_event_old.cc | ||
log_event_old.h | ||
Makefile.am | ||
mdl.cc | ||
mdl.h | ||
message.h | ||
message.mc | ||
message.rc | ||
mf_iocache.cc | ||
MSG00001.bin | ||
my_decimal.cc | ||
my_decimal.h | ||
my_lock.c | ||
mysql_priv.h | ||
mysql_priv.h.pp | ||
mysqld.cc | ||
mysqld_suffix.h | ||
net_serv.cc | ||
nt_servc.cc | ||
nt_servc.h | ||
opt_range.cc | ||
opt_range.h | ||
opt_sum.cc | ||
parse_file.cc | ||
parse_file.h | ||
partition_element.h | ||
partition_info.cc | ||
partition_info.h | ||
password.c | ||
procedure.cc | ||
procedure.h | ||
protocol.cc | ||
protocol.h | ||
records.cc | ||
records.h | ||
repl_failsafe.cc | ||
repl_failsafe.h | ||
replication.h | ||
rpl_constants.h | ||
rpl_filter.cc | ||
rpl_filter.h | ||
rpl_handler.cc | ||
rpl_handler.h | ||
rpl_injector.cc | ||
rpl_injector.h | ||
rpl_mi.cc | ||
rpl_mi.h | ||
rpl_record.cc | ||
rpl_record.h | ||
rpl_record_old.cc | ||
rpl_record_old.h | ||
rpl_reporting.cc | ||
rpl_reporting.h | ||
rpl_rli.cc | ||
rpl_rli.h | ||
rpl_tblmap.cc | ||
rpl_tblmap.h | ||
rpl_utility.cc | ||
rpl_utility.h | ||
scheduler.cc | ||
scheduler.h | ||
set_var.cc | ||
set_var.h | ||
slave.cc | ||
slave.h | ||
sp.cc | ||
sp.h | ||
sp_cache.cc | ||
sp_cache.h | ||
sp_head.cc | ||
sp_head.h | ||
sp_pcontext.cc | ||
sp_pcontext.h | ||
sp_rcontext.cc | ||
sp_rcontext.h | ||
spatial.cc | ||
spatial.h | ||
sql_acl.cc | ||
sql_acl.h | ||
sql_analyse.cc | ||
sql_analyse.h | ||
sql_array.h | ||
sql_base.cc | ||
sql_binlog.cc | ||
sql_bitmap.h | ||
sql_builtin.cc.in | ||
sql_cache.cc | ||
sql_cache.h | ||
sql_class.cc | ||
sql_class.h | ||
sql_client.cc | ||
sql_connect.cc | ||
sql_crypt.cc | ||
sql_crypt.h | ||
sql_cursor.cc | ||
sql_cursor.h | ||
sql_db.cc | ||
sql_delete.cc | ||
sql_derived.cc | ||
sql_do.cc | ||
sql_error.cc | ||
sql_error.h | ||
sql_handler.cc | ||
sql_help.cc | ||
sql_insert.cc | ||
sql_lex.cc | ||
sql_lex.h | ||
sql_list.cc | ||
sql_list.h | ||
sql_load.cc | ||
sql_locale.cc | ||
sql_manager.cc | ||
sql_map.cc | ||
sql_map.h | ||
sql_olap.cc | ||
sql_parse.cc | ||
sql_partition.cc | ||
sql_partition.h | ||
sql_plist.h | ||
sql_plugin.cc | ||
sql_plugin.h | ||
sql_plugin_services.h | ||
sql_prepare.cc | ||
sql_prepare.h | ||
sql_profile.cc | ||
sql_profile.h | ||
sql_rename.cc | ||
sql_repl.cc | ||
sql_repl.h | ||
sql_select.cc | ||
sql_select.h | ||
sql_servers.cc | ||
sql_servers.h | ||
sql_show.cc | ||
sql_show.h | ||
sql_signal.cc | ||
sql_signal.h | ||
sql_sort.h | ||
sql_state.c | ||
sql_string.cc | ||
sql_string.h | ||
sql_table.cc | ||
sql_tablespace.cc | ||
sql_test.cc | ||
sql_trigger.cc | ||
sql_trigger.h | ||
sql_udf.cc | ||
sql_udf.h | ||
sql_union.cc | ||
sql_update.cc | ||
sql_view.cc | ||
sql_view.h | ||
sql_yacc.yy | ||
strfunc.cc | ||
structs.h | ||
table.cc | ||
table.h | ||
thr_malloc.cc | ||
time.cc | ||
transaction.cc | ||
transaction.h | ||
tzfile.h | ||
tztime.cc | ||
tztime.h | ||
udf_example.c | ||
udf_example.def | ||
uniques.cc | ||
unireg.cc | ||
unireg.h |