| Bug #47335 | assert in get_table_share | ||
|---|---|---|---|
| Submitted: | 15 Sep 2009 17:46 | Modified: | 7 Mar 2010 1:43 |
| Reporter: | Matthias Leich | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Locking | Severity: | S3 (Non-critical) |
| Version: | 6.0-codebase | OS: | Any |
| Assigned to: | Jon Olav Hauglid | CPU Architecture: | Any |
| Tags: | locking, mdl | ||
[24 Sep 2009 7:46]
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/84453 2838 Jon Olav Hauglid 2009-09-24 Bug #47335 assert in get_table_share The assert would happen if ALTER VIEW was used to alter a view (existing or non-existing) and a temporary table with the same name already existed. The assert is triggered if the current statement does not have a MDL lock on the view to be altered. This would happen because open_table() would open the temporary table instead and MDL locks are not taken for temporary tables (since they are local to one connection). The patch changes open_type for CREATE/ALTER VIEW to OT_BASE_ONLY. This prevents open_table() from trying to open a temporary table with the same name should one exist. Now the view will be altered if it exists or ER_NO_SUCH_TABLE will be reported if it does not. Test case added to view.test
[25 Sep 2009 11:21]
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:31]
Paul DuBois
Noted in 6.0.14 changelog. The assert could be raised if ALTER VIEW was used to alter a view (existing or nonexisting) and a temporary table with the same name already existed.
[10 Dec 2009 12:16]
Jon Olav Hauglid
Pushed to mysql-next-4284 (5.6.0-beta).
[16 Feb 2010 16:47]
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:14]
Paul DuBois
Setting report to Need Merge pending push of Celosia into release tree.
[6 Mar 2010 10:53]
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:43]
Paul DuBois
Noted in 5.5.3 changelog.
[13 Apr 2010 5:00]
Paul DuBois
Correction: Not present in any 5.5.x release. 5.5.3 changelog entry removed.

Description: The assertion happens in sql_base.cc:473 DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_TABLE, table_list->db, table_list->table_name)); My script: ---------- CREATE TEMPORARY TABLE db_not_exists.t1 AS SELECT 1 AS f1; CREATE TEMPORARY TABLE db_not_exists.t2 AS SELECT 1 AS f1; ALTER VIEW db_not_exists.t1 AS SELECT f1 FROM db_not_exists.t2; Backtrace on mysql-next-bugfixing 2009-09-15: --------------------------------------------- Thread 1 (process 12129): #0 0x00007f76123a5ce6 in pthread_kill () from /lib64/libpthread.so.0 #1 0x0000000000b7410c in my_write_core (sig=6) at stacktrace.c:309 #2 0x00000000006f359d in handle_segfault (sig=6) at mysqld.cc:2739 #3 <signal handler called> #4 0x00007f76112a15c5 in raise () from /lib64/libc.so.6 #5 0x00007f76112a2bb3 in abort () from /lib64/libc.so.6 #6 0x00007f761129a1e9 in __assert_fail () from /lib64/libc.so.6 #7 0x0000000000760391 in get_table_share (thd=0x1614938, table_list=0x40ee7a10, key=0x40ee7fb0 "db_not_exists", key_length=17, db_flags=8192, error=0x40ee79c4) at sql_base.cc:473 #8 0x000000000076077e in get_table_share_with_create (thd=0x1614938, table_list=0x40ee7a10, key=0x40ee7fb0 "db_not_exists", key_length=17, db_flags=8192, error=0x40ee79c4) at sql_base.cc:572 #9 0x0000000000760fe3 in tdc_open_view (thd=0x1614938, table_list=0x40ee7a10, alias=0x16937f0 "t1", cache_key=0x40ee7fb0 "db_not_exists", cache_key_length=17, mem_root=0x1617420, flags=16384) at sql_base.cc:3455 #10 0x00000000008e3b57 in fill_defined_view_parts (thd=0x1614938, view=0x16937f8) at sql_view.cc:189 #11 0x00000000008e3e5a in mysql_create_view (thd=0x1614938, views=0x16937f8, mode=VIEW_ALTER) at sql_view.cc:412 #12 0x000000000070dc70 in mysql_execute_command (thd=0x1614938) at sql_parse.cc:4673 #13 0x000000000070e790 in mysql_parse (thd=0x1614938, inBuf=0x16936c0 "ALTER VIEW db_not_exists.t1 AS SELECT f1 FROM db_not_exists.t2", length=62, found_semicolon=0x40ee9f20) at sql_parse.cc:5957 #14 0x000000000070f3cc in dispatch_command (command=COM_QUERY, thd=0x1614938, packet=0x16ea989 "ALTER VIEW db_not_exists.t1 AS SELECT f1 FROM db_not_exists.t2", packet_length=62) at sql_parse.cc:1073 #15 0x0000000000710893 in do_command (thd=0x1614938) at sql_parse.cc:755 #16 0x00000000006fd730 in handle_one_connection (arg=0x1614938) at sql_connect.cc:1163 #17 0x00007f76123a1040 in start_thread () from /lib64/libpthread.so.0 #18 0x00007f761134208d in clone () from /lib64/libc.so.6 #19 0x0000000000000000 in ?? () Result on mysql-5.1-bugteam 2009-08-28 -------------------------------------- At line 3: query 'ALTER VIEW db_not_exists.t1 AS SELECT f1 FROM db_not_exists.t2' failed: 1347: 'db_not_exists.t1' is not VIEW My environment: --------------- - ./BUILD/compile-pentium64-debug-max - Linux OpenSuSE 11.0 (64 Bit) - Intel Core2Duo How to repeat: See above