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

CREATE TABLE IF NOT EXISTS locking changes in 10.3.10

    XMLWordPrintable

Details

    Description

      I have a workload that does partitioning manually (largely because at the end of each day I want to 'optimize table' for the previous day's partition to address fragmentation). As a result there's a stored procedure, that prepares a statement of the form "create table if not exists table_20181130 like table_template" and runs it. This procedure is called rather a lot and >99% of the time the table already exists so this doesn't do anything. This has been working great up-to and including MariaDB 10.3.9.

      Upon upgrading to 10.3.10 (or 11) I find that performance of my system is abysmal. And this seems to be down to this procedure - the create table if not exists doesn't return immediately like it used to if the table exists and any other query has the table open. I can work around this by looking in information_schema.TABLES and avoiding the 'create table if not exists' if the table already exists - however this feels like a regression to me rather than an intentional change, especially as I don't see anything obviously related in the 10.3.10 ChangeLog.

      To recreate; in one terminal execute:

      create table if not exists test1 (a int);
      select sum(a), sleep(60) from test1;
      

      ... and in another:

      create table if not exists test1 (a int);
      

      In anything before 10.3.10 the second terminal will complete immediately, but in 10.3.10 (or 11) the second terminal will only complete once the select in the first terminal has done so.

      Attachments

        Activity

          People

            jplindst Jan Lindström (Inactive)
            jakdaw Chris Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            7 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.