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

OPTIMIZE TABLE t0 NOWAIT results in Got error -2 "Internal error < 0 (Not system error)" from storage engine InnoDB

    XMLWordPrintable

Details

    Description

      Database version: 11.3.2-MariaDB-1:11.3.2+maria~ubu2204

      Bug found with SQLancer.

      Running OPTIMIZE TABLE t0 NOWAIT on two separate databases
      concurrently might result in the error: Got error -2 "Internal error < 0 (Not system error)" from storage engine InnoDB

      | Table        | Op       | Msg_type | Msg_text                                                                        |
      +--------------+----------+----------+---------------------------------------------------------------------------------+
      | database1.t0 | optimize | note     | Table does not support optimize, doing recreate + analyze instead               |
      | database1.t0 | optimize | error    | Got error -2 "Internal error < 0 (Not system error)" from storage engine InnoDB |
      | database1.t0 | optimize | status   | Operation failed                                                                |
      +--------------+----------+----------+---------------------------------------------------------------------------------+
      3 rows in set, 1 warning (0.099 sec)
      

      The error does not get thrown all the time, so to reproduce I had to run the queries in a loop on two separate processes.

      This can be done using the following script. The bug should appear in about a minute of running.

      #! /usr/bin/env bash
       
      query="
      DROP DATABASE IF EXISTS ${1};
      CREATE DATABASE ${1};
      USE ${1};
      CREATE TABLE t0(c0 INT);
      OPTIMIZE TABLE t0 NOWAIT;
      "
       
      while :
      do
       mariadb -h 127.0.01 -uroot -proot -f -v -v -v <<< $query |& grep "Internal error" -C 3
      done
      

      ie
      ./test.sh database1
      ./test.sh database2

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            malwaregary Tan Ming Wei
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.