Bug #47635 assert in start_waiting_global_read_lock during CREATE VIEW
Submitted: 24 Sep 2009 21:06 Modified: 7 Mar 2010 1:42
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:6.0.14 OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any
Tags: locking

[24 Sep 2009 21:06] Matthias Leich
Description:
Assert in lock.cc line 1398:
DBUG_ASSERT(thd->global_read_lock_protection > 0);

My script:
----------
--disable_abort_on_error
CREATE TABLE t1 (f1 integer);
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
CREATE TEMPORARY TABLE t2 (f1 integer);
DROP TABLE t1;
FLUSH TABLES WITH READ LOCK;
CREATE VIEW t2 AS SELECT * FROM t1;

Result on mysql-6.0-codebase-bugfixing 2009-09-24
-------------------------------------------------
CREATE TABLE t1 (f1 integer);
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
CREATE TEMPORARY TABLE t2 (f1 integer);
DROP TABLE t1;
FLUSH TABLES WITH READ LOCK;
CREATE VIEW t2 AS SELECT * FROM t1;
ERROR HY000: Lost connection to MySQL server during query

Thread 1 (process 10717):
#0  0x00007f571a5e3ce6 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000b75224 in my_write_core (sig=6) at stacktrace.c:309
#2  0x00000000006f3e24 in handle_segfault (sig=6) at mysqld.cc:2755
#3  <signal handler called>
#4  0x00007f57194df5c5 in raise () from /lib64/libc.so.6
#5  0x00007f57194e0bb3 in abort () from /lib64/libc.so.6
#6  0x00007f57194d81e9 in __assert_fail () from /lib64/libc.so.6
#7  0x00000000006e7f5b in start_waiting_global_read_lock (thd=0x16170a8) at lock.cc:1398
#8  0x00000000008e551b in mysql_create_view (thd=0x16170a8, views=0x16f0f10, mode=VIEW_CREATE_NEW) at sql_view.cc:671
#9  0x000000000070e5ba in mysql_execute_command (thd=0x16170a8) at sql_parse.cc:4703
#10 0x000000000070f0da in mysql_parse (thd=0x16170a8, inBuf=0x16f0e20 "CREATE VIEW t2 AS SELECT * FROM t1", length=34, found_semicolon=0x4111ef20) at sql_parse.cc:5991
#11 0x000000000070fd16 in dispatch_command (command=COM_QUERY, thd=0x16170a8, packet=0x162a209 "CREATE VIEW t2 AS SELECT * FROM t1", packet_length=34) at sql_parse.cc:1074
#12 0x00000000007111dd in do_command (thd=0x16170a8) at sql_parse.cc:756
#13 0x00000000006fdfe4 in handle_one_connection (arg=0x16170a8) at sql_connect.cc:1164
#14 0x00007f571a5df040 in start_thread () from /lib64/libpthread.so.0
#15 0x00007f571958008d in clone () from /lib64/libc.so.6
#16 0x0000000000000000 in ?? ()

Result on mysql-5.1-bugteam 2009-09-16
--------------------------------------
CREATE TABLE t1 (f1 integer);
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
CREATE TEMPORARY TABLE t2 (f1 integer);
DROP TABLE t1;
FLUSH TABLES WITH READ LOCK;
CREATE VIEW t2 AS SELECT * FROM t1;
   IMHO this result is ok.

My environment:
---------------
- MySQL compiled from source
  ./BUILD/compile-pentium64-debug-max
- Linux OpenSuSE 11.0 (64 Bit)
- Intel Core2Duo

How to repeat:
See above
[25 Sep 2009 14:38] 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/commits/84671

2840 Jon Olav Hauglid	2009-09-25
      Bug #47635 assert in start_waiting_global_read_lock during CREATE VIEW
      
      The problem was that CREATE VIEW would trigger an assert if
      a temporary table with the same name already existed.
      
      This bug was fixed by the patch for Bug#47335. CREATE/ALTER VIEW
      will now ignore temporary tables. See Bug#47335 for more information.
      
      Test case added to view.test.
[26 Sep 2009 15:14] Jon Olav Hauglid
Pushed to mysql-6.0-codebase-bugfixing (version 6.0.14-alpha)
[30 Sep 2009 8:18] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20090929093622-1mooerbh12e97zux) (version source revid:alik@sun.com-20090927203924-087s36mrs0uxepwb) (merge vers: 6.0.14-alpha) (pib:11)
[1 Oct 2009 17:01] Paul DuBois
Noted from 6.0.14 changelog.

CREATE VIEW raised an assertion if a temporary table existed with the
same name as the view.
[10 Dec 2009 12:17] Jon Olav Hauglid
Pushed to mysql-next-4284 (5.6.0-beta).
[16 Feb 2010 16:46] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100216101445-2ofzkh48aq2e0e8o) (version source revid:kostja@sun.com-20091211154405-c9yhiewr9o5d20rq) (merge vers: 6.0.14-alpha) (pib:16)
[16 Feb 2010 16:56] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100216101208-33qkfwdr0tep3pf2) (version source revid:jon.hauglid@sun.com-20091210121520-r8frcrrhks821r7t) (pib:16)
[17 Feb 2010 1:16] Paul DuBois
Setting report to Need Merge pending push of Celosia into release tree.
[6 Mar 2010 10:54] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100216221947-luyhph0txl2c5tc8) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:42] Paul DuBois
Noted in 5.5.3 changelog.