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

Assertion `block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE' failed in pagecache_read or ER_CRASHED_ON_USAGE

    XMLWordPrintable

    Details

      Description

      Note: The test case is extremely unreliable, run with --repeat=N where N is as big as you can afford. Sometimes it takes almost 10,000 repetitions before the assertion failure occurs.

      Note: See also MDEV-17659, they share essential parts of the test case, might be related.

      Note: The test case below has --error=0,1030 before the guilty select. It is there to skip MDEV-17659, which otherwise happens much more frequently than the assertion failure.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=Aria;
      CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=Aria PARTITION BY KEY (pk) PARTITIONS 2;
      SELECT * FROM t2;
      CREATE TABLE t3 (pk INT) ENGINE=Aria;
      CREATE TABLE t4 (pk INT) ENGINE=Aria;
      CREATE TABLE t5 (pk INT) ENGINE=Aria;
      CREATE TABLE t6 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=Aria;
      INSERT INTO t6 VALUES
        (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),
        (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),
        (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),
        (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),
        (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
       
      --connect (con1,localhost,root,,test)
       
      INSERT INTO t5 VALUES (1),(2);
      SELECT * FROM t5 INTO OUTFILE 'load.data';
       
      CREATE TABLE tx1 ENGINE=Aria SELECT pk FROM t4;
      CREATE TABLE tx2 ENGINE=Aria SELECT pk FROM t1;
      DROP TABLE tx1;
       
      --connect (con3,localhost,root,,test)
      CREATE TABLE tx3 ENGINE=Aria SELECT pk FROM t2;
      DROP TABLE IF EXISTS tx2;
       
      --connect (con2,localhost,root,,test)
      CREATE TEMPORARY TABLE tmp LIKE t4;
      SELECT * FROM t6; 
       REPLACE INTO tmp (pk) VALUES (NULL) ; 
       
      --error 1146
      SELECT pk FROM t1 JOIN non_existing_table WHERE f IN ( SELECT pk FROM tmp )
        UNION ALL
      SELECT pk FROM t1 JOIN non_existing_table WHERE f IN ( SELECT pk FROM tmp );
      DELETE FROM tmp LIMIT 3;
       
      --connection con1
      --send
        CREATE TABLE tx4 ENGINE=Aria SELECT * FROM t3;
       
      --connection con2
      OPTIMIZE TABLE tmp;
      DROP TABLE IF EXISTS tx3;
      LOAD DATA INFILE 'load.data' IGNORE INTO TABLE tmp;
      DELETE FROM tmp LIMIT 1;
      CREATE TABLE tx5 ENGINE=Aria SELECT * FROM `t6`;
      SELECT * FROM tx5;
      --error 0,1030
      SELECT tmp.pk FROM tmp JOIN t2 WHERE tmp.pk = ( SELECT pk FROM tmp );
       
      --connection con1
      --reap
       
      # Cleanup
       
      DROP TABLE IF EXISTS t1, t2, t3, t4, t5, t6;
      DROP TABLE IF EXISTS tx4, tx5;
      --let $datadir= `SELECT @@datadir`
      --remove_file $datadir/test/load.data
      

      10.2 debug 5cfb043d29

      mysqld: /data/src/10.2/storage/maria/ma_pagecache.c:3420: pagecache_read: Assertion `block->type == PAGECACHE_EMPTY_PAGE || block->type == type || ty
      pe == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE' failed.
      181110 21:25:51 [ERROR] mysqld got signal 6 ;
       
      Query (0x7fa884011088): SELECT tmp.pk FROM tmp JOIN t2 WHERE tmp.pk = ( SELECT pk FROM tmp )
      Connection ID (thread ID): 37303
      Status: NOT_KILLED
      

      #7  0x00007fa8adb09ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000559c721c1ad1 in pagecache_read (pagecache=0x559c73b38100 <maria_pagecache_var>, file=0x7fa88416b248, pageno=1, level=0, buff=0x7fa884189d10 '\245' <repeats 200 times>..., type=PAGECACHE_PLAIN_PAGE, lock=PAGECACHE_LOCK_LEFT_UNLOCKED, page_link=0x7fa8a8550540) at /data/src/10.2/storage/maria/ma_pagecache.c:3416
      #9  0x0000559c7220139d in _ma_scan_block_record (info=0x7fa88416ae10, record=0x7fa884129130 "\377", record_pos=0, skip_deleted=1 '\001') at /data/src/10.2/storage/maria/ma_blockrec.c:5508
      #10 0x0000559c721ee6f4 in maria_scan (info=0x7fa88416ae10, record=0x7fa884129130 "\377") at /data/src/10.2/storage/maria/ma_scan.c:54
      #11 0x0000559c7219a5c0 in ha_maria::rnd_next (this=0x7fa884156148, buf=0x7fa884129130 "\377") at /data/src/10.2/storage/maria/ha_maria.cc:2472
      #13 0x0000559c71f931d2 in handler::read_first_row (this=0x7fa884156148, buf=0x7fa884129130 "\377", primary_key=64) at /data/src/10.2/sql/handler.cc:2815
      #14 0x0000559c71d9e6c3 in handler::ha_read_first_row (this=0x7fa884156148, buf=0x7fa884129130 "\377", primary_key=64) at /data/src/10.2/sql/sql_class.h:5829
      #15 0x0000559c71d8682a in join_read_system (tab=0x7fa884014cc8) at /data/src/10.2/sql/sql_select.cc:19282
      #16 0x0000559c71d863eb in join_read_const_table (thd=0x7fa884000b00, tab=0x7fa884014cc8, pos=0x7fa884015280) at /data/src/10.2/sql/sql_select.cc:19178
      #17 0x0000559c71d609d5 in make_join_statistics (join=0x7fa884014440, tables_list=..., keyuse_array=0x7fa884014730) at /data/src/10.2/sql/sql_select.cc:4130
      #18 0x0000559c71d57e3f in JOIN::optimize_inner (this=0x7fa884014440) at /data/src/10.2/sql/sql_select.cc:1580
      #19 0x0000559c71d56323 in JOIN::optimize (this=0x7fa884014440) at /data/src/10.2/sql/sql_select.cc:1115
      #20 0x0000559c71d055e5 in st_select_lex::optimize_unflattened_subqueries (this=0x7fa884004e18, const_only=true) at /data/src/10.2/sql/sql_lex.cc:3859
      #21 0x0000559c71ebf8f1 in JOIN::optimize_constant_subqueries (this=0x7fa884013dd8) at /data/src/10.2/sql/opt_subselect.cc:5341
      #22 0x0000559c71d56e2a in JOIN::optimize_inner (this=0x7fa884013dd8) at /data/src/10.2/sql/sql_select.cc:1335
      #23 0x0000559c71d56323 in JOIN::optimize (this=0x7fa884013dd8) at /data/src/10.2/sql/sql_select.cc:1115
      #24 0x0000559c71d5f79e in mysql_select (thd=0x7fa884000b00, tables=0x7fa8840112d8, wild_num=0, fields=..., conds=0x7fa884013b68, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fa884013db8, unit=0x7fa8840046e0, select_lex=0x7fa884004e18) at /data/src/10.2/sql/sql_select.cc:3790
      #25 0x0000559c71d53ad7 in handle_select (thd=0x7fa884000b00, lex=0x7fa884004618, result=0x7fa884013db8, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:376
      #26 0x0000559c71d1f13b in execute_sqlcom_select (thd=0x7fa884000b00, all_tables=0x7fa8840112d8) at /data/src/10.2/sql/sql_parse.cc:6478
      #27 0x0000559c71d150bb in mysql_execute_command (thd=0x7fa884000b00) at /data/src/10.2/sql/sql_parse.cc:3484
      #28 0x0000559c71d23015 in mysql_parse (thd=0x7fa884000b00, rawbuf=0x7fa884011088 "SELECT tmp.pk FROM tmp JOIN t2 WHERE tmp.pk = ( SELECT pk FROM tmp )", length=68, parser_state=0x7fa8a8552200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8012
      #29 0x0000559c71d1095f in dispatch_command (command=COM_QUERY, thd=0x7fa884000b00, packet=0x7fa8840088a1 "SELECT tmp.pk FROM tmp JOIN t2 WHERE tmp.pk = ( SELECT pk FROM tmp )", packet_length=68, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #30 0x0000559c71d0f2c2 in do_command (thd=0x7fa884000b00) at /data/src/10.2/sql/sql_parse.cc:1378
      #31 0x0000559c71e617ab in do_handle_one_connection (connect=0x559c75db5fe0) at /data/src/10.2/sql/sql_connect.cc:1335
      #32 0x0000559c71e61538 in handle_one_connection (arg=0x559c75db5fe0) at /data/src/10.2/sql/sql_connect.cc:1241
      #33 0x0000559c72284b9a in pfs_spawn_thread (arg=0x559c75dc1040) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #34 0x00007fa8af7e0494 in start_thread (arg=0x7fa8a8553700) at pthread_create.c:333
      #35 0x00007fa8adbc693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 non-debug 5cfb043d29

      mysqltest: At line 53: query 'SELECT tmp.pk FROM tmp JOIN t2 WHERE tmp.pk = ( SELECT pk FROM tmp )' failed with wrong errno 1194: 'Table 'tmp' is marked as crashed and should be repaired', instead of 0...
      

      2018-11-10 22:28:18 140571209197312 [ERROR] Got error 127 when reading table '/data/bld/10.2-rel/mysql-test/var/tmp/mysqld.1/#sql2233_a9_7'
      2018-11-10 22:28:18 140571209197312 [ERROR] mysqld: Table 'tmp' is marked as crashed and should be repaired
      

        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: