diff options
author | unknown <monty@narttu.mysql.fi> | 2006-06-23 03:03:03 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2006-06-23 03:03:03 +0300 |
commit | 7ac7f14952e3fb35eb66a5599ba89025679a3b83 (patch) | |
tree | 3961b23a2ef3010eb27eb0fd17c160e4fa29ee90 /sql/handler.cc | |
parent | e03f8ef25aa521dd698f185d4500e5eaab5766cb (diff) | |
parent | c04d04ec60e240f19e899e8d8dfbb3fcbdb84f97 (diff) | |
download | mariadb-git-7ac7f14952e3fb35eb66a5599ba89025679a3b83.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/home/my/mysql-5.1
sql/handler.cc:
Auto merged
sql/sql_class.h:
Auto merged
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 3331e014001..a98618172be 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3263,37 +3263,39 @@ namespace int write_locked_table_maps(THD *thd) { DBUG_ENTER("write_locked_table_maps"); - DBUG_PRINT("enter", ("thd=%p, thd->lock=%p, thd->locked_tables=%p", - thd, thd->lock, thd->locked_tables)); + DBUG_PRINT("enter", ("thd=%p, thd->lock=%p, thd->locked_tables=%p, thd->extra_lock", + thd, thd->lock, thd->locked_tables, thd->extra_lock)); if (thd->get_binlog_table_maps() == 0) { - /* - Exactly one table has to be locked, otherwise this code is not - guaranteed to work. - */ - DBUG_ASSERT((thd->lock != NULL) + (thd->locked_tables != NULL) == 1); - - MYSQL_LOCK *lock= thd->lock ? thd->lock : thd->locked_tables; - DBUG_ASSERT(lock->table_count > 0); - TABLE **const end_ptr= lock->table + lock->table_count; - for (TABLE **table_ptr= lock->table ; - table_ptr != end_ptr ; - ++table_ptr) + MYSQL_LOCK *const locks[] = { + thd->extra_lock, thd->lock, thd->locked_tables + }; + for (my_ptrdiff_t i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i ) { - TABLE *const table= *table_ptr; - DBUG_PRINT("info", ("Checking table %s", table->s->table_name)); - if (table->current_lock == F_WRLCK && - check_table_binlog_row_based(thd, table)) + MYSQL_LOCK const *const lock= locks[i]; + if (lock == NULL) + continue; + + TABLE **const end_ptr= lock->table + lock->table_count; + for (TABLE **table_ptr= lock->table ; + table_ptr != end_ptr ; + ++table_ptr) { - int const has_trans= table->file->has_transactions(); - int const error= thd->binlog_write_table_map(table, has_trans); - /* - If an error occurs, it is the responsibility of the caller to - roll back the transaction. - */ - if (unlikely(error)) - DBUG_RETURN(1); + TABLE *const table= *table_ptr; + DBUG_PRINT("info", ("Checking table %s", table->s->table_name)); + if (table->current_lock == F_WRLCK && + check_table_binlog_row_based(thd, table)) + { + int const has_trans= table->file->has_transactions(); + int const error= thd->binlog_write_table_map(table, has_trans); + /* + If an error occurs, it is the responsibility of the caller to + roll back the transaction. + */ + if (unlikely(error)) + DBUG_RETURN(1); + } } } } |