Bug #13424 server sraches during dump if there is a VIEW and query cache is enabled
Submitted: 23 Sep 2005 10:45 Modified: 30 Sep 2005 17:18
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:5.0 OS:Linux (linux)
Assigned to: Evgeny Potemkin

[23 Sep 2005 10:45] Victoria Reznichenko
Description:
server sraches during dump if query cache is enabled and if query_cache_wlock_invalidate is used and databases contains VIEWs.

Backtrace:
(gdb) bt
#0  0x0831c669 in Query_cache::invalidate_table (this=0x87ec760, table=0x0) at sql_cache.cc:2132
#1  0x0831a11b in Query_cache::invalidate_locked_for_write (this=0x87ec760, tables_used=0x8ea43a0) at sql_cache.cc:1299
#2  0x081f81c5 in mysql_execute_command (thd=0x8e78990) at sql_parse.cc:3517
#3  0x081fe0a6 in mysql_parse (thd=0x8e78990, inBuf=0x8ea4148 "LOCK TABLES `t1` READ /*!32311 LOCAL */,`v1` READ /*!32311 LOCAL */", length=67)
    at sql_parse.cc:5507
#4  0x081f3458 in dispatch_command (command=COM_QUERY, thd=0x8e78990,
    packet=0x8e9c0e9 "LOCK TABLES `t1` READ /*!32311 LOCAL */,`v1` READ /*!32311 LOCAL */", packet_length=68) at sql_parse.cc:1685
#5  0x081f2c43 in do_command (thd=0x8e78990) at sql_parse.cc:1486
#6  0x081f1d33 in handle_one_connection (arg=0x8e78990) at sql_parse.cc:1137
#7  0xb7da6f1b in pthread_start_thread () from /lib/libpthread.so.0
#8  0xb7da6f9f in pthread_start_thread_event () from /lib/libpthread.so.0
#9  0xb7cd5fda in clone () from /lib/libc.so.6

How to repeat:
1. enable query cache.
2. start MySQL server with query_cache_wlock_invalidate option
3. Create view:

create table t1(id int);
insert into t1 values(1),(2),(3);
create view v1 as select * from t1;

4. Dump database
[26 Sep 2005 15:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30334
[26 Sep 2005 15:53] Evgeny Potemkin
For LOCK view is opened but not prepared thus leaving 'table' field set to
NULL. invalidate_locked_for_write() wasn't checking that and call to 
invalidate_table(NULL) crashes server.

Fixed in 5.0.14, cset 1.1991.1.5
[30 Sep 2005 17:18] Paul Dubois
Noted in 5.0.14 changelog.