diff options
author | unknown <msvensson@pilot.(none)> | 2007-06-19 11:31:34 +0200 |
---|---|---|
committer | unknown <msvensson@pilot.(none)> | 2007-06-19 11:31:34 +0200 |
commit | 75689af808d935de69a39138e35cde575c982251 (patch) | |
tree | c2668ecbca1fc441f2a39eb25cbb54f16181414a /sql/lock.cc | |
parent | 3955e94c34d638df24c5d640558a5aee14342603 (diff) | |
parent | 54c531607df9b14f206fa8a44f39f2764f55ac82 (diff) | |
download | mariadb-git-75689af808d935de69a39138e35cde575c982251.tar.gz |
Merge bk-internal:/home/bk/mysql-5.1-maint
into pilot.(none):/data/msvensson/mysql/mysql-5.1-new-maint
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/t/mysqltest.test:
Auto merged
BitKeeper/deleted/.del-wait_for_slave_io_to_stop.inc:
Auto merged
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index 6f1dd0669ee..50922a682a2 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -92,6 +92,7 @@ static void print_lock_error(int error, const char *); count The number of tables to lock. flags Options: MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK Ignore a global read lock + MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY Ignore SET GLOBAL READ_ONLY MYSQL_LOCK_IGNORE_FLUSH Ignore a flush tables. MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN Instead of reopening altered or dropped tables by itself, @@ -150,11 +151,11 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } } - if ( write_lock_used - && opt_readonly - && ! (thd->security_ctx->master_access & SUPER_ACL) - && ! thd->slave_thread - ) + if (!(flags & MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY) && + write_lock_used && + opt_readonly && + !(thd->security_ctx->master_access & SUPER_ACL) && + !thd->slave_thread) { /* Someone has issued SET GLOBAL READ_ONLY=1 and we want a write lock. @@ -197,6 +198,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } else if (rc == 1) /* aborted */ { + /* + reset_lock_data is required here. If thr_multi_lock fails it + resets lock type for tables, which were locked before (and + including) one that caused error. Lock type for other tables + preserved. + */ + reset_lock_data(sql_lock); thd->some_tables_deleted=1; // Try again sql_lock->lock_count= 0; // Locks are already freed } @@ -707,9 +715,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, if (!table_ptr[i]-> file-> check_if_locking_is_allowed(thd->lex->sql_command, thd->lex->type, table_ptr[i], count, i, &system_count, - (thd == logger.get_general_log_thd()) || - (thd == logger.get_slow_log_thd()) || - (thd == logger.get_privileged_thread()))) + logger.is_privileged_thread(thd))) DBUG_RETURN(0); } |