diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-11-30 18:55:03 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-11-30 18:55:03 +0300 |
commit | 69b9761f2913dfa9fa2989ef7f3e01b8d2d3e334 (patch) | |
tree | 7bd54aeb6a84931b5374760af2239149d840a0c1 /sql/rpl_rli.cc | |
parent | 0a9d4e675ad3b176909d30c5a6aa8ab1f0b7186b (diff) | |
download | mariadb-git-69b9761f2913dfa9fa2989ef7f3e01b8d2d3e334.tar.gz |
Initial import of WL#3726 "DDL locking for all metadata objects".
Backport of:
------------------------------------------------------------
revno: 2630.4.1
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Fri 2008-05-23 17:54:03 +0400
message:
WL#3726 "DDL locking for all metadata objects".
After review fixes in progress.
------------------------------------------------------------
This is the first patch in series. It transforms the metadata
locking subsystem to use a dedicated module (mdl.h,cc). No
significant changes in the locking protocol.
The import passes the test suite with the exception of
deprecated/removed 6.0 features, and MERGE tables. The latter
are subject to a fix by WL#4144.
Unfortunately, the original changeset comments got lost in a merge,
thus this import has its own (largely insufficient) comments.
This patch fixes Bug#25144 "replication / binlog with view breaks".
Warning: this patch introduces an incompatible change:
Under LOCK TABLES, it's no longer possible to FLUSH a table that
was not locked for WRITE.
Under LOCK TABLES, it's no longer possible to DROP a table or
VIEW that was not locked for WRITE.
******
Backport of:
------------------------------------------------------------
revno: 2630.4.2
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 14:03:45 +0400
message:
WL#3726 "DDL locking for all metadata objects".
After review fixes in progress.
******
Backport of:
------------------------------------------------------------
revno: 2630.4.3
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 14:08:51 +0400
message:
WL#3726 "DDL locking for all metadata objects"
Fixed failing Windows builds by adding mdl.cc to the lists
of files needed to build server/libmysqld on Windows.
******
Backport of:
------------------------------------------------------------
revno: 2630.4.4
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 21:57:58 +0400
message:
WL#3726 "DDL locking for all metadata objects".
Fix for assert failures in kill.test which occured when one
tried to kill ALTER TABLE statement on merge table while it
was waiting in wait_while_table_is_used() for other connections
to close this table.
These assert failures stemmed from the fact that cleanup code
in this case assumed that temporary table representing new
version of table was open with adding to THD::temporary_tables
list while code which were opening this temporary table wasn't
always fulfilling this.
This patch changes code that opens new version of table to
always do this linking in. It also streamlines cleanup process
for cases when error occurs while we have new version of table
open.
******
WL#3726 "DDL locking for all metadata objects"
Add libmysqld/mdl.cc to .bzrignore.
******
Backport of:
------------------------------------------------------------
revno: 2630.4.6
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sun 2008-05-25 00:33:22 +0400
message:
WL#3726 "DDL locking for all metadata objects".
Addition to the fix of assert failures in kill.test caused by
changes for this worklog.
Make sure we close the new table only once.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r-- | sql/rpl_rli.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index ae3cbf789a5..42cd12bd66c 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1187,8 +1187,7 @@ void Relay_log_info::cleanup_context(THD *thd, bool error) end_trans(thd, ROLLBACK); // if a "real transaction" } m_table_map.clear_tables(); - close_thread_tables(thd); - clear_tables_to_lock(); + slave_close_thread_tables(thd); clear_flag(IN_STMT); /* Cleanup for the flags that have been set at do_apply_event. @@ -1200,6 +1199,13 @@ void Relay_log_info::cleanup_context(THD *thd, bool error) void Relay_log_info::clear_tables_to_lock() { + /* + Deallocating elements of table list below will also free memory where + meta-data locks are stored. So we want to be sure that we don't have + any references to this memory left. + */ + DBUG_ASSERT(!mdl_has_locks(&(current_thd->mdl_context))); + while (tables_to_lock) { uchar* to_free= reinterpret_cast<uchar*>(tables_to_lock); @@ -1216,4 +1222,15 @@ void Relay_log_info::clear_tables_to_lock() DBUG_ASSERT(tables_to_lock == NULL && tables_to_lock_count == 0); } +void Relay_log_info::slave_close_thread_tables(THD *thd) +{ + /* + Since we use same memory chunks for allocation of metadata lock + objects for tables as we use for allocating corresponding elements + of 'tables_to_lock' list, we have to release metadata locks by + closing tables before calling clear_tables_to_lock(). + */ + close_thread_tables(thd); + clear_tables_to_lock(); +} #endif |