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

IMPORT TABLESPACE fails with instant-altered tables

    XMLWordPrintable

Details

    Description

      Reproduce 1 (instant add)

      --source include/have_innodb.inc
      set default_storage_engine=innodb;
       
      create or replace table t2 (x int, z int);
      alter table t2 discard tablespace;
       
      create or replace table t1 (x int);
      insert into t1 values (1);
      alter table t1 add z int, algorithm instant;
      select * from t1;
      flush tables t1 for export;
      --let $MYSQLD_DATADIR= `select @@datadir`
      --move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
      --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
      unlock tables;
       
      alter table t2 import tablespace;
       
      select * from t2;
      check table t2 extended;
       
      create or replace database test;
      

      Result 1

      mysqld: /home/midenok/src/mariadb/trunk2/src/storage/innobase/include/dict0mem.h:673: const byte *dict_col_t::instant_value(ulint *) const: Assertion `is_added()' failed.
       
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00007ffff6d04535 in __GI_abort () at abort.c:79
      #2  0x00007ffff6d0440f in __assert_fail_base (fmt=0x7ffff6e90858 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x169a46e "is_added()", file=0x1688af8 "/home/midenok/src/mariadb/trunk2/src/storage/innobase/include/dict0mem.h", line=673, function=<optimized out>) at assert.c:92
      #3  0x00007ffff6d14142 in __GI___assert_fail (assertion=0x169a46e "is_added()", file=0x1688af8 "/home/midenok/src/mariadb/trunk2/src/storage/innobase/include/dict0mem.h", line=673, function=0x16958c5 "const byte *dict_col_t::instant_value(ulint *) const") at assert.c:101
      #4  0x0000000000e1e728 in dict_col_t::instant_value (this=0x7fff9c0269c8, len=0x7ffff006ebe8) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/include/dict0mem.h:673
      #5  0x0000000000e1e220 in dict_index_t::instant_field_value (this=0x7fff9c029d38, n=4, len=0x7ffff006ebe8) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/include/dict0mem.h:1172
      #6  0x0000000000fc55b3 in row_sel_store_mysql_field_func (mysql_rec=0x7fff9c025908 "\375\001", prebuilt=0x7fff9c02d048, rec=0x7ffff0638087 "", index=0x7fff9c029d38, offsets=0x7ffff006fb40, field_no=4, templ=0x7fff9c08abd0) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/row/row0sel.cc:2982
      #7  0x0000000000fbc227 in row_sel_store_mysql_rec (mysql_rec=0x7fff9c025908 "\375\001", prebuilt=0x7fff9c02d048, rec=0x7ffff0638087 "", vrow=0x0, rec_clust=false, index=0x7fff9c029d38, offsets=0x7ffff006fb40) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/row/row0sel.cc:3160
      #8  0x0000000000fba13a in row_search_mvcc (buf=0x7fff9c025908 "\375\001", mode=PAGE_CUR_G, prebuilt=0x7fff9c02d048, match_mode=0, direction=0) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/row/row0sel.cc:5440
      #9  0x0000000000dba82e in ha_innobase::index_read (this=0x7fff9c02a730, buf=0x7fff9c025908 "\375\001", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at /home/midenok/src/mariadb/trunk2/src/storage/innobase/handler/ha_innodb.cc:9257
      #10 0x0000000000dbb3cb in ha_innobase::index_first (this=0x7fff9c02a730, buf=0x7fff9c025908 "\375\001") at /home/midenok/src/mariadb/trunk2/src/storage/innobase/handler/ha_innodb.cc:9634
      #11 0x0000000000dbb664 in ha_innobase::rnd_next (this=0x7fff9c02a730, buf=0x7fff9c025908 "\375\001") at /home/midenok/src/mariadb/trunk2/src/storage/innobase/handler/ha_innodb.cc:9727
      #12 0x0000000000b39447 in handler::ha_rnd_next (this=0x7fff9c02a730, buf=0x7fff9c025908 "\375\001") at /home/midenok/src/mariadb/trunk2/src/sql/handler.cc:2800
      #13 0x0000000000d10344 in rr_sequential (info=0x7fff9c018b20) at /home/midenok/src/mariadb/trunk2/src/sql/records.cc:481
      #14 0x0000000000710beb in READ_RECORD::read_record (this=0x7fff9c018b20) at /home/midenok/src/mariadb/trunk2/src/sql/records.h:73
      #15 0x000000000084046c in join_init_read_record (tab=0x7fff9c018a58) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:20326
      #16 0x000000000085ba9a in sub_select (join=0x7fff9c017630, join_tab=0x7fff9c018a58, end_of_records=false) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:19387
      #17 0x00000000008442a9 in do_select (join=0x7fff9c017630, procedure=0x0) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:18930
      #18 0x000000000084303e in JOIN::exec_inner (this=0x7fff9c017630) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:4094
      #19 0x000000000084210e in JOIN::exec (this=0x7fff9c017630) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:3888
      #20 0x0000000000819671 in mysql_select (thd=0x7fff9c000cf8, tables=0x7fff9c0166f0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff9c017608, unit=0x7fff9c004bd0, select_lex=0x7fff9c016168) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:4293
      #21 0x0000000000818eb1 in handle_select (thd=0x7fff9c000cf8, lex=0x7fff9c004b08, result=0x7fff9c017608, setup_tables_done_option=0) at /home/midenok/src/mariadb/trunk2/src/sql/sql_select.cc:373
      #22 0x00000000007dadba in execute_sqlcom_select (thd=0x7fff9c000cf8, all_tables=0x7fff9c0166f0) at /home/midenok/src/mariadb/trunk2/src/sql/sql_parse.cc:6579
      #23 0x00000000007cfe75 in mysql_execute_command (thd=0x7fff9c000cf8) at /home/midenok/src/mariadb/trunk2/src/sql/sql_parse.cc:3777
      #24 0x00000000007ca940 in mysql_parse (thd=0x7fff9c000cf8, rawbuf=0x7fff9c0160e0 "select * from t2", length=16, parser_state=0x7ffff00745e0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk2/src/sql/sql_parse.cc:8116
      

      Reproduce 2 (instant drop)

      --source include/have_innodb.inc
      set default_storage_engine=innodb;
       
      create or replace table t2 (x int);
      alter table t2 discard tablespace;
       
      create or replace table t1 (x int, y int);
      insert into t1 values (1);
      alter table t1 drop y int, algorithm instant;
      select * from t1;
      flush tables t1 for export;
      --let $MYSQLD_DATADIR= `select @@datadir`
      --move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg
      --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
      unlock tables;
       
      alter table t2 import tablespace;
       
      select * from t2;
      check table t2 extended;
       
      create or replace database test;
      

      Result 2

      mysqltest: At line 8: query 'insert into t1 values (1)' failed: 1136: Column count doesn't match value count at row 1
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              midenok Aleksey Midenkov
              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.