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

A table with variable-length PRIMARY KEY is unaccessible after instant DROP COLUMN

    XMLWordPrintable

Details

    Description

      As noted by midenok, there was a typo in the code introduced by MDEV-15562:

      diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
      index 9e951f8f78b..5fe71a5eb4d 100644
      --- a/storage/innobase/btr/btr0cur.cc
      +++ b/storage/innobase/btr/btr0cur.cc
      @@ -486,7 +486,7 @@ static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr)
       			always written with zero length. The DB_TRX_ID will
       			start right after any fixed-length columns. */
       			for (uint i = index->n_uniq; i--; ) {
      -				trx_id_offset += index->fields[0].fixed_len;
      +				trx_id_offset += index->fields[i].fixed_len;
       			}
       		}
       
      

      Before the above fix, the following test case change would fail to find the table t4 after the first server restart:

      diff --git a/mysql-test/suite/innodb/t/instant_drop.test b/mysql-test/suite/innodb/t/instant_drop.test
      index cb1aabce94b..566ac02b314 100644
      --- a/mysql-test/suite/innodb/t/instant_drop.test
      +++ b/mysql-test/suite/innodb/t/instant_drop.test
      @@ -80,6 +80,10 @@ create table t3(f1 int, f2 int not null)engine=innodb;
       insert into t3 values(1, 2);
       alter table t3 drop column f2, add column f3 int default 1, add column f4 int default 4, algorithm=instant;
       
      +create table t4(a varchar(1), b int, c int, primary key(a,b))engine=innodb;
      +insert into t4 values('4',5,6);
      +alter table t4 drop column c;
      +
       --source include/restart_mysqld.inc
       select * from t1;
       alter table t1 add column f6 int default 9,drop column f5, algorithm = instant;
      @@ -94,6 +98,11 @@ show create table t2;
       
       select * from t3;
       alter table t3 add column f5 char(100) default repeat('a', 99), algorithm=instant;
      +
      +select * from t4;
      +alter table t4 add column d varchar(5) default 'fubar';
      +insert into t4 values('',0,'snafu');
       --source include/restart_mysqld.inc
       select * from t3;
      -drop table t1,t2,t3;
      +select * from t4;
      +drop table t1,t2,t3,t4;
      

      Attachments

        Issue Links

          Activity

            People

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