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

Details

    Description

      I'm demoting it to Minor, because after related fixes the failure is reproducible in 10.2-10.3 and doesn't appear to affect non-debug builds

      The test case is non-deterministic, run with --repeat=N. It usually fails for me within several attempts on 10.2/10.3 debug, but it can vary on different machines and builds.

      --source include/have_sequence.inc
       
      CREATE TABLE t1 (id INT, f INT, KEY (f), PRIMARY KEY (id)) ENGINE=Aria;
      ALTER TABLE t1 DISABLE KEYS;
      INSERT INTO t1 SELECT seq, 0 FROM seq_1_to_200;
       
      --connect (con1,localhost,root,,test)
      --send
        CREATE TABLE t2 SELECT f FROM t1;
       
      --connection default
      --let $run= 100
      --disable_query_log
      --disable_result_log
      while ($run)
      {
        --error ER_BAD_FIELD_ERROR
        INSERT INTO t1 (x) SELECT seq FROM seq_1_to_100;
        --dec $run
      }
      --enable_query_log
      --enable_result_log
       
      # Cleanup
      --connection con1
      --reap
      --disconnect con1
      --connection default
      DROP TABLE t1, t2;
      

      10.2 14a18d7d

      mysqld: /data/src/10.2/storage/maria/ma_pagecache.c:3416: pagecache_read: Assertion `block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOW
      N_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE' failed.
      210426 21:08:34 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f6bd6ff1729 in __assert_fail_base (fmt=0x7f6bd7187588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5626246a4278 "block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE", file=0x5626246a2d78 "/data/src/10.2/storage/maria/ma_pagecache.c", line=3416, function=<optimized out>) at assert.c:92
      #7  0x00007f6bd7002f36 in __GI___assert_fail (assertion=0x5626246a4278 "block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE", file=0x5626246a2d78 "/data/src/10.2/storage/maria/ma_pagecache.c", line=3416, function=0x5626246a4f58 <__PRETTY_FUNCTION__.18793> "pagecache_read") at assert.c:101
      #8  0x000056262420ecbc in pagecache_read (pagecache=0x562625596960 <maria_pagecache_var>, file=0x7f6bc007e510, pageno=1, level=0, buff=0x7f6bb40b7660 '\245' <repeats 200 times>..., type=PAGECACHE_PLAIN_PAGE, lock=PAGECACHE_LOCK_LEFT_UNLOCKED, page_link=0x7f6bd0fc3110) at /data/src/10.2/storage/maria/ma_pagecache.c:3416
      #9  0x000056262424f228 in _ma_scan_block_record (info=0x7f6bc007e0d0, record=0x7f6bc018ef50 "\377", record_pos=0, skip_deleted=1 '\001') at /data/src/10.2/storage/maria/ma_blockrec.c:5508
      #10 0x000056262423c2ce in maria_scan (info=0x7f6bc007e0d0, record=0x7f6bc018ef50 "\377") at /data/src/10.2/storage/maria/ma_scan.c:54
      #11 0x00005626241e7b74 in ha_maria::rnd_next (this=0x7f6bc009edd8, buf=0x7f6bc018ef50 "\377") at /data/src/10.2/storage/maria/ha_maria.cc:2477
      #12 0x0000562623c4ce83 in handler::ha_rnd_next (this=0x7f6bc009edd8, buf=0x7f6bc018ef50 "\377") at /data/src/10.2/sql/handler.cc:2669
      #13 0x0000562623dc1147 in rr_sequential (info=0x7f6bb40141a0) at /data/src/10.2/sql/records.cc:492
      #14 0x0000562623a36b7b in join_init_read_record (tab=0x7f6bb40140d8) at /data/src/10.2/sql/sql_select.cc:19791
      #15 0x0000562623a348ba in sub_select (join=0x7f6bb4012600, join_tab=0x7f6bb40140d8, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18862
      #16 0x0000562623a33e7e in do_select (join=0x7f6bb4012600, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18409
      #17 0x0000562623a0da5f in JOIN::exec_inner (this=0x7f6bb4012600) at /data/src/10.2/sql/sql_select.cc:3642
      #18 0x0000562623a0cf06 in JOIN::exec (this=0x7f6bb4012600) at /data/src/10.2/sql/sql_select.cc:3437
      #19 0x0000562623a0e0e0 in mysql_select (thd=0x7f6bb4000d90, tables=0x7f6bb4011cf0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f6bb4012510, unit=0x7f6bb4004988, select_lex=0x7f6bb40050c8) at /data/src/10.2/sql/sql_select.cc:3840
      #20 0x0000562623a02242 in handle_select (thd=0x7f6bb4000d90, lex=0x7f6bb40048c8, result=0x7f6bb4012510, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #21 0x0000562623aa36a7 in Sql_cmd_create_table::execute (this=0x7f6bb4011560, thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_table.cc:10997
      #22 0x00005626239cb7bb in mysql_execute_command (thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_parse.cc:6020
      #23 0x00005626239d0620 in mysql_parse (thd=0x7f6bb4000d90, rawbuf=0x7f6bb4011480 "CREATE TABLE t2 SELECT f FROM t1", length=32, parser_state=0x7f6bd0fc4570, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7796
      #24 0x00005626239be84a in dispatch_command (command=COM_QUERY, thd=0x7f6bb4000d90, packet=0x7f6bb4060e81 "CREATE TABLE t2 SELECT f FROM t1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #25 0x00005626239bd345 in do_command (thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #26 0x0000562623b1874c in do_handle_one_connection (connect=0x5626262dfb20) at /data/src/10.2/sql/sql_connect.cc:1336
      #27 0x0000562623b184b1 in handle_one_connection (arg=0x5626262dfb20) at /data/src/10.2/sql/sql_connect.cc:1241
      #28 0x00005626243433ae in pfs_spawn_thread (arg=0x562626321860) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #29 0x00007f6bd7512609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #30 0x00007f6bd70ee293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.2, 10.3.
      Not reproducible on 10.4, possibly due to patches for MDEV-17665/MDEV-23296 and/or related bugs in 10.4+.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Component/s Admin statements [ 11400 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 10.4 [ 22408 ]
            Description https://travis-ci.org/elenst/travis-tests/jobs/450112143
            {noformat:title=10.3 a33c0e3f34afd024ded83d3e5ec122c50d8b38a2}
            mysqld: /home/travis/src/storage/maria/ma_pagecache.c:3420: pagecache_read: 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.
            181103 12:14:38 [ERROR] mysqld got signal 6 ;

            /lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f9864804028]
            /lib/x86_64-linux-gnu/libc.so.6(+0x2fbf6)[0x7f98647f9bf6]
            /lib/x86_64-linux-gnu/libc.so.6(+0x2fca2)[0x7f98647f9ca2]
            /home/travis/server/bin/mysqld(+0xfb8a34)[0x55cc40647a34]
            maria/ma_pagecache.c:3421(pagecache_read)[0x55cc406893a4]
            maria/ma_blockrec.c:5508(_ma_scan_block_record)[0x55cc40675b47]
            maria/ma_scan.c:54(maria_scan)[0x55cc4061e662]
            maria/ha_maria.cc:2482(ha_maria::rnd_next(unsigned char*))[0x55cc40042f41]
            sql/handler.cc:2765(handler::ha_rnd_next(unsigned char*))[0x55cc40044953]
            sql/handler.cc:3010(handler::read_first_row(unsigned char*, unsigned int))[0x55cc3fdd3835]
            sql/sql_class.h:6390(handler::ha_read_first_row(unsigned char*, unsigned int))[0x55cc3fdbb94c]
            sql/sql_select.cc:19836(join_read_system)[0x55cc3fdbb4d9]
            sql/sql_select.cc:19732(join_read_const_table)[0x55cc3fd94470]
            sql/sql_select.cc:4563(make_join_statistics)[0x55cc3fd8afee]
            sql/sql_select.cc:1895(JOIN::optimize_inner())[0x55cc3fd89609]
            sql/sql_select.cc:1448(JOIN::optimize())[0x55cc3fe3a2e4]
            sql/sql_union.cc:1355(st_select_lex_unit::optimize())[0x55cc3fe3a51f]
            sql/sql_union.cc:1389(st_select_lex_unit::exec())[0x55cc3fe35a15]
            sql/sql_union.cc:41(mysql_union(THD*, LEX*, select_result*, st_select_lex_unit*, unsigned long))[0x55cc3fd8502d]
            sql/sql_select.cc:360(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55cc3fd4fce1]
            sql/sql_parse.cc:6547(execute_sqlcom_select)[0x55cc3fd46353]
            sql/sql_parse.cc:3769(mysql_execute_command(THD*))[0x55cc3fd53c6e]
            sql/sql_parse.cc:8091(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55cc3fd40e7e]
            sql/sql_parse.cc:1852(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55cc3fd3f8af]
            sql/sql_parse.cc:1395(do_command(THD*))[0x55cc3fea7e96]
            sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x55cc3fea7c1a]
            /lib/x86_64-linux-gnu/libpthread.so.0(+0x8184)[0x7f98653bb184]
            /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f98648c7ffd]
            Trying to get some variables.
            Some pointers may be invalid and cause the dump to abort.
            Query (0x7f985c051928): /* GenTest::Transform::ExecuteAsIntersect */ ( SELECT * FROM `view_table10_key_pk_parts_2_int_autoinc` AS X WHERE X.`col_int` < 2 LIMIT 7 /* QNO 13394 CON_ID 16 */ ) INTERSECT ( SELECT * FROM `view_table10_key_pk_parts_2_int_autoinc` AS X WHERE X.`col_int` < 2 LIMIT 7 /* QNO 13394 CON_ID 16 */ ) /* TRANSFORM_OUTCOME_DISTINCT */ /* QNO 13395 CON_ID 16 */
            Connection ID (thread ID): 16
            Status: NOT_KILLED
            Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on
            {noformat}
            {noformat:title=elenst-mdev14046 1348571d03a3b335fe5d772cbbb27c13f24c62e0}
            perl ./runall-new.pl --basedir=/home/travis/server --vardir=/home/travis/logs/vardir --duration=350 --threads=6 --seed=1541247163 --reporters=Backtrace,ErrorLog,Deadlock --validators=TransformerNoComparator --views --redefine=conf/mariadb/alter_table.yy --redefine=conf/mariadb/sp.yy --redefine=conf/mariadb/bulk_insert.yy --redefine=conf/mariadb/versioning.yy --redefine=conf/mariadb/sequences.yy --mysqld=--log_output=FILE --mysqld=--max-statement-time=30 --mysqld=--lock-wait-timeout=10 --mysqld=--loose-innodb-lock-wait-timeout=5 --mysqld=--loose-debug_assert_on_not_freed_memory=0 --mysqld=--default-storage-engine=Aria --grammar=conf/engines/engine_stress.yy --gendata=conf/engines/engine_stress.zz --mysqld=--log_bin_trust_function_creators=1 --mysqld=--default-storage-engine=Aria --grammar=conf/engines/engine_stress.yy --gendata=conf/engines/engine_stress.zz --mysqld=--log-bin --transformers=ExecuteAsIntersect,ExecuteAsExcept,ExecuteAsCTE,ExecuteAsExecuteImmediate,ExecuteAsDeleteReturning,ExecuteAsInsertSelect,ExecuteAsUnion,ExecuteAsUpdateDelete,ExecuteAsView,ExecuteAsPreparedTwice --redefine=conf/mariadb/general-workarounds.yy
            {noformat}

            Reproducible, but unreliably, and intermittently with MDEV-17538. Work in progress.
            _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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}
            Summary [Draft] 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 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
            elenst Elena Stepanova made changes -
            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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}
            _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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}
            elenst Elena Stepanova made changes -
            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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}
            _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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}

            {noformat:title=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...
            {noformat}
            {noformat}
            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
            {noformat}
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ] Michael Widenius [ monty ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Michael Widenius [ monty ] Vladislav Lesin [ vlad.lesin ]
            elenst Elena Stepanova made changes -
            alice Alice Sherepa added a comment - - edited

            similar one on 10.5:

            10.5 a18639f1a913b446f32d

            mysqld: /10.5/storage/maria/ma_pagecache.c:3806: pagecache_read: 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.
            200724 13:33:25 [ERROR] mysqld got signal 6 ;
             
            Server version: 10.5.5-MariaDB-debug-log
             
            linux/raise.c:51(__GI_raise)[0x7f0cd9a7b7bb]
            stdlib/abort.c:81(__GI_abort)[0x7f0cd9a66535]
            intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f0cd9a6640f]
            ??:0(__assert_fail)[0x7f0cd9a74102]
            maria/ma_pagecache.c:3807(pagecache_read)[0x5609c034701e]
            maria/ma_blockrec.c:5524(_ma_scan_block_record)[0x5609c0332a24]
            maria/ma_scan.c:54(maria_scan)[0x5609c02d2b77]
            maria/ha_maria.cc:2509(ha_maria::rnd_next(unsigned char*))[0x5609c0047d7d]
            sql/handler.cc:3060(handler::ha_rnd_next(unsigned char*))[0x5609c01fd93d]
            sql/records.cc:511(rr_sequential(READ_RECORD*))[0x5609bfc3adb9]
            sql/records.h:79(READ_RECORD::read_record())[0x5609bfd6ed1c]
            sql/sql_select.cc:20660(sub_select(JOIN*, st_join_table*, bool))[0x5609bfd42d25]
            sql/sql_select.cc:20175(do_select(JOIN*, Procedure*))[0x5609bfd41e51]
            sql/sql_select.cc:4450(JOIN::exec_inner())[0x5609bfd43572]
            sql/sql_select.cc:4232(JOIN::exec())[0x5609bfd333c8]
            sql/sql_select.cc:417(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5609bfcf8de3]
            sql/sql_parse.cc:6209(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5609bfcf010f]
            sql/sql_parse.cc:3931(mysql_execute_command(THD*))[0x5609bfcfdc25]
            sql/sql_parse.cc:7993(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5609bfcea065]
            sql/sql_parse.cc:1869(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5609bfce87a5]
            sql/sql_parse.cc:1347(do_command(THD*))[0x5609bfe8bb49]
            sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x5609bfe8b8b2]
            sql/sql_connect.cc:1314(handle_one_connection)[0x5609c03c391f]
            nptl/pthread_create.c:487(start_thread)[0x7f0cda534fa3]
            x86_64/clone.S:97(clone)[0x7f0cd9b3d4cf]
             
            Query (0x7f0c7c014ff0): SELECT  * FROM `view_E`
            

            alice Alice Sherepa added a comment - - edited similar one on 10.5: 10.5 a18639f1a913b446f32d mysqld: /10.5/storage/maria/ma_pagecache.c:3806: pagecache_read: 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. 200724 13:33:25 [ERROR] mysqld got signal 6 ;   Server version: 10.5.5-MariaDB-debug-log   linux/raise.c:51(__GI_raise)[0x7f0cd9a7b7bb] stdlib/abort.c:81(__GI_abort)[0x7f0cd9a66535] intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f0cd9a6640f] ??:0(__assert_fail)[0x7f0cd9a74102] maria/ma_pagecache.c:3807(pagecache_read)[0x5609c034701e] maria/ma_blockrec.c:5524(_ma_scan_block_record)[0x5609c0332a24] maria/ma_scan.c:54(maria_scan)[0x5609c02d2b77] maria/ha_maria.cc:2509(ha_maria::rnd_next(unsigned char*))[0x5609c0047d7d] sql/handler.cc:3060(handler::ha_rnd_next(unsigned char*))[0x5609c01fd93d] sql/records.cc:511(rr_sequential(READ_RECORD*))[0x5609bfc3adb9] sql/records.h:79(READ_RECORD::read_record())[0x5609bfd6ed1c] sql/sql_select.cc:20660(sub_select(JOIN*, st_join_table*, bool))[0x5609bfd42d25] sql/sql_select.cc:20175(do_select(JOIN*, Procedure*))[0x5609bfd41e51] sql/sql_select.cc:4450(JOIN::exec_inner())[0x5609bfd43572] sql/sql_select.cc:4232(JOIN::exec())[0x5609bfd333c8] sql/sql_select.cc:417(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5609bfcf8de3] sql/sql_parse.cc:6209(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5609bfcf010f] sql/sql_parse.cc:3931(mysql_execute_command(THD*))[0x5609bfcfdc25] sql/sql_parse.cc:7993(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5609bfcea065] sql/sql_parse.cc:1869(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5609bfce87a5] sql/sql_parse.cc:1347(do_command(THD*))[0x5609bfe8bb49] sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x5609bfe8b8b2] sql/sql_connect.cc:1314(handle_one_connection)[0x5609c03c391f] nptl/pthread_create.c:487(start_thread)[0x7f0cda534fa3] x86_64/clone.S:97(clone)[0x7f0cd9b3d4cf]   Query (0x7f0c7c014ff0): SELECT * FROM `view_E`
            alice Alice Sherepa made changes -
            Affects Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.5 [ 23123 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.5 [ 23123 ]
            elenst Elena Stepanova made changes -

            It will probably end up to be a duplicate of MDEV-17665 (this one is older, but MDEV-17665 contains more variations and a better-looking test case). I will keep both open for now since the test cases are non-deterministic, there is no way to know which one will work better when/if it comes to debugging.

            elenst Elena Stepanova added a comment - It will probably end up to be a duplicate of MDEV-17665 (this one is older, but MDEV-17665 contains more variations and a better-looking test case). I will keep both open for now since the test cases are non-deterministic, there is no way to know which one will work better when/if it comes to debugging.
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Vladislav Lesin [ vlad.lesin ] Elena Stepanova [ elenst ]
            Labels need_bisect
            alice Alice Sherepa added a comment -

            I'm still getting this assertion in tests from time to time, but probably it should be reported separately
            (I tried the test case from the description, no failures on 10000 repeats))

            mysqld: /10.3/storage/maria/ma_pagecache.c:3420: pagecache_read: 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.
            210217 16:40:20 [ERROR] mysqld got signal 6 ;
             
            Server version: 10.3.28-MariaDB-debug-log
             
            linux/raise.c:51(__GI_raise)[0x7f5792e837bb]
            stdlib/abort.c:81(__GI_abort)[0x7f5792e6e535]
            intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f5792e6e40f]
            /lib/x86_64-linux-gnu/libc.so.6(+0x30102)[0x7f5792e7c102]
            maria/ma_pagecache.c:3421(pagecache_read)[0x5629bd897553]
            maria/ma_blockrec.c:5508(_ma_scan_block_record)[0x5629bd9554b2]
            maria/ma_scan.c:54(maria_scan)[0x5629bd91d6e8]
            maria/ha_maria.cc:2404(ha_maria::rnd_next(unsigned char*))[0x5629bd82af0b]
            sql/handler.cc:2847(handler::ha_rnd_next(unsigned char*))[0x5629bc87dd4d]
            sql/records.cc:485(rr_sequential(READ_RECORD*))[0x5629bcc9f2d1]
            sql/records.h:70(READ_RECORD::read_record())[0x5629bbf30bde]
            sql/sql_select.cc:20647(join_init_read_record(st_join_table*))[0x5629bc20e3d2]
            sql/sql_select.cc:19708(sub_select(JOIN*, st_join_table*, bool))[0x5629bc206a4b]
            sql/sql_select.cc:19251(do_select(JOIN*, Procedure*))[0x5629bc204935]
            sql/sql_select.cc:4124(JOIN::exec_inner())[0x5629bc1954d2]
            sql/sql_select.cc:3919(JOIN::exec())[0x5629bc192eaa]
            sql/sql_select.cc:4325(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5629bc196773]
            sql/sql_select.cc:370(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5629bc16d270]
            sql/sql_parse.cc:6316(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5629bc0d96b0]
            sql/sql_parse.cc:3847(mysql_execute_command(THD*))[0x5629bc0c71f0]
            sql/sql_parse.cc:7840(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5629bc0e37a7]
            sql/sql_parse.cc:1855(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5629bc0b9e7c]
            sql/sql_parse.cc:1398(do_command(THD*))[0x5629bc0b65b7]
            sql/sql_connect.cc:1403(do_handle_one_connection(CONNECT*))[0x5629bc4a73d0]
            sql/sql_connect.cc:1309(handle_one_connection)[0x5629bc4a6c88]
            nptl/pthread_create.c:487(start_thread)[0x7f57935c1fa3]
            x86_64/clone.S:97(clone)[0x7f5792f454cf]
             
            Query (0x62b00005b290):  SELECT COUNT(*) FROM `D_Aria` WHERE row_start IN (SELECT row_end FROM `BB_Aria`) 
            

            alice Alice Sherepa added a comment - I'm still getting this assertion in tests from time to time, but probably it should be reported separately (I tried the test case from the description, no failures on 10000 repeats)) mysqld: /10.3/storage/maria/ma_pagecache.c:3420: pagecache_read: 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. 210217 16:40:20 [ERROR] mysqld got signal 6 ;   Server version: 10.3.28-MariaDB-debug-log   linux/raise.c:51(__GI_raise)[0x7f5792e837bb] stdlib/abort.c:81(__GI_abort)[0x7f5792e6e535] intl/loadmsgcat.c:1177(_nl_load_domain)[0x7f5792e6e40f] /lib/x86_64-linux-gnu/libc.so.6(+0x30102)[0x7f5792e7c102] maria/ma_pagecache.c:3421(pagecache_read)[0x5629bd897553] maria/ma_blockrec.c:5508(_ma_scan_block_record)[0x5629bd9554b2] maria/ma_scan.c:54(maria_scan)[0x5629bd91d6e8] maria/ha_maria.cc:2404(ha_maria::rnd_next(unsigned char*))[0x5629bd82af0b] sql/handler.cc:2847(handler::ha_rnd_next(unsigned char*))[0x5629bc87dd4d] sql/records.cc:485(rr_sequential(READ_RECORD*))[0x5629bcc9f2d1] sql/records.h:70(READ_RECORD::read_record())[0x5629bbf30bde] sql/sql_select.cc:20647(join_init_read_record(st_join_table*))[0x5629bc20e3d2] sql/sql_select.cc:19708(sub_select(JOIN*, st_join_table*, bool))[0x5629bc206a4b] sql/sql_select.cc:19251(do_select(JOIN*, Procedure*))[0x5629bc204935] sql/sql_select.cc:4124(JOIN::exec_inner())[0x5629bc1954d2] sql/sql_select.cc:3919(JOIN::exec())[0x5629bc192eaa] sql/sql_select.cc:4325(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5629bc196773] sql/sql_select.cc:370(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5629bc16d270] sql/sql_parse.cc:6316(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5629bc0d96b0] sql/sql_parse.cc:3847(mysql_execute_command(THD*))[0x5629bc0c71f0] sql/sql_parse.cc:7840(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5629bc0e37a7] sql/sql_parse.cc:1855(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5629bc0b9e7c] sql/sql_parse.cc:1398(do_command(THD*))[0x5629bc0b65b7] sql/sql_connect.cc:1403(do_handle_one_connection(CONNECT*))[0x5629bc4a73d0] sql/sql_connect.cc:1309(handle_one_connection)[0x5629bc4a6c88] nptl/pthread_create.c:487(start_thread)[0x7f57935c1fa3] x86_64/clone.S:97(clone)[0x7f5792f454cf]   Query (0x62b00005b290): SELECT COUNT(*) FROM `D_Aria` WHERE row_start IN (SELECT row_end FROM `BB_Aria`)

            The original test case stopped reproducing the failure after the patch for MDEV-17659. The scenario was very similar in these two bug reports, so it's not surprising.
            I have re-written the description entirely with a new test case, which still reproduces the failure on 10.2/10.3, but not on 10.4+, possibly to the fix for MDEV-17665 / MDEV-23296.

            For a note, there is still a problem in 10.4 which causes the same assertion failure in pagecache_read, but with otherwise an entirely different stack trace – something coming from ha_maria::repair and going through _ma_flush_pending_blocks. When we get a test case for that, it should probably be filed separately.

            elenst Elena Stepanova added a comment - The original test case stopped reproducing the failure after the patch for MDEV-17659 . The scenario was very similar in these two bug reports, so it's not surprising. I have re-written the description entirely with a new test case, which still reproduces the failure on 10.2/10.3, but not on 10.4+, possibly to the fix for MDEV-17665 / MDEV-23296 . For a note, there is still a problem in 10.4 which causes the same assertion failure in pagecache_read , but with otherwise an entirely different stack trace – something coming from ha_maria::repair and going through _ma_flush_pending_blocks . When we get a test case for that, it should probably be filed separately.
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Component/s Admin statements [ 11400 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Affects Version/s 10.4 [ 22408 ]
            Affects Version/s 10.5 [ 23123 ]
            Assignee Elena Stepanova [ elenst ]
            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._

            {code:sql}
            --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
            {code}

            {noformat:title=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
            {noformat}
            {noformat}
            #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
            {noformat}

            {noformat:title=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...
            {noformat}
            {noformat}
            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
            {noformat}
            _I'm demoting it to Minor, because after related fixes the failure is reproducible in 10.2-10.3 and doesn't appear to affect non-debug builds_

            _The test case is non-deterministic, run with {{--repeat=N}}. It usually fails for me within several attempts on 10.2/10.3 debug, but it can vary on different machines and builds._

            {code:sql}
            --source include/have_sequence.inc

            CREATE TABLE t1 (id INT, f INT, KEY (f), PRIMARY KEY (id)) ENGINE=Aria;
            ALTER TABLE t1 DISABLE KEYS;
            INSERT INTO t1 SELECT seq, 0 FROM seq_1_to_200;

            --connect (con1,localhost,root,,test)
            --send
              CREATE TABLE t2 SELECT f FROM t1;

            --connection default
            --let $run= 100
            --disable_query_log
            --disable_result_log
            while ($run)
            {
              --error ER_BAD_FIELD_ERROR
              INSERT INTO t1 (x) SELECT seq FROM seq_1_to_100;
              --dec $run
            }
            --enable_query_log
            --enable_result_log

            # Cleanup
            --connection con1
            --reap
            --disconnect con1
            --connection default
            DROP TABLE t1, t2;
            {code}

            {noformat:title=10.2 14a18d7d}
            mysqld: /data/src/10.2/storage/maria/ma_pagecache.c:3416: pagecache_read: Assertion `block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOW
            N_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE' failed.
            210426 21:08:34 [ERROR] mysqld got signal 6 ;

            #6 0x00007f6bd6ff1729 in __assert_fail_base (fmt=0x7f6bd7187588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5626246a4278 "block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE", file=0x5626246a2d78 "/data/src/10.2/storage/maria/ma_pagecache.c", line=3416, function=<optimized out>) at assert.c:92
            #7 0x00007f6bd7002f36 in __GI___assert_fail (assertion=0x5626246a4278 "block->type == PAGECACHE_EMPTY_PAGE || block->type == type || type == PAGECACHE_LSN_PAGE || type == PAGECACHE_READ_UNKNOWN_PAGE || block->type == PAGECACHE_READ_UNKNOWN_PAGE", file=0x5626246a2d78 "/data/src/10.2/storage/maria/ma_pagecache.c", line=3416, function=0x5626246a4f58 <__PRETTY_FUNCTION__.18793> "pagecache_read") at assert.c:101
            #8 0x000056262420ecbc in pagecache_read (pagecache=0x562625596960 <maria_pagecache_var>, file=0x7f6bc007e510, pageno=1, level=0, buff=0x7f6bb40b7660 '\245' <repeats 200 times>..., type=PAGECACHE_PLAIN_PAGE, lock=PAGECACHE_LOCK_LEFT_UNLOCKED, page_link=0x7f6bd0fc3110) at /data/src/10.2/storage/maria/ma_pagecache.c:3416
            #9 0x000056262424f228 in _ma_scan_block_record (info=0x7f6bc007e0d0, record=0x7f6bc018ef50 "\377", record_pos=0, skip_deleted=1 '\001') at /data/src/10.2/storage/maria/ma_blockrec.c:5508
            #10 0x000056262423c2ce in maria_scan (info=0x7f6bc007e0d0, record=0x7f6bc018ef50 "\377") at /data/src/10.2/storage/maria/ma_scan.c:54
            #11 0x00005626241e7b74 in ha_maria::rnd_next (this=0x7f6bc009edd8, buf=0x7f6bc018ef50 "\377") at /data/src/10.2/storage/maria/ha_maria.cc:2477
            #12 0x0000562623c4ce83 in handler::ha_rnd_next (this=0x7f6bc009edd8, buf=0x7f6bc018ef50 "\377") at /data/src/10.2/sql/handler.cc:2669
            #13 0x0000562623dc1147 in rr_sequential (info=0x7f6bb40141a0) at /data/src/10.2/sql/records.cc:492
            #14 0x0000562623a36b7b in join_init_read_record (tab=0x7f6bb40140d8) at /data/src/10.2/sql/sql_select.cc:19791
            #15 0x0000562623a348ba in sub_select (join=0x7f6bb4012600, join_tab=0x7f6bb40140d8, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18862
            #16 0x0000562623a33e7e in do_select (join=0x7f6bb4012600, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18409
            #17 0x0000562623a0da5f in JOIN::exec_inner (this=0x7f6bb4012600) at /data/src/10.2/sql/sql_select.cc:3642
            #18 0x0000562623a0cf06 in JOIN::exec (this=0x7f6bb4012600) at /data/src/10.2/sql/sql_select.cc:3437
            #19 0x0000562623a0e0e0 in mysql_select (thd=0x7f6bb4000d90, tables=0x7f6bb4011cf0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f6bb4012510, unit=0x7f6bb4004988, select_lex=0x7f6bb40050c8) at /data/src/10.2/sql/sql_select.cc:3840
            #20 0x0000562623a02242 in handle_select (thd=0x7f6bb4000d90, lex=0x7f6bb40048c8, result=0x7f6bb4012510, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
            #21 0x0000562623aa36a7 in Sql_cmd_create_table::execute (this=0x7f6bb4011560, thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_table.cc:10997
            #22 0x00005626239cb7bb in mysql_execute_command (thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_parse.cc:6020
            #23 0x00005626239d0620 in mysql_parse (thd=0x7f6bb4000d90, rawbuf=0x7f6bb4011480 "CREATE TABLE t2 SELECT f FROM t1", length=32, parser_state=0x7f6bd0fc4570, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7796
            #24 0x00005626239be84a in dispatch_command (command=COM_QUERY, thd=0x7f6bb4000d90, packet=0x7f6bb4060e81 "CREATE TABLE t2 SELECT f FROM t1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
            #25 0x00005626239bd345 in do_command (thd=0x7f6bb4000d90) at /data/src/10.2/sql/sql_parse.cc:1381
            #26 0x0000562623b1874c in do_handle_one_connection (connect=0x5626262dfb20) at /data/src/10.2/sql/sql_connect.cc:1336
            #27 0x0000562623b184b1 in handle_one_connection (arg=0x5626262dfb20) at /data/src/10.2/sql/sql_connect.cc:1241
            #28 0x00005626243433ae in pfs_spawn_thread (arg=0x562626321860) at /data/src/10.2/storage/perfschema/pfs.cc:1869
            #29 0x00007f6bd7512609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #30 0x00007f6bd70ee293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            {noformat}

            Reproducible on 10.2, 10.3.
            Not reproducible on 10.4, possibly due to patches for MDEV-17665/MDEV-23296 and/or related bugs in 10.4+.
            No obvious problem on a non-debug build.
            Labels need_bisect not-10.4 not-10.5 not-10.6
            Priority Major [ 3 ] Minor [ 4 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 90441 ] MariaDB v4 [ 140999 ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Michael Widenius [ monty ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.2 [ 14601 ]

            Closing as 10.3 is EOL.
            There is a comment about the failure being observed on higher versions, but without a test case.
            MDEV-31656 shows a somewhat similar assertion failure, but on a very different use case, ALTER instead of SELECT.

            elenst Elena Stepanova added a comment - Closing as 10.3 is EOL. There is a comment about the failure being observed on higher versions, but without a test case. MDEV-31656 shows a somewhat similar assertion failure, but on a very different use case, ALTER instead of SELECT.
            elenst Elena Stepanova made changes -
            Fix Version/s N/A [ 14700 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Won't Fix [ 2 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.