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

Inplace update assert after instant adding column

Details

    • 10.3.3-1

    Description

      In MariaDB 10.3.2, instant adding columns for innodb is supported.
      After instant adding columns, the inplace update trigger assertion in some cases.

      How to repeat:
      create table t1 (c1 int primary key, c2 int);
      insert into t1 values(1,1);
      alter table t1 add column d1 varchar(20) not null default 'aaa';
      update t1 set d1 = '' where c1 = 1; – assert in rec_set_nth_field()

      The length of "d1" stored in the record is 0, because of instant adding columns. After update, the length is 0 also. But it can't do inplace update here.

      So, it need to do some special check for rec_offs_nth_default() in row_upd_changes_field_size_or_external();

      The patch can be work for it.

      Attachments

        Issue Links

          Activity

            vinchen vinchen created issue -
            vinchen vinchen made changes -
            Field Original Value New Value
            Attachment inplace_update_fix.patch [ 44366 ]
            vinchen vinchen made changes -
            Description In MariaDB 10.3.2, instant adding columns for innodb is supported.
            After instant adding columns, the inplace update trigger assertion in some cases.

            How to repeat:
            create table t1 (c1 int primary key, c2 int);
            insert into t1 values(1,1);
            alter table t1 add column d1 varchar(20) not null default 'aaa';
                    update t1 set d1 = '' where c1 = 1; {color:red}-- assert in rec_set_nth_field(){color}

            The length of "d1" stored in the record is 0, because of instant adding columns. After update, the length is 0 also. But it can do inplace update here.

            So, it need to do some special check for rec_offs_nth_default() in row_upd_changes_field_size_or_external();

            The patch can be work for it.
            In MariaDB 10.3.2, instant adding columns for innodb is supported.
            After instant adding columns, the inplace update trigger assertion in some cases.

            How to repeat:
            create table t1 (c1 int primary key, c2 int);
            insert into t1 values(1,1);
            alter table t1 add column d1 varchar(20) not null default 'aaa';
                    update t1 set d1 = '' where c1 = 1; {color:red}-- assert in rec_set_nth_field(){color}

            The length of "d1" stored in the record is 0, because of instant adding columns. After update, the length is 0 also. But it can't do inplace update here.

            So, it need to do some special check for rec_offs_nth_default() in row_upd_changes_field_size_or_external();

            The patch can be work for it.
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Affects Version/s 10.3.2 [ 22533 ]
            Affects Version/s 10.3 [ 22126 ]
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            marko Marko Mäkelä made changes -
            Fix Version/s 10.3 [ 22126 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ]

            To make it searchable better in JIRA:

            10.3 3722372ae56

            mysqld: /data/src/10.3/storage/innobase/include/rem0rec.ic:1227: void rec_set_nth_field(rec_t*, const ulint*, ulint, const void*, ulint): Assertion `!rec_offs_nth_default(offsets, n)' failed.
            171024 10:27:50 [ERROR] mysqld got signal 6 ;
             
            #7  0x00007f8e47a18ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
            #8  0x000055c05358fd1d in rec_set_nth_field (rec=0x7f8e4160407e "\200", offsets=0x7f8e385f0470, n=4, data=0x7f8dec033682, len=0) at /data/src/10.3/storage/innobase/include/rem0rec.ic:1227
            #9  0x000055c05359251a in row_upd_rec_in_place (rec=0x7f8e4160407e "\200", index=0x7f8dec1533b8, offsets=0x7f8e385f0470, update=0x7f8dec150a10, page_zip=0x0) at /data/src/10.3/storage/innobase/row/row0upd.cc:737
            #10 0x000055c05364c334 in btr_cur_update_in_place (flags=2, cursor=0x7f8dec153990, offsets=0x7f8e385f0470, update=0x7f8dec150a10, cmpl_info=1, thr=0x7f8dec150c30, trx_id=1290, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:3939
            #11 0x000055c05364cd9e in btr_cur_optimistic_update (flags=2, cursor=0x7f8dec153990, offsets=0x7f8e385f0370, heap=0x7f8e385f0418, update=0x7f8dec150a10, cmpl_info=1, thr=0x7f8dec150c30, trx_id=1290, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:4117
            #12 0x000055c053597ac4 in row_upd_clust_rec (flags=0, node=0x7f8dec1508d0, index=0x7f8dec1533b8, offsets=0x7f8e385f0470, offsets_heap=0x7f8e385f0418, thr=0x7f8dec150c30, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/row/row0upd.cc:2847
            #13 0x000055c053598b75 in row_upd_clust_step (node=0x7f8dec1508d0, thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3185
            #14 0x000055c053598f84 in row_upd (node=0x7f8dec1508d0, thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3278
            #15 0x000055c05359947b in row_upd_step (thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3422
            #16 0x000055c05353383a in row_update_for_mysql (prebuilt=0x7f8dec1500b8) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1949
            #17 0x000055c0533d9ba8 in ha_innobase::update_row (this=0x7f8dec14f8c8, old_row=0x7f8dec033698 "\376\001", new_row=0x7f8dec033678 "\376\001") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9130
            #18 0x000055c0530ba748 in handler::ha_update_row (this=0x7f8dec14f8c8, old_data=0x7f8dec033698 "\376\001", new_data=0x7f8dec033678 "\376\001") at /data/src/10.3/sql/handler.cc:6054
            #19 0x000055c052edba13 in mysql_update (thd=0x7f8dec000b00, table_list=0x7f8dec014af0, fields=..., values=..., conds=0x7f8dec015480, order_num=0, order=0x0, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f8e385f1760, updated_return=0x7f8e385f1810) at /data/src/10.3/sql/sql_update.cc:812
            #20 0x000055c052dedb46 in mysql_execute_command (thd=0x7f8dec000b00) at /data/src/10.3/sql/sql_parse.cc:4538
            #21 0x000055c052df8a1c in mysql_parse (thd=0x7f8dec000b00, rawbuf=0x7f8dec0149f8 "update t1 set d1 = '' where c1 = 1", length=34, parser_state=0x7f8e385f2610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921
            #22 0x000055c052de61bd in dispatch_command (command=COM_QUERY, thd=0x7f8dec000b00, packet=0x7f8dec08fbd1 "update t1 set d1 = '' where c1 = 1", packet_length=34, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819
            #23 0x000055c052de4c1b in do_command (thd=0x7f8dec000b00) at /data/src/10.3/sql/sql_parse.cc:1370
            #24 0x000055c052f3b9f4 in do_handle_one_connection (connect=0x55c055a14310) at /data/src/10.3/sql/sql_connect.cc:1418
            #25 0x000055c052f3b781 in handle_one_connection (arg=0x55c055a14310) at /data/src/10.3/sql/sql_connect.cc:1324
            #26 0x000055c0533b5f4c in pfs_spawn_thread (arg=0x55c055a30f00) at /data/src/10.3/storage/perfschema/pfs.cc:1862
            #27 0x00007f8e4995d494 in start_thread (arg=0x7f8e385f3700) at pthread_create.c:333
            #28 0x00007f8e47ad593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
            

            elenst Elena Stepanova added a comment - To make it searchable better in JIRA: 10.3 3722372ae56 mysqld: /data/src/10.3/storage/innobase/include/rem0rec.ic:1227: void rec_set_nth_field(rec_t*, const ulint*, ulint, const void*, ulint): Assertion `!rec_offs_nth_default(offsets, n)' failed. 171024 10:27:50 [ERROR] mysqld got signal 6 ;   #7 0x00007f8e47a18ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 #8 0x000055c05358fd1d in rec_set_nth_field (rec=0x7f8e4160407e "\200", offsets=0x7f8e385f0470, n=4, data=0x7f8dec033682, len=0) at /data/src/10.3/storage/innobase/include/rem0rec.ic:1227 #9 0x000055c05359251a in row_upd_rec_in_place (rec=0x7f8e4160407e "\200", index=0x7f8dec1533b8, offsets=0x7f8e385f0470, update=0x7f8dec150a10, page_zip=0x0) at /data/src/10.3/storage/innobase/row/row0upd.cc:737 #10 0x000055c05364c334 in btr_cur_update_in_place (flags=2, cursor=0x7f8dec153990, offsets=0x7f8e385f0470, update=0x7f8dec150a10, cmpl_info=1, thr=0x7f8dec150c30, trx_id=1290, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:3939 #11 0x000055c05364cd9e in btr_cur_optimistic_update (flags=2, cursor=0x7f8dec153990, offsets=0x7f8e385f0370, heap=0x7f8e385f0418, update=0x7f8dec150a10, cmpl_info=1, thr=0x7f8dec150c30, trx_id=1290, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:4117 #12 0x000055c053597ac4 in row_upd_clust_rec (flags=0, node=0x7f8dec1508d0, index=0x7f8dec1533b8, offsets=0x7f8e385f0470, offsets_heap=0x7f8e385f0418, thr=0x7f8dec150c30, mtr=0x7f8e385f0790) at /data/src/10.3/storage/innobase/row/row0upd.cc:2847 #13 0x000055c053598b75 in row_upd_clust_step (node=0x7f8dec1508d0, thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3185 #14 0x000055c053598f84 in row_upd (node=0x7f8dec1508d0, thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3278 #15 0x000055c05359947b in row_upd_step (thr=0x7f8dec150c30) at /data/src/10.3/storage/innobase/row/row0upd.cc:3422 #16 0x000055c05353383a in row_update_for_mysql (prebuilt=0x7f8dec1500b8) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1949 #17 0x000055c0533d9ba8 in ha_innobase::update_row (this=0x7f8dec14f8c8, old_row=0x7f8dec033698 "\376\001", new_row=0x7f8dec033678 "\376\001") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9130 #18 0x000055c0530ba748 in handler::ha_update_row (this=0x7f8dec14f8c8, old_data=0x7f8dec033698 "\376\001", new_data=0x7f8dec033678 "\376\001") at /data/src/10.3/sql/handler.cc:6054 #19 0x000055c052edba13 in mysql_update (thd=0x7f8dec000b00, table_list=0x7f8dec014af0, fields=..., values=..., conds=0x7f8dec015480, order_num=0, order=0x0, limit=18446744073709551615, handle_duplicates=DUP_ERROR, ignore=false, found_return=0x7f8e385f1760, updated_return=0x7f8e385f1810) at /data/src/10.3/sql/sql_update.cc:812 #20 0x000055c052dedb46 in mysql_execute_command (thd=0x7f8dec000b00) at /data/src/10.3/sql/sql_parse.cc:4538 #21 0x000055c052df8a1c in mysql_parse (thd=0x7f8dec000b00, rawbuf=0x7f8dec0149f8 "update t1 set d1 = '' where c1 = 1", length=34, parser_state=0x7f8e385f2610, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7921 #22 0x000055c052de61bd in dispatch_command (command=COM_QUERY, thd=0x7f8dec000b00, packet=0x7f8dec08fbd1 "update t1 set d1 = '' where c1 = 1", packet_length=34, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1819 #23 0x000055c052de4c1b in do_command (thd=0x7f8dec000b00) at /data/src/10.3/sql/sql_parse.cc:1370 #24 0x000055c052f3b9f4 in do_handle_one_connection (connect=0x55c055a14310) at /data/src/10.3/sql/sql_connect.cc:1418 #25 0x000055c052f3b781 in handle_one_connection (arg=0x55c055a14310) at /data/src/10.3/sql/sql_connect.cc:1324 #26 0x000055c0533b5f4c in pfs_spawn_thread (arg=0x55c055a30f00) at /data/src/10.3/storage/perfschema/pfs.cc:1862 #27 0x00007f8e4995d494 in start_thread (arg=0x7f8e385f3700) at pthread_create.c:333 #28 0x00007f8e47ad593f in clone () from /lib/x86_64-linux-gnu/libc.so.6
            serg Sergei Golubchik made changes -
            Sprint 10.3.3-1 [ 200 ]
            marko Marko Mäkelä made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]

            Thank you for the test case and suggested patch.
            I chose a slightly different fix, because I believe that the contributed one would not work with ROW_FORMAT=REDUNDANT. I extended the test innodb.instant_alter with this scenario.

            marko Marko Mäkelä added a comment - Thank you for the test case and suggested patch. I chose a slightly different fix, because I believe that the contributed one would not work with ROW_FORMAT=REDUNDANT. I extended the test innodb.instant_alter with this scenario.
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2017-10-26 10:10:31.0 2017-10-26 10:10:31.126
            marko Marko Mäkelä made changes -
            Fix Version/s 10.3.3 [ 22644 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 83116 ] MariaDB v4 [ 153015 ]

            People

              marko Marko Mäkelä
              vinchen vinchen
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.