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

ER_KEY_NOT_FOUND or Assertion `(0xFUL & mode) == LOCK_S || (0xFUL & mode) == LOCK_X' failed upon sequence operations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3, 10.4, 10.5
    • Fix Version/s: 10.3, 10.4, 10.5
    • Component/s: Sequences
    • Labels:
      None

      Description

      Note: Both MDEV-19320 and MDEV-19977 fixes are not in the trees, but this case is still failing. Also, both previous bugs ended up being about operations which aren't allowed on sequences; I'm not sure which operation here is wrong.

      --source include/have_innodb.inc
       
      CREATE SEQUENCE s MINVALUE 0 ENGINE=Aria ROW_FORMAT=DYNAMIC;
      ALTER TABLE s ENGINE=InnoDB;
      ALTER SEQUENCE s INCREMENT= 1000;
       
      # Cleanup
      DROP SEQUENCE s;
      

      All of 10.3-10.5 non-debug as well as 10.3-10.4 debug produce ER_KEY_NOT_FOUND:

      10.3 b633b6a9

      mysqltest: At line 5: query 'ALTER SEQUENCE s INCREMENT= 1000' failed: 1032: Can't find record in 's'
      

      10.5 debug produces the assertion failure:

      10.5 bd62a636

      mariadbd: /data/src/10.5/storage/innobase/lock/lock0lock.cc:1915: dberr_t lock_rec_lock(bool, unsigned int, const buf_block_t*, ulint, dict_index_t*, que_thr_t*): Assertion `(0xFUL & mode) == LOCK_S || (0xFUL & mode) == LOCK_X' failed.
      200617 20:09:34 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fd3be871f12 in __GI___assert_fail (assertion=0x5606f2678bc8 "(0xFUL & mode) == LOCK_S || (0xFUL & mode) == LOCK_X", file=0x5606f2678148 "/data/src/10.5/storage/innobase/lock/lock0lock.cc", line=1915, function=0x5606f267d0c0 <lock_rec_lock(bool, unsigned int, buf_block_t const*, unsigned long, dict_index_t*, que_thr_t*)::__PRETTY_FUNCTION__> "dberr_t lock_rec_lock(bool, unsigned int, const buf_block_t*, ulint, dict_index_t*, que_thr_t*)") at assert.c:101
      #8  0x00005606f1e04424 in lock_rec_lock (impl=false, mode=5, block=0x7fd3b80ac5d8, heap_no=1, index=0x7fd3841fd418, thr=0x7fd3840fa0d0) at /data/src/10.5/storage/innobase/lock/lock0lock.cc:1915
      #9  0x00005606f1e12d33 in lock_clust_rec_read_check_and_lock (flags=0, block=0x7fd3b80ac5d8, rec=0x7fd3b8594070 "supremum", index=0x7fd3841fd418, offsets=0x7fd3b3db0ff0, mode=LOCK_NONE, gap_mode=0, thr=0x7fd3840fa0d0) at /data/src/10.5/storage/innobase/lock/lock0lock.cc:5803
      #10 0x00005606f1f4955d in sel_set_rec_lock (pcur=0x7fd3840f9a98, rec=0x7fd3b8594070 "supremum", index=0x7fd3841fd418, offsets=0x7fd3b3db0ff0, mode=5, type=0, thr=0x7fd3840fa0d0, mtr=0x7fd3b3db1850) at /data/src/10.5/storage/innobase/row/row0sel.cc:1252
      #11 0x00005606f1f52f81 in row_search_mvcc (buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177", mode=PAGE_CUR_G, prebuilt=0x7fd3840f98d8, match_mode=0, direction=0) at /data/src/10.5/storage/innobase/row/row0sel.cc:4720
      #12 0x00005606f1d55bfe in ha_innobase::index_read (this=0x7fd384220860, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:8962
      #13 0x00005606f1d56c0e in ha_innobase::index_first (this=0x7fd384220860, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177") at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:9335
      #14 0x00005606f1d56de6 in ha_innobase::rnd_next (this=0x7fd384220860, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177") at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:9428
      #15 0x00005606f1cf844b in ha_sequence::rnd_next (this=0x7fd3841f8930, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177") at /data/src/10.5/sql/ha_sequence.h:111
      #16 0x00005606f18f7741 in handler::ha_rnd_next (this=0x7fd3841f8930, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177") at /data/src/10.5/sql/handler.cc:3037
      #17 0x00005606f18fa48c in handler::read_first_row (this=0x7fd3841f8930, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177", primary_key=64) at /data/src/10.5/sql/handler.cc:3284
      #18 0x00005606f16372d3 in handler::ha_read_first_row (this=0x7fd3841f8930, buf=0x7fd38421f088 '\245' <repeats 128 times>, "P\361!\204\323\177", primary_key=64) at /data/src/10.5/sql/sql_class.h:6976
      #19 0x00005606f180e65c in SEQUENCE::read_stored_values (this=0x7fd3841fe080, table=0x7fd38421f9e8) at /data/src/10.5/sql/sql_sequence.cc:528
      #20 0x00005606f180e493 in SEQUENCE::read_initial_values (this=0x7fd3841fe080, table=0x7fd38421f9e8) at /data/src/10.5/sql/sql_sequence.cc:489
      #21 0x00005606f1cf7261 in ha_sequence::open (this=0x7fd3841f8930, name=0x7fd3841f8868 "./test/s", mode=2, flags=18) at /data/src/10.5/sql/ha_sequence.cc:118
      #22 0x00005606f18f6c5e in handler::ha_open (this=0x7fd3841f8930, table_arg=0x7fd38421f9e8, name=0x7fd3841f8868 "./test/s", mode=2, test_if_locked=18, mem_root=0x0, partitions_to_open=0x0) at /data/src/10.5/sql/handler.cc:2954
      #23 0x00005606f16dbc01 in open_table_from_share (thd=0x7fd384000b18, share=0x7fd3841f82d0, alias=0x7fd384013a60, db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7fd38421f9e8, is_create_table=false, partitions_to_open=0x0) at /data/src/10.5/sql/table.cc:4186
      #24 0x00005606f14f0ec4 in open_table (thd=0x7fd384000b18, table_list=0x7fd384013a18, ot_ctx=0x7fd3b3db2930) at /data/src/10.5/sql/sql_base.cc:1988
      #25 0x00005606f14f4ca5 in open_and_process_table (thd=0x7fd384000b18, tables=0x7fd384013a18, counter=0x7fd3b3db29c4, flags=0, prelocking_strategy=0x7fd3b3db2a48, has_prelocking_list=false, ot_ctx=0x7fd3b3db2930) at /data/src/10.5/sql/sql_base.cc:3784
      #26 0x00005606f14f5f62 in open_tables (thd=0x7fd384000b18, options=..., start=0x7fd3b3db29a8, counter=0x7fd3b3db29c4, flags=0, prelocking_strategy=0x7fd3b3db2a48) at /data/src/10.5/sql/sql_base.cc:4258
      #27 0x00005606f14f80aa in open_and_lock_tables (thd=0x7fd384000b18, options=..., tables=0x7fd384013a18, derived=false, flags=0, prelocking_strategy=0x7fd3b3db2a48) at /data/src/10.5/sql/sql_base.cc:5160
      #28 0x00005606f14afc27 in open_and_lock_tables (thd=0x7fd384000b18, tables=0x7fd384013a18, derived=false, flags=0) at /data/src/10.5/sql/sql_base.h:509
      #29 0x00005606f180f5ab in Sql_cmd_alter_sequence::execute (this=0x7fd3840140f8, thd=0x7fd384000b18) at /data/src/10.5/sql/sql_sequence.cc:906
      #30 0x00005606f15a25c6 in mysql_execute_command (thd=0x7fd384000b18) at /data/src/10.5/sql/sql_parse.cc:5951
      #31 0x00005606f15a88fb in mysql_parse (thd=0x7fd384000b18, rawbuf=0x7fd3840138d0 "ALTER SEQUENCE s INCREMENT= 1000", length=32, parser_state=0x7fd3b3db3520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7993
      #32 0x00005606f1594c71 in dispatch_command (command=COM_QUERY, thd=0x7fd384000b18, packet=0x7fd3841b1819 "ALTER SEQUENCE s INCREMENT= 1000", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1875
      #33 0x00005606f15933a9 in do_command (thd=0x7fd384000b18) at /data/src/10.5/sql/sql_parse.cc:1356
      #34 0x00005606f17384c1 in do_handle_one_connection (connect=0x5606f59cee28, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
      #35 0x00005606f1738229 in handle_one_connection (arg=0x5606f59cee28) at /data/src/10.5/sql/sql_connect.cc:1313
      #36 0x00005606f1c7292a in pfs_spawn_thread (arg=0x5606f59bafa8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #37 0x00007fd3c07fa4a4 in start_thread (arg=0x7fd3b3db4700) at pthread_create.c:456
      #38 0x00007fd3be92ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              monty Michael Widenius
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: