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

Assertion `!rec_offs_nth_default(clust_offs, clust_pos)' failed in row_sel_sec_rec_is_for_clust_rec

    XMLWordPrintable

    Details

      Description

      Note: The test case is non-deterministic, run with --repeat=N. N=10 has always been enough for me (usually it fails in the first 1-2 attempts), but it can vary on different machines and builds.

      Important note: The test case is for reproducing only, it uses a long sleep, don't put it into the regression suite as is! It appears that the length of the sleep is important, probably there is an internal race condition. You can experiment with the length by running the test with --sleep=N as a command-line option. I expect the reason why it's needed will become apparent in the course of debugging.

      --source include/have_innodb.inc
       
      SET @stats= @@innodb_stats_persistent;
      SET GLOBAL innodb_stats_persistent= ON;
       
      CREATE TABLE t1 (i INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (NULL),(NULL),(0),(NULL);
       
      CREATE TABLE t2 (a INT) ENGINE=InnoDB;
      INSERT INTO t2 VALUES (0),(0),(0),(0),(0),(0);
      ALTER TABLE t2 ADD COLUMN b INT NOT NULL;
      ALTER TABLE t2 ADD KEY (b);
       
      --connect (con1,localhost,root,,test)
      --sleep 10
      SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
      SELECT * FROM t1 LEFT JOIN t2 ON ( i = b );
       
      # Cleanup
      --disconnect con1
      --connection default
      DROP TABLE IF EXISTS t1, t2;
      SET GLOBAL innodb_stats_persistent= @stats;
      

      10.3 06e5f28f9

      mysqld: /data/src/10.3/storage/innobase/row/row0sel.cc:257: ulint row_sel_sec_rec_is_for_clust_rec(const rec_t*, dict_index_t*, const rec_t*, dict_index_t*, que_thr_t*): Assertion `!rec_offs_nth_default(clust_offs, clust_pos)' failed.
       
      #7  0x00007fcfb1d4cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562e620e37bd in row_sel_sec_rec_is_for_clust_rec (sec_rec=0x7fcfa750407d "\200", sec_index=0x7fcf54174368, clust_rec=0x7fcfa74f807e "", clust_index=0x7fcf54072a08, thr=0x7fcf5403fe38) at /data/src/10.3/storage/innobase/row/row0sel.cc:257
      #9  0x0000562e620eaa9b in row_sel_get_clust_rec_for_mysql (prebuilt=0x7fcf5403f738, sec_index=0x7fcf54174368, rec=0x7fcfa750407d "\200", thr=0x7fcf5403fe38, out_rec=0x7fcfac0a6b00, offsets=0x7fcfac0a6b20, offset_heap=0x7fcfac0a6b18, vrow=0x0, mtr=0x7fcfac0a7490) at /data/src/10.3/storage/innobase/row/row0sel.cc:3495
      #10 0x0000562e620ef3ab in row_search_mvcc (buf=0x7fcf54073170 "\377", mode=PAGE_CUR_GE, prebuilt=0x7fcf5403f738, match_mode=1, direction=0) at /data/src/10.3/storage/innobase/row/row0sel.cc:5287
      #11 0x0000562e61f5b597 in ha_innobase::index_read (this=0x7fcf54170e78, buf=0x7fcf54073170 "\377", key_ptr=0x7fcf580185f8 "", key_len=4, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9259
      #12 0x0000562e61c46a22 in handler::index_read_map (this=0x7fcf54170e78, buf=0x7fcf54073170 "\377", key=0x7fcf580185f8 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/sql/handler.h:3463
      #13 0x0000562e61c3a1a9 in handler::ha_index_read_map (this=0x7fcf54170e78, buf=0x7fcf54073170 "\377", key=0x7fcf580185f8 "", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/sql/handler.cc:2823
      #14 0x0000562e619b2aec in join_read_always_key (tab=0x7fcf58017e78) at /data/src/10.3/sql/sql_select.cc:20154
      #15 0x0000562e619b0fa6 in sub_select (join=0x7fcf58015408, join_tab=0x7fcf58017e78, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19393
      #16 0x0000562e619b1728 in evaluate_join_record (join=0x7fcf58015408, join_tab=0x7fcf58017ac8, error=0) at /data/src/10.3/sql/sql_select.cc:19616
      #17 0x0000562e619b11c4 in sub_select (join=0x7fcf58015408, join_tab=0x7fcf58017ac8, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19435
      #18 0x0000562e619b0542 in do_select (join=0x7fcf58015408, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:18936
      #19 0x0000562e61989139 in JOIN::exec_inner (this=0x7fcf58015408) at /data/src/10.3/sql/sql_select.cc:4040
      #20 0x0000562e6198857a in JOIN::exec (this=0x7fcf58015408) at /data/src/10.3/sql/sql_select.cc:3834
      #21 0x0000562e6198981a in mysql_select (thd=0x7fcf58000b00, tables=0x7fcf58013b40, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fcf580153e0, unit=0x7fcf580049b0, select_lex=0x7fcf58005120) at /data/src/10.3/sql/sql_select.cc:4239
      #22 0x0000562e6197b740 in handle_select (thd=0x7fcf58000b00, lex=0x7fcf580048e8, result=0x7fcf580153e0, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:385
      #23 0x0000562e6194615b in execute_sqlcom_select (thd=0x7fcf58000b00, all_tables=0x7fcf58013b40) at /data/src/10.3/sql/sql_parse.cc:6546
      #24 0x0000562e6193c7cb in mysql_execute_command (thd=0x7fcf58000b00) at /data/src/10.3/sql/sql_parse.cc:3767
      #25 0x0000562e6194a113 in mysql_parse (thd=0x7fcf58000b00, rawbuf=0x7fcf58013918 "SELECT * FROM t1 LEFT JOIN t2 ON ( i = b )", length=42, parser_state=0x7fcfac0a95f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8090
      #26 0x0000562e619372d9 in dispatch_command (command=COM_QUERY, thd=0x7fcf58000b00, packet=0x7fcf5800b1e1 "", packet_length=42, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #27 0x0000562e61935cfd in do_command (thd=0x7fcf58000b00) at /data/src/10.3/sql/sql_parse.cc:1395
      #28 0x0000562e61a9d9d2 in do_handle_one_connection (connect=0x562e64bcc100) at /data/src/10.3/sql/sql_connect.cc:1402
      #29 0x0000562e61a9d756 in handle_one_connection (arg=0x562e64bcc100) at /data/src/10.3/sql/sql_connect.cc:1308
      #30 0x0000562e61f37c8b in pfs_spawn_thread (arg=0x562e64c0dda0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #31 0x00007fcfb3808494 in start_thread (arg=0x7fcfac0aa700) at pthread_create.c:333
      #32 0x00007fcfb1e0993f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Not reproducible on 10.2.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: