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

Wrong constraint (TINYINT or MEDIUMINT and INT) causes server crash

    Details

      Description

      When I'm trying to create such tables server is killed. Logs in attachment
      Checked on two computers.

      CREATE TABLE orders_products
      (
      id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
      orders_id INT UNSIGNED NOT NULL,
      products_id TINYINT NOT NULL,
      quantity SMALLINT UNSIGNED DEFAULT 0,
      base_price DECIMAL(8,2) DEFAULT 0.00 NOT NULL,
      amount DECIMAL(8,2) DEFAULT 0.00 NOT NULL,
      FOREIGN KEY (orders_id) REFERENCES orders (id) ON DELETE RESTRICT ON UPDATE CASCADE,
      FOREIGN KEY (products_id) REFERENCES products (id) ON DELETE RESTRICT ON UPDATE CASCADE
      );

      CREATE TABLE dashboard
      (
      id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
      created DATETIME NOT NULL,
      createdby MEDIUMINT UNSIGNED NOT NULL,
      modified DATETIME NOT NULL,
      modifiedby MEDIUMINT UNSIGNED NOT NULL,
      profiles_id INT UNSIGNED,
      profiles_bookings_id INT UNSIGNED,
      status TINYINT DEFAULT 0,
      FOREIGN KEY (createdby) REFERENCES users (id) ON UPDATE CASCADE,
      FOREIGN KEY (modifiedby) REFERENCES users (id) ON UPDATE CASCADE,
      FOREIGN KEY (profiles_id) REFERENCES profiles (id) ON UPDATE CASCADE,
      FOREIGN KEY (profiles_bookings_id) REFERENCES profiles_bookings (id) ON UPDATE CASCADE
      );

      I was trying already to drop database, recreate, etc.

        Gliffy Diagrams

          Attachments

          1. my.cnf
            5 kB
          2. SHOW_VARIABLES.csv
            12 kB
          3. sysmysql
            304 kB

            Activity

            Hide
            michal.zubkowicz Michal Zubkowicz added a comment - - edited

            Mail sent with whole dump

            Show
            michal.zubkowicz Michal Zubkowicz added a comment - - edited Mail sent with whole dump
            Hide
            jplindst Jan Lindström added a comment -

            Thanks, problem repeatable.

            Show
            jplindst Jan Lindström added a comment - Thanks, problem repeatable.
            Hide
            jplindst Jan Lindström added a comment -

            Ok, fix found, is your database secred or can I use it on test case ?

            Show
            jplindst Jan Lindström added a comment - Ok, fix found, is your database secred or can I use it on test case ?
            Hide
            michal.zubkowicz Michal Zubkowicz added a comment -

            Do you need whole database or only few tables?

            Show
            michal.zubkowicz Michal Zubkowicz added a comment - Do you need whole database or only few tables?
            Hide
            jplindst Jan Lindström added a comment -

            revno: 4420
            committer: Jan Lindström <jplindst@mariadb.org>
            branch nick: 5.5
            timestamp: Wed 2015-02-04 14:40:46 +0200
            message:
            MDEV-7538: Wrong constraint (TINYINT or MEDIUMINT and INT)
            causes server crash

            Analysis: If wrong data types used on foreign constraint there
            was possibility that foreign->id is NULL when incorrect
            foreign constraint was removed from the dictionary cache.

            Fix: Add guard foreign->id != NULL before trying to lookup
            or remove the foreign constraint from dictionary cache.

            Tested using user database where problem was repeatable.

            Show
            jplindst Jan Lindström added a comment - revno: 4420 committer: Jan Lindström <jplindst@mariadb.org> branch nick: 5.5 timestamp: Wed 2015-02-04 14:40:46 +0200 message: MDEV-7538 : Wrong constraint (TINYINT or MEDIUMINT and INT) causes server crash Analysis: If wrong data types used on foreign constraint there was possibility that foreign->id is NULL when incorrect foreign constraint was removed from the dictionary cache. Fix: Add guard foreign->id != NULL before trying to lookup or remove the foreign constraint from dictionary cache. Tested using user database where problem was repeatable.

              People

              • Assignee:
                jplindst Jan Lindström
                Reporter:
                michal.zubkowicz Michal Zubkowicz
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: