summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@oracle.com>2011-03-29 10:09:05 +0200
committerJon Olav Hauglid <jon.hauglid@oracle.com>2011-03-29 10:09:05 +0200
commit455646e7850956d3ae8a792e72ac13bea5500e6d (patch)
treee49440a0d7e4acde97d4be09f1ae8b46749c999b /sql/sql_base.cc
parent4a4892d4d8b87bd24564f672950eecc3c194be9a (diff)
downloadmariadb-git-455646e7850956d3ae8a792e72ac13bea5500e6d.tar.gz
Bug# 11763784 (former 56541)
ASSERTION TABLE->DB_STAT FAILED IN SQL_BASE.CC::OPEN_TABLE() DURING I_S Q This assert could be triggered if a statement requiring a name lock on a table (e.g. DROP TRIGGER) executed concurrently with an I_S query which also used the table. One connection first started an I_S query that opened a given table. Then another connection started a statement requiring a name lock on the same table. This statement was blocked since the table was in use by the I_S query. When the I_S query resumed and tried to open the table again as part of get_all_tables(), it would encounter a table instance with an old version number representing the pending name lock. Since I_S queries ignore version checks and thus pending name locks, it would try to continue. This caused it to encounter the assert. The assert checked that the TABLE instance found with a different version, was a real, open table. However, since this TABLE instance instead represented a pending name lock, the check would fail and trigger the assert. This patch fixes the problem by removing the assert. It is ok for TABLE::db_stat to be 0 in this case since the TABLE instance can represent a pending name lock. Test case added to lock_sync.test.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9765148cda1..dc78f3b84c6 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2798,10 +2798,9 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
("Found table '%s.%s' with different refresh version",
table_list->db, table_list->table_name));
- /* Ignore FLUSH, but not name locks! */
+ /* Ignore FLUSH and pending name locks, but not acquired name locks! */
if (flags & MYSQL_LOCK_IGNORE_FLUSH && !table->open_placeholder)
{
- DBUG_ASSERT(table->db_stat);
/* Force close at once after usage */
thd->version= table->s->version;
continue;