Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10035

DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE

Details

    • 10.2.1-5, 10.2.2-1, 10.2.2-2, 10.0.29

    Description

      This script makes the server crash on assert in debug builds:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10);
      DROP VIEW IF EXISTS v1;
      CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE;
      

      mysqld: /home/bar/maria-git/server.10.2/sql/table_cache.cc:853: bool tdc_remove_table(THD*, enum_tdc_remove_table_type, const char*, const char*, bool): Assertion `remove_type == TDC_RT_REMOVE_UNUSED || thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, MDL_EXCLUSIVE)' failed.
       
      Program received signal SIGABRT, Aborted.
      [Switching to Thread 0x7ffff7f7cf00 (LWP 29487)]
      0x00007ffff5b9ea98 in __GI_raise (sig=sig@entry=6)
          at ../sysdeps/unix/sysv/linux/raise.c:55
      55	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
      

      FOR UPDATE should probably be disallowed in VIEWs.

      Attachments

        Issue Links

          Activity

            Stack trace from 10.0 commit cee9ab9d85a8d75290b0d60bc7af26c8cf179a1d

            mysqld: /src/10.0/sql/table_cache.cc:983: bool tdc_remove_table(THD*, enum_tdc_remove_table_type, const char*, const char*, bool): Assertion `remove_type == TDC_RT_REMOVE_UNUSED || thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, MDL_EXCLUSIVE)' failed.
            160514  2:31:50 [ERROR] mysqld got signal 6 ;
             
            #7  0x00007f0358a4a1d2 in __assert_fail () from /lib64/libc.so.6
            #8  0x00000000007eef3a in tdc_remove_table (thd=0x7f0354be9970, remove_type=TDC_RT_REMOVE_ALL, db=0x7f0351477770 "test", table_name=0x7f0351477158 "v1", kill_delayed_threads=false) at /src/10.0/sql/table_cache.cc:981
            #9  0x000000000073d19e in mysql_create_view (thd=0x7f0354be9970, views=0x7f0351477190, mode=VIEW_CREATE_NEW) at /src/10.0/sql/sql_view.cc:625
            #10 0x0000000000673ba1 in mysql_execute_command (thd=0x7f0354be9970) at /src/10.0/sql/sql_parse.cc:4946
            #11 0x00000000006777cd in mysql_parse (thd=0x7f0354be9970, rawbuf=0x7f0351477088 "CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE", length=45, parser_state=0x7f035aaf4650) at /src/10.0/sql/sql_parse.cc:6574
            #12 0x000000000066a309 in dispatch_command (command=COM_QUERY, thd=0x7f0354be9970, packet=0x7f035353aa71 "CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE", packet_length=45) at /src/10.0/sql/sql_parse.cc:1308
            #13 0x00000000006695d6 in do_command (thd=0x7f0354be9970) at /src/10.0/sql/sql_parse.cc:998
            #14 0x0000000000787cb2 in do_handle_one_connection (thd_arg=0x7f0354be9970) at /src/10.0/sql/sql_connect.cc:1378
            #15 0x0000000000787a24 in handle_one_connection (arg=0x7f0354be9970) at /src/10.0/sql/sql_connect.cc:1293
            #16 0x0000000000df561c in pfs_spawn_thread (arg=0x7f03525bf4f0) at /src/10.0/storage/perfschema/pfs.cc:1860
            #17 0x00007f035a76d0a4 in start_thread () from /lib64/libpthread.so.0
            #18 0x00007f0358b0104d in clone () from /lib64/libc.so.6
            

            elenst Elena Stepanova added a comment - Stack trace from 10.0 commit cee9ab9d85a8d75290b0d60bc7af26c8cf179a1d mysqld: /src/10.0/sql/table_cache.cc:983: bool tdc_remove_table(THD*, enum_tdc_remove_table_type, const char*, const char*, bool): Assertion `remove_type == TDC_RT_REMOVE_UNUSED || thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name, MDL_EXCLUSIVE)' failed. 160514 2:31:50 [ERROR] mysqld got signal 6 ;   #7 0x00007f0358a4a1d2 in __assert_fail () from /lib64/libc.so.6 #8 0x00000000007eef3a in tdc_remove_table (thd=0x7f0354be9970, remove_type=TDC_RT_REMOVE_ALL, db=0x7f0351477770 "test", table_name=0x7f0351477158 "v1", kill_delayed_threads=false) at /src/10.0/sql/table_cache.cc:981 #9 0x000000000073d19e in mysql_create_view (thd=0x7f0354be9970, views=0x7f0351477190, mode=VIEW_CREATE_NEW) at /src/10.0/sql/sql_view.cc:625 #10 0x0000000000673ba1 in mysql_execute_command (thd=0x7f0354be9970) at /src/10.0/sql/sql_parse.cc:4946 #11 0x00000000006777cd in mysql_parse (thd=0x7f0354be9970, rawbuf=0x7f0351477088 "CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE", length=45, parser_state=0x7f035aaf4650) at /src/10.0/sql/sql_parse.cc:6574 #12 0x000000000066a309 in dispatch_command (command=COM_QUERY, thd=0x7f0354be9970, packet=0x7f035353aa71 "CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE", packet_length=45) at /src/10.0/sql/sql_parse.cc:1308 #13 0x00000000006695d6 in do_command (thd=0x7f0354be9970) at /src/10.0/sql/sql_parse.cc:998 #14 0x0000000000787cb2 in do_handle_one_connection (thd_arg=0x7f0354be9970) at /src/10.0/sql/sql_connect.cc:1378 #15 0x0000000000787a24 in handle_one_connection (arg=0x7f0354be9970) at /src/10.0/sql/sql_connect.cc:1293 #16 0x0000000000df561c in pfs_spawn_thread (arg=0x7f03525bf4f0) at /src/10.0/storage/perfschema/pfs.cc:1860 #17 0x00007f035a76d0a4 in start_thread () from /lib64/libpthread.so.0 #18 0x00007f0358b0104d in clone () from /lib64/libc.so.6

            revision-id: 4ffe2295e78538dde93df078421726f0c5a7d2a2 (mariadb-10.2.0-29-g4ffe229)
            parent(s): b79944950e5e5db40cf7ad49061edf5f105512c4
            committer: Oleksandr Byelkin
            timestamp: 2016-05-15 15:25:33 +0200
            message:

            MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE

            Lock type specifications prohibited in a view definition.

            —

            sanja Oleksandr Byelkin added a comment - revision-id: 4ffe2295e78538dde93df078421726f0c5a7d2a2 (mariadb-10.2.0-29-g4ffe229) parent(s): b79944950e5e5db40cf7ad49061edf5f105512c4 committer: Oleksandr Byelkin timestamp: 2016-05-15 15:25:33 +0200 message: MDEV-10035 : DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE Lock type specifications prohibited in a view definition. —

            Conclusion after discussion:

            1) Allow lock type in view
            2) What lock type (view/upper query) should precede is yet unclear.

            sanja Oleksandr Byelkin added a comment - Conclusion after discussion: 1) Allow lock type in view 2) What lock type (view/upper query) should precede is yet unclear.

            Is it really going to be fixed only in 10.2 as the 'Fix version/s' says?

            elenst Elena Stepanova added a comment - Is it really going to be fixed only in 10.2 as the 'Fix version/s' says?
            serg Sergei Golubchik added a comment - - edited

            Let's decide on that when we'll have a reviewed patch

            serg Sergei Golubchik added a comment - - edited Let's decide on that when we'll have a reviewed patch

            It is pushed. If it should be backported to other versions I can do it.

            sanja Oleksandr Byelkin added a comment - It is pushed. If it should be backported to other versions I can do it.
            elenst Elena Stepanova added a comment - - edited

            If it should be in previous versions, why wasn't it pushed there at the first place, and why close the bug now? Re-opened for backporting.

            Also, the fix version must be wrong, if it was fixed a month ago it went to 10.2.2, not 10.2.3.

            elenst Elena Stepanova added a comment - - edited If it should be in previous versions, why wasn't it pushed there at the first place, and why close the bug now? Re-opened for backporting. Also, the fix version must be wrong, if it was fixed a month ago it went to 10.2.2, not 10.2.3.

            5.5 it works...

            sanja Oleksandr Byelkin added a comment - 5.5 it works...

            People

              sanja Oleksandr Byelkin
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.