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

10.4.13 crashes when creating CHECK constraint

Details

    Description

      The following sample SQL code crashes MariaDB using offical docker image mariadb:10.4.13, it worked fine with mariadb:10.4.12.

      SET SESSION sql_mode = 'STRICT_ALL_TABLES,ANSI_QUOTES';
       
      CREATE TABLE test1 (
          id BIGINT(10) NOT NULL auto_increment,
          col1 TINYINT(1) NOT NULL,
          col2 TINYINT(1) NOT NULL,
          col3 TINYINT(1) NOT NULL,
          CONSTRAINT PRIMARY KEY (id)
      );
       
      ALTER TABLE test1 ADD CONSTRAINT "test1_col3_constraint" CHECK (col3 IN (0,1));
      ALTER TABLE test1 ADD CONSTRAINT `test1_col2_constraint` CHECK (col2 IN (0,1));
      ALTER TABLE test1 ADD CONSTRAINT test1_col1_constraint CHECK (col1 IN (0,1));
      

      The same problem pops up with mariadb:10.5.3 sometimes too, but it does not seem to be fully reproducible. I am using OSX docker, but my colleagues managed to reproduce it in Linux too.

      mariadb:10.3.23 is working fine.

      Attachments

        Issue Links

          Activity

            Thanks for checking.

            Closing as fixed by the patch for MDEV-22563.

            elenst Elena Stepanova added a comment - Thanks for checking. Closing as fixed by the patch for MDEV-22563 .
            davedv Dave dV added a comment - - edited

            Sorry for piggybacking on this issue, but it seems related, so I was hoping someone could check whether it's been fixed with this or I need to log a new issue:

            I am getting crashes on 10.4.13+maria~stretch whenever trying to alter columns of a table that contains a CHECK constraint. The alter command seems to go through, and the modification is there when the DB is back up:

            CREATE TABLE `test` (
              `foo` tinyint(1) DEFAULT 0,
              CONSTRAINT `CONSTRAINT_1` CHECK (`foo` in (0,1))
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
             
            SET check_constraint_checks=0; # does not affect either way…
             
            ALTER TABLE `test` ADD COLUMN `bar` FLOAT;
             
            # → crashes (but column `bar` is created)
             
            ALTER TABLE `test` DROP CONSTRAINT `CONSTRAINT_1`;
            ALTER TABLE `test` ADD COLUMN `baz` FLOAT;
             
            # → no crash
            

            Using Docker versions, I confirmed I get a crash (of the whole container, actually) with 10.4.13, but 10.5 seems OK.

            davedv Dave dV added a comment - - edited Sorry for piggybacking on this issue, but it seems related, so I was hoping someone could check whether it's been fixed with this or I need to log a new issue: I am getting crashes on 10.4.13+maria~stretch whenever trying to alter columns of a table that contains a CHECK constraint. The alter command seems to go through, and the modification is there when the DB is back up: CREATE TABLE `test` ( `foo` tinyint(1) DEFAULT 0, CONSTRAINT `CONSTRAINT_1` CHECK (`foo` in (0,1)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;   SET check_constraint_checks=0; # does not affect either way…   ALTER TABLE `test` ADD COLUMN `bar` FLOAT;   # → crashes (but column `bar` is created)   ALTER TABLE `test` DROP CONSTRAINT `CONSTRAINT_1`; ALTER TABLE `test` ADD COLUMN `baz` FLOAT;   # → no crash Using Docker versions, I confirmed I get a crash (of the whole container, actually) with 10.4.13, but 10.5 seems OK.
            skodak Petr Skoda added a comment -

            Hi Dave, the statements from your comment executed fine for me with the patch present.

            skodak Petr Skoda added a comment - Hi Dave, the statements from your comment executed fine for me with the patch present.
            davedv Dave dV added a comment -

            Petr, thanks for checking!
            Good news then. I'll hold off on posting an issue until I can double-check on the next version (bit short on time right now to install from git).

            Any chance you could confirm that you do get the crash with the same version pre-patch (just so I can rule out some exotic platform-related issue).

            davedv Dave dV added a comment - Petr, thanks for checking! Good news then. I'll hold off on posting an issue until I can double-check on the next version (bit short on time right now to install from git). Any chance you could confirm that you do get the crash with the same version pre-patch (just so I can rule out some exotic platform-related issue).
            skodak Petr Skoda added a comment -

            yes, crashing without the patch:

            totaradb> CREATE TABLE `test` (
                                              `foo` tinyint(1) DEFAULT 0,
                                              CONSTRAINT `CONSTRAINT_1` CHECK (`foo` in (0,1))
                      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
            [2020-05-27 08:59:22] completed in 13 ms
            totaradb> SET check_constraint_checks=0
            [2020-05-27 08:59:22] completed in 2 ms
            totaradb> ALTER TABLE `test` ADD COLUMN `bar` FLOAT
            [2020-05-27 08:59:22] [08000] (conn=9) unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
            [2020-05-27 08:59:22] java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
            

            skodak Petr Skoda added a comment - yes, crashing without the patch: totaradb> CREATE TABLE `test` ( `foo` tinyint(1) DEFAULT 0, CONSTRAINT `CONSTRAINT_1` CHECK (`foo` in (0,1)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 [2020-05-27 08:59:22] completed in 13 ms totaradb> SET check_constraint_checks=0 [2020-05-27 08:59:22] completed in 2 ms totaradb> ALTER TABLE `test` ADD COLUMN `bar` FLOAT [2020-05-27 08:59:22] [08000] (conn=9) unexpected end of stream, read 0 bytes from 4 (socket was closed by server) [2020-05-27 08:59:22] java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server)

            People

              Unassigned Unassigned
              skodak Petr Skoda
              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.