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

Assertion `ptr' failed in ut_align_down

Details

    Description

      Note: I've had this assertion failure during testing for MDEV-11369, and there was a non-deterministic test case. It was assumed to be fixed, and I indeed can't reproduce it anymore with the test case provided in MDEV-11369, but the failure happened on the recent 10.3 at least 3 times: once in travis, once on my machine while I was trying to reproduce, and once on perro while creating a shareable coredump.

      10.3 95811f01f34705e

      mysqld: /data/src/10.3/storage/innobase/include/ut0byte.ic:109: void* ut_align_down(const void*, ulint): Assertion `ptr' failed.
      180415  5:17:17 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f89c4beeee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000561014e8b12b in ut_align_down (ptr=0x0, align_no=16384) at /data/src/10.3/storage/innobase/include/ut0byte.ic:109
      #9  0x0000561014eb8b45 in page_align (ptr=0x0) at /data/src/10.3/storage/innobase/include/page0page.h:213
      #10 0x0000561014ec5d27 in page_rec_check (rec=0x0) at /data/src/10.3/storage/innobase/include/page0page.ic:537
      #11 0x0000561014ee2c0e in page_rec_is_supremum (rec=0x0) at /data/src/10.3/storage/innobase/include/page0page.ic:296
      #12 0x000056101511e741 in btr_search_build_page_hash_index (index=0x7f89500b2d28, block=0x7f899fb7e500, ahi_latch=0x561018a56380, n_fields=1, n_bytes=0, left_side=0) at /data/src/10.3/storage/innobase/btr/btr0sea.cc:1445
      #13 0x000056101511f387 in btr_search_move_or_delete_hash_entries (new_block=0x7f899fb7e500, block=0x7f899fbb3c00) at /data/src/10.3/storage/innobase/btr/btr0sea.cc:1641
      #14 0x0000561014f793b6 in page_copy_rec_list_start (new_block=0x7f899fb7e500, block=0x7f899fbb3c00, rec=0x7f89a24531e4 "\200", index=0x7f89500b2d28, mtr=0x7f89ad071b50) at /data/src/10.3/storage/innobase/page/page0page.cc:945
      #15 0x0000561014f7a64e in page_move_rec_list_start (new_block=0x7f899fb7e500, block=0x7f899fbb3c00, split_rec=0x7f89a24531e4 "\200", index=0x7f89500b2d28, mtr=0x7f89ad071b50) at /data/src/10.3/storage/innobase/page/page0page.cc:1403
      #16 0x00005610150dd960 in btr_page_split_and_insert (flags=0, cursor=0x7f89ad071730, offsets=0x7f89ad0716c8, heap=0x7f89ad0716c0, tuple=0x7f8934148f08, n_ext=0, mtr=0x7f89ad071b50) at /data/src/10.3/storage/innobase/btr/btr0btr.cc:3149
      #17 0x000056101510077a in btr_cur_pessimistic_insert (flags=0, cursor=0x7f89ad071730, offsets=0x7f89ad0716c8, heap=0x7f89ad0716c0, entry=0x7f8934148f08, rec=0x7f89ad0716d0, big_rec=0x7f89ad0716b8, n_ext=0, thr=0x7f89341768e0, mtr=0x7f89ad071b50) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:3480
      #18 0x0000561014fd0783 in row_ins_clust_index_entry_low (flags=0, mode=33, index=0x7f89500b2d28, n_uniq=1, entry=0x7f8934148f08, n_ext=0, thr=0x7f89341768e0, dup_chk_only=false) at /data/src/10.3/storage/innobase/row/row0ins.cc:2768
      #19 0x0000561014fd1f7e in row_ins_clust_index_entry (index=0x7f89500b2d28, entry=0x7f8934148f08, thr=0x7f89341768e0, n_ext=0, dup_chk_only=false) at /data/src/10.3/storage/innobase/row/row0ins.cc:3268
      #20 0x0000561015056207 in row_upd_clust_rec_by_insert (node=0x7f8934176218, index=0x7f89500b2d28, thr=0x7f89341768e0, referenced=0, foreign=false, mtr=0x7f89ad0726b0) at /data/src/10.3/storage/innobase/row/row0upd.cc:2789
      #21 0x00005610150576e0 in row_upd_clust_step (node=0x7f8934176218, thr=0x7f89341768e0) at /data/src/10.3/storage/innobase/row/row0upd.cc:3211
      #22 0x00005610150579ff in row_upd (node=0x7f8934176218, thr=0x7f89341768e0) at /data/src/10.3/storage/innobase/row/row0upd.cc:3282
      #23 0x0000561015057eee in row_upd_step (thr=0x7f89341768e0) at /data/src/10.3/storage/innobase/row/row0upd.cc:3426
      #24 0x0000561014ff45d6 in row_update_for_mysql (prebuilt=0x7f8934175698) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1882
      #25 0x0000561014e9f2e4 in ha_innobase::update_row (this=0x7f8934160188, old_row=0x7f893416edf0 "", new_row=0x7f893416d9a8 "") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8838
      #26 0x0000561014b8d1b9 in handler::ha_update_row (this=0x7f8934160188, old_data=0x7f893416edf0 "", new_data=0x7f893416d9a8 "") at /data/src/10.3/sql/handler.cc:6229
      #27 0x00005610152e8c28 in ha_partition::update_row (this=0x7f893415f0d8, old_data=0x7f893416edf0 "", new_data=0x7f893416d9a8 "") at /data/src/10.3/sql/ha_partition.cc:4364
      #28 0x0000561014b8d1b9 in handler::ha_update_row (this=0x7f893415f0d8, old_data=0x7f893416edf0 "", new_data=0x7f893416d9a8 "") at /data/src/10.3/sql/handler.cc:6229
      #29 0x000056101499472f in mysql_update (thd=0x7f8934000b00, table_list=0x7f8934013d10, fields=..., values=..., conds=0x7f8934014b60, order_num=0, order=0x0, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f89ad073720, updated_return=0x7f89ad0737e0) at /data/src/10.3/sql/sql_update.cc:943
      #30 0x000056101489fd38 in mysql_execute_command (thd=0x7f8934000b00) at /data/src/10.3/sql/sql_parse.cc:4578
      #31 0x00005610148aaad8 in mysql_parse (thd=0x7f8934000b00, rawbuf=0x7f8934013a28 "UPDATE `view_table100_innodb_key_pk_parts_2_int_autoinc` SET `pk` = REPEAT( _ASCII 0xA, 70 ) WHERE `col_varchar_255_utf8` < REPEAT( _UCS2 0x43, 121 )  /* QNO 2211 CON_ID 20 */", length=175, parser_state=0x7f89ad074620, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8001
      #32 0x00005610148982bb in dispatch_command (command=COM_QUERY, thd=0x7f8934000b00, packet=0x7f893400b261 "UPDATE `view_table100_innodb_key_pk_parts_2_int_autoinc` SET `pk` = REPEAT( _ASCII 0xA, 70 ) WHERE `col_varchar_255_utf8` < REPEAT( _UCS2 0x43, 121 )  /* QNO 2211 CON_ID 20 */ ", packet_length=176, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1846
      #33 0x0000561014896cfa in do_command (thd=0x7f8934000b00) at /data/src/10.3/sql/sql_parse.cc:1391
      #34 0x00005610149f978b in do_handle_one_connection (connect=0x561018df9110) at /data/src/10.3/sql/sql_connect.cc:1402
      #35 0x00005610149f9518 in handle_one_connection (arg=0x561018df9110) at /data/src/10.3/sql/sql_connect.cc:1308
      #36 0x00007f89c68c5494 in start_thread (arg=0x7f89ad075700) at pthread_create.c:333
      #37 0x00007f89c4cab93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      perl ./runall-trials.pl --trials=50 --duration=700 --threads=6 --seed=1523728641 --reporters=Backtrace,ErrorLog,Deadlock --validators=TransformerNoComparator --transformers=ConvertSubqueriesToViews,ConvertTablesToDerived,Count,DisableOptimizations,Distinct,EnableOptimizations,ExecuteAsCTE,ExecuteAsDeleteReturning,ExecuteAsDerived,ExecuteAsExcept,ExecuteAsExecuteImmediate,ExecuteAsInsertSelect,ExecuteAsIntersect,ExecuteAsSelectItem,ExecuteAsUnion,ExecuteAsUpdateDelete,ExecuteAsView,ExecuteAsWhereSubquery,Having,InlineSubqueries,LimitRowsExamined,OrderBy,StraightJoin,ExecuteAsPreparedTwice,ExecuteAsTrigger,ExecuteAsSPTwice,ExecuteAsFunctionTwice --redefine=conf/mariadb/general-workarounds.yy --mysqld=--log_output=FILE --mysqld=--log_bin_trust_function_creators=1 --mysqld=--log-bin --mysqld=--max-statement-time=30 --mysqld=--loose-debug_assert_on_not_freed_memory=0 --views --redefine=conf/mariadb/versioning.yy --basedir=/data/bld/10.3 --grammar=conf/engines/many_indexes.yy --gendata=conf/engines/many_indexes.zz --engine=InnoDB --vardir=/data/logs/travis1
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova added a comment - - edited

            marko, could you please check if the coredump is enough for finding the reason of the problem and fixing it? The failure is not easily reproducible so far.

            If it can't be done by the coredump alone, please reassign it back to me.

            elenst Elena Stepanova added a comment - - edited marko , could you please check if the coredump is enough for finding the reason of the problem and fixing it? The failure is not easily reproducible so far. If it can't be done by the coredump alone, please reassign it back to me.

            Quick look at the core dump:

            (gdb) frame 12
            #12 0x000055879e619161 in btr_search_build_page_hash_index (
                index=0x7f06d0078478, block=0x7f07311a5800, ahi_latch=0x5587a1d6aec0, 
                n_fields=1, n_bytes=0, left_side=0)
                at /home/elenst/git/10.3/storage/innobase/btr/btr0sea.cc:1445
            1445			if (page_rec_is_supremum(next_rec)) {
            (gdb) p block->page->id
            $1 = {m_space = 9, m_page_no = 21, m_fold = 9437214}
            (gdb) dump binary memory page9-21.bin block->frame block->frame+srv_page_size
            (gdb) ^Z
            [1]+  Stopped                 gdb mysqld core
            mariadb@perro:~/for_marko/mdev15871$ od -t x1 -Ax page9-21.bin 
            000000 00 00 00 00 00 00 00 15 ff ff ff ff 00 00 00 16
            000010 00 00 00 00 00 00 00 00 45 bf 00 00 00 00 00 00
            000020 00 00 00 00 00 09 00 02 00 92 80 03 00 00 00 00
            000030 00 81 00 05 00 00 00 01 00 00 00 00 00 00 00 00
            000040 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00
            000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00
            000060 02 00 1e 69 6e 66 69 6d 75 6d 00 02 00 0b 00 00
            000070 73 75 70 72 65 6d 75 6d 1f ff ff 00 10 00 14 ff
            000080 ef 80 00 00 00 00 00 00 00 00 00 80 00 00 00 00
            000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            *
            003ff0 00 00 00 00 00 70 00 63 00 00 00 00 00 00 00 00
            004000
            

            There is only one user record in the table, at offset 0x81, apparently with the value pk=0, and the DB_TRX_ID has been reset (MDEV-12288).
            Actually, it is an empty leftmost leaf page, containing only the 'default row' record (introduced in MDEV-11369). I would suggest the following fix:

            diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
            index 53272c80834..a2aeea28e60 100644
            --- a/storage/innobase/btr/btr0sea.cc
            +++ b/storage/innobase/btr/btr0sea.cc
            @@ -1406,6 +1406,13 @@ btr_search_build_page_hash_index(
             		return;
             	}
             
            +	rec = page_rec_get_next_const(page_get_infimum_rec(page));
            +
            +	if (rec_is_default_row(rec, index)) {
            +		rec = page_rec_get_next_const(rec);
            +		if (!--n_recs) return;
            +	}
            +
             	/* Calculate and cache fold values and corresponding records into
             	an array for fast insertion to the hash index */
             
            @@ -1417,12 +1424,6 @@ btr_search_build_page_hash_index(
             
             	ut_a(index->id == btr_page_get_index_id(page));
             
            -	rec = page_rec_get_next_const(page_get_infimum_rec(page));
            -
            -	if (rec_is_default_row(rec, index)) {
            -		rec = page_rec_get_next_const(rec);
            -	}
            -
             	offsets = rec_get_offsets(
             		rec, index, offsets, true,
             		btr_search_get_n_fields(n_fields, n_bytes),
            

            I just pushed this to bb-10.3-marko; please test again.

            marko Marko Mäkelä added a comment - Quick look at the core dump: (gdb) frame 12 #12 0x000055879e619161 in btr_search_build_page_hash_index ( index=0x7f06d0078478, block=0x7f07311a5800, ahi_latch=0x5587a1d6aec0, n_fields=1, n_bytes=0, left_side=0) at /home/elenst/git/10.3/storage/innobase/btr/btr0sea.cc:1445 1445 if (page_rec_is_supremum(next_rec)) { (gdb) p block->page->id $1 = {m_space = 9, m_page_no = 21, m_fold = 9437214} (gdb) dump binary memory page9-21.bin block->frame block->frame+srv_page_size (gdb) ^Z [1]+ Stopped gdb mysqld core mariadb@perro:~/for_marko/mdev15871$ od -t x1 -Ax page9-21.bin 000000 00 00 00 00 00 00 00 15 ff ff ff ff 00 00 00 16 000010 00 00 00 00 00 00 00 00 45 bf 00 00 00 00 00 00 000020 00 00 00 00 00 09 00 02 00 92 80 03 00 00 00 00 000030 00 81 00 05 00 00 00 01 00 00 00 00 00 00 00 00 000040 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 000060 02 00 1e 69 6e 66 69 6d 75 6d 00 02 00 0b 00 00 000070 73 75 70 72 65 6d 75 6d 1f ff ff 00 10 00 14 ff 000080 ef 80 00 00 00 00 00 00 00 00 00 80 00 00 00 00 000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 003ff0 00 00 00 00 00 70 00 63 00 00 00 00 00 00 00 00 004000 There is only one user record in the table, at offset 0x81, apparently with the value pk=0 , and the DB_TRX_ID has been reset ( MDEV-12288 ). Actually, it is an empty leftmost leaf page, containing only the 'default row' record (introduced in MDEV-11369 ). I would suggest the following fix: diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 53272c80834..a2aeea28e60 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1406,6 +1406,13 @@ btr_search_build_page_hash_index( return; } + rec = page_rec_get_next_const(page_get_infimum_rec(page)); + + if (rec_is_default_row(rec, index)) { + rec = page_rec_get_next_const(rec); + if (!--n_recs) return; + } + /* Calculate and cache fold values and corresponding records into an array for fast insertion to the hash index */ @@ -1417,12 +1424,6 @@ btr_search_build_page_hash_index( ut_a(index->id == btr_page_get_index_id(page)); - rec = page_rec_get_next_const(page_get_infimum_rec(page)); - - if (rec_is_default_row(rec, index)) { - rec = page_rec_get_next_const(rec); - } - offsets = rec_get_offsets( rec, index, offsets, true, btr_search_get_n_fields(n_fields, n_bytes), I just pushed this to bb-10.3-marko; please test again.

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.