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

Assertion `thd->locked_tables_mode == LTM_NONE' failed in Locked_tables_list::init_locked_tables

    XMLWordPrintable

Details

    Description

      CREATE FUNCTION f() RETURNS INTEGER RETURN 1;
      CREATE TABLE t (a INT);
      CREATE VIEW v AS SELECT 2 FROM t WHERE f() < 3;
      FLUSH TABLE v WITH READ LOCK;
       
      # Cleanup
      UNLOCK TABLES;
      DROP VIEW v;
      DROP FUNCTION f;
      DROP TABLE t;
      

      10.6 b118f92b

      mariadbd: /data/src/10.6/sql/sql_base.cc:2274: bool Locked_tables_list::init_locked_tables(THD*): Assertion `thd->locked_tables_mode == LTM_NONE' failed.
      210601 17:51:10 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f449af28729 in __assert_fail_base (fmt=0x7f449b0be588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556c6b81c748 "thd->locked_tables_mode == LTM_NONE", file=0x556c6b81bc80 "/data/src/10.6/sql/sql_base.cc", line=2274, function=<optimized out>) at assert.c:92
      #7  0x00007f449af39f36 in __GI___assert_fail (assertion=0x556c6b81c748 "thd->locked_tables_mode == LTM_NONE", file=0x556c6b81bc80 "/data/src/10.6/sql/sql_base.cc", line=2274, function=0x556c6b81c770 "bool Locked_tables_list::init_locked_tables(THD*)") at assert.c:101
      #8  0x0000556c6a9bdc8d in Locked_tables_list::init_locked_tables (this=0x7f4484004f68, thd=0x7f4484000db8) at /data/src/10.6/sql/sql_base.cc:2274
      #9  0x0000556c6ac69e71 in flush_tables_with_read_lock (thd=0x7f4484000db8, all_tables=0x7f4484015690) at /data/src/10.6/sql/sql_reload.cc:616
      #10 0x0000556c6aa7323b in mysql_execute_command (thd=0x7f4484000db8) at /data/src/10.6/sql/sql_parse.cc:5397
      #11 0x0000556c6aa7b5b2 in mysql_parse (thd=0x7f4484000db8, rawbuf=0x7f44840155c0 "FLUSH TABLE v WITH READ LOCK", length=28, parser_state=0x7f4495794480) at /data/src/10.6/sql/sql_parse.cc:8016
      #12 0x0000556c6aa67a3c in dispatch_command (command=COM_QUERY, thd=0x7f4484000db8, packet=0x7f448400b879 "FLUSH TABLE v WITH READ LOCK", packet_length=28, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1897
      #13 0x0000556c6aa663e1 in do_command (thd=0x7f4484000db8, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1406
      #14 0x0000556c6ac22be1 in do_handle_one_connection (connect=0x556c6d520ce8, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1410
      #15 0x0000556c6ac2293d in handle_one_connection (arg=0x556c6d51e048) at /data/src/10.6/sql/sql_connect.cc:1312
      #16 0x0000556c6b18e213 in pfs_spawn_thread (arg=0x556c6d520838) at /data/src/10.6/storage/perfschema/pfs.cc:2201
      #17 0x00007f449b451609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #18 0x00007f449b025293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The failure appeared in 10.6 after this commit:

      commit b118f92be6b8d7294f3b57f824559ced3dcccc6b (HEAD -> 10.6, origin/bb-10.6-mdev15888-hf, origin/HEAD, origin/10.6)
      Author: Alexey Botchkov
      Date:   Tue Feb 9 00:59:55 2021 +0400
       
          MDEV-15888 Implement FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK for views.
          
          Enable the FLUSH TABLES for views. It works now.
      

      No obvious immediate problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              elenst Elena Stepanova
              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.