diff options
author | Monty <monty@mariadb.org> | 2017-06-07 17:17:51 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-06-30 22:31:37 +0300 |
commit | 9f484b63f1b61e6ade1481cfb8465f8fe208386d (patch) | |
tree | 0605a3c9f89fc3ba58dcd5b6fdfcadc20d91e474 /sql/temporary_tables.cc | |
parent | e16425ba97563650e0f627eb108a61df84759106 (diff) | |
download | mariadb-git-9f484b63f1b61e6ade1481cfb8465f8fe208386d.tar.gz |
Clean up replication check in open_temporary_table()
Diffstat (limited to 'sql/temporary_tables.cc')
-rw-r--r-- | sql/temporary_tables.cc | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index c05fc632a94..174d1b6e184 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -321,16 +321,6 @@ bool THD::open_temporary_table(TABLE_LIST *tl) TABLE *table= NULL; /* - Since temporary tables are not safe for parallel replication, lets - wait for the prior commits in case the table is found to be in use. - */ - if (rgi_slave && - rgi_slave->is_parallel_exec && - find_temporary_table(tl) && - wait_for_prior_commit()) - DBUG_RETURN(true); - - /* Code in open_table() assumes that TABLE_LIST::table can be non-zero only for pre-opened temporary tables. */ @@ -351,6 +341,22 @@ bool THD::open_temporary_table(TABLE_LIST *tl) } /* + Temporary tables are not safe for parallel replication. They were + designed to be visible to one thread only, so have no table locking. + Thus there is no protection against two conflicting transactions + committing in parallel and things like that. + + So for now, anything that uses temporary tables will be serialised + with anything before it, when using parallel replication. + */ + + if (rgi_slave && + rgi_slave->is_parallel_exec && + find_temporary_table(tl) && + wait_for_prior_commit()) + DBUG_RETURN(true); + + /* First check if there is a reusable open table available in the open table list. */ @@ -378,26 +384,6 @@ bool THD::open_temporary_table(TABLE_LIST *tl) DBUG_RETURN(false); } - /* - Temporary tables are not safe for parallel replication. They were - designed to be visible to one thread only, so have no table locking. - Thus there is no protection against two conflicting transactions - committing in parallel and things like that. - - So for now, anything that uses temporary tables will be serialised - with anything before it, when using parallel replication. - - TODO: We might be able to introduce a reference count or something - on temp tables, and have slave worker threads wait for it to reach - zero before being allowed to use the temp table. Might not be worth - it though, as statement-based replication using temporary tables is - in any case rather fragile. - */ - if (rgi_slave && - rgi_slave->is_parallel_exec && - wait_for_prior_commit()) - DBUG_RETURN(true); - #ifdef WITH_PARTITION_STORAGE_ENGINE if (tl->partition_names) { |