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

ALTER TABLE…ALGORITHM=INPLACE fails with non-constant DEFAULT values

    XMLWordPrintable

Details

    Description

      Apparently InnoDB doesn't copy blob data during online ALTER TABLE. In a meanwhile it calls innobase_rec_reset(), which may reallocate memory for blobs.

      It wasn't a problem before column compression was introduced, since in most (if not all) cases memory reallocation was not needed. With compressed columns reallocation is always there.

      Grep for MDEV-12586 in source code for relevant markers. Re-enable online ALTER TABLE and run main.column_compression test.

      Test not involving column compression:

      CREATE TABLE t1(a INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES(1),(2),(3);
      ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT REPEAT("a", 5*a);
      SELECT * FROM t1;
      a	b
      1	NULL
      2	NULL
      3	NULL
      DROP TABLE t1;
      CREATE TABLE t1(a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES(1),(2),(3);
      ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT REPEAT("a", 5*a);
      SELECT * FROM t1;
      a	b
      1	aaaaa
      2	aaaaaaaaaa
      3	aaaaaaaaaaaaaaa
      DROP TABLE t1;
      

      Attachments

        Issue Links

          Activity

            People

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