diff options
author | Seppo Jaakola <seppo.jaakola@codership.com> | 2012-06-12 16:34:18 +0300 |
---|---|---|
committer | Seppo Jaakola <seppo.jaakola@codership.com> | 2012-06-12 16:34:18 +0300 |
commit | b96af9a3abe792c8711d59b693509ccd0677a150 (patch) | |
tree | 526a4e021acc77d2379cee74873bd3cae1b53fd9 /sql/sys_vars.cc | |
parent | 33ffe0dd29b6564e49dde8b1abda914da4b2f178 (diff) | |
parent | 9892ace475752e0ddd333500bec91e13ca54d0f3 (diff) | |
download | mariadb-git-b96af9a3abe792c8711d59b693509ccd0677a150.tar.gz |
references lp:1011983
Merged latest MariaDB development in: bzr merge lp:maria/5.5
=>
Text conflict in CMakeLists.txt
Text conflict in sql/handler.h
Text conflict in support-files/CMakeLists.txt
3 conflicts
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index b8c21f9621e..49fc526a16f 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1596,14 +1596,15 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type) } /* - Perform a 'FLUSH TABLES WITH READ LOCK'. - This is a 3 step process: - - [1] lock_global_read_lock() - - [2] close_cached_tables() - - [3] make_global_read_lock_block_commit() - [1] prevents new connections from obtaining tables locked for write. - [2] waits until all existing connections close their tables. - [3] prevents transactions from being committed. + READ_ONLY=1 prevents write locks from being taken on tables and + blocks transactions from committing. We therefore should make sure + that no such events occur while setting the read_only variable. + This is a 2 step process: + [1] lock_global_read_lock() + Prevents connections from obtaining new write locks on + tables. Note that we can still have active rw transactions. + [2] make_global_read_lock_block_commit() + Prevents transactions from committing. */ read_only= opt_readonly; @@ -1612,19 +1613,6 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type) if (thd->global_read_lock.lock_global_read_lock(thd)) goto end_with_mutex_unlock; - /* - This call will be blocked by any connection holding a READ or WRITE lock. - Ideally, we want to wait only for pending WRITE locks, but since: - con 1> LOCK TABLE T FOR READ; - con 2> LOCK TABLE T FOR WRITE; (blocked by con 1) - con 3> SET GLOBAL READ ONLY=1; (blocked by con 2) - can cause to wait on a read lock, it's required for the client application - to unlock everything, and acceptable for the server to wait on all locks. - */ - if ((result= close_cached_tables(thd, NULL, TRUE, - thd->variables.lock_wait_timeout))) - goto end_with_read_lock; - if ((result= thd->global_read_lock.make_global_read_lock_block_commit(thd))) goto end_with_read_lock; @@ -1892,7 +1880,7 @@ static Sys_var_ulong Sys_query_cache_min_res_unit( "The minimum size for blocks allocated by the query cache", GLOBAL_VAR(query_cache_min_res_unit), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX), DEFAULT(QUERY_CACHE_MIN_RESULT_DATA_SIZE), - BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), + BLOCK_SIZE(8), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_qcache_min_res_unit)); static const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND", 0 }; |