1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

WL#5419 "LOCK_open scalability: make tdc_refresh_version

an atomic counter"

Split the large LOCK_open section in open_table(). 
Do not call open_table_from_share() under LOCK_open.
Remove thd->version.

This fixes
Bug#50589 "Server hang on a query evaluated using a temporary 
table"
Bug#51557 "LOCK_open and kernel_mutex are not happy together"
Bug#49463 "LOCK_table and innodb are not nice when handler 
instances are created".

This patch has effect on storage engines that rely on
ha_open() PSEA method being called under LOCK_open.
In particular:

1) NDB is broken and left unfixed. NDB relies on LOCK_open
being kept as part of ha_open(), since it uses auto-discovery.
While previously the NDB open code was race-prone, now
it simply fails on asserts.

2) HEAP engine had a race in ha_heap::open() when
a share for the same table could be added twice
to the list of shares, or a dangling reference to a share
stored in HEAP handler. This patch aims to address this
problem by 'pinning' the newly created share in the 
internal HEAP engine share list until at least one
handler instance is created using that share.
This commit is contained in:
Konstantin Osipov
2010-06-11 19:28:18 +04:00
parent 218bf86cd9
commit b140456601
17 changed files with 207 additions and 146 deletions

View File

@@ -1006,7 +1006,6 @@ public:
of the main statement is called.
*/
enum enum_locked_tables_mode locked_tables_mode;
ulong version;
uint current_tablenr;
enum enum_flags {
@@ -1025,15 +1024,6 @@ public:
*/
Open_tables_state() : state_flags(0U) { }
/**
Prepare Open_tables_state instance for operations dealing with tables.
*/
void init_open_tables_state(THD *thd, ulong version_arg)
{
reset_open_tables_state(thd);
version= version_arg;
}
void set_open_tables_state(Open_tables_state *state)
{
*this= *state;