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

LP:986731 - sql-bench/test-table-elimination fails with SQL syntax error in LOCK TABLES if executed with --lock-tables

Details

    Description

      Initially reported in the KB as http://kb.askmonty.org/en/test-table-elimination-fails.

      If sql-bench/test-table-elimination is started with --lock-tables (or --fast), it attempts to execute the following command:

      LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE

      and reasonably fails with a syntax error, as it is not a valid statement: each table should be followed by a lock type separately.

      The following change fixes this particular problem

      95c95
      < do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");

      > do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
      207c207
      < do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");

      > do_query($dbh,"LOCK TABLES elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

      but then another one reveals:

      testing full facts facts table
      Error occured with execute(select * from elim_current_facts where id=30246.3207346651)
      -> Table 'F' was not locked with LOCK TABLES

      This happens because the view elim_current_facts addresses the table elim_facts through its alias F, which is not locked explicitly. So, I also added the view itself into the LOCK statement:

      95c95
      < do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");

      > do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");
      207c207
      < do_query($dbh,"LOCK TABLES elim_facts, elim_attr1, elim_attr2 WRITE");

      > do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE");

      Now it passes.

      bzr version-info
      revision-id: <email address hidden>
      date: 2012-04-06 13:31:33 +0500
      build-date: 2012-04-22 04:12:58 +0400
      revno: 3146

      According to the script code, should also be reproducible on 5.2-5.5.

      To reproduce,

      • start MariaDB server;
      • run perl test-table-elimination --socket=<path to socket> --lock-tables

      Attachments

        Activity

          elenst Elena Stepanova created issue -

          Launchpad bug id: 986731

          ratzpo Rasmus Johansson (Inactive) added a comment - Launchpad bug id: 986731
          ratzpo Rasmus Johansson (Inactive) made changes -
          Field Original Value New Value
          Labels Launchpad
          ratzpo Rasmus Johansson (Inactive) made changes -
          Labels Launchpad MariaDB_5.1
          ratzpo Rasmus Johansson (Inactive) made changes -
          Labels MariaDB_5.1 Launchpad MariaDB_5.1
          ratzpo Rasmus Johansson (Inactive) made changes -
          Fix Version/s Maria 5.1 [ 11600 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Key IMT-7730 MDEV-744
          Project ImportTest [ 10200 ] MariaDB Development [ 10000 ]
          Workflow jira [ 21379 ] defaullt [ 21588 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.29 [ 11701 ]
          Fix Version/s 5.3.10 [ 11500 ]
          Fix Version/s 5.2.13 [ 10800 ]
          Fix Version/s 5.1.65 [ 10801 ]
          serg Sergei Golubchik made changes -
          Labels Launchpad MariaDB_5.1 Launchpad
          elenst Elena Stepanova made changes -
          Affects Version/s 5.3.9 [ 11000 ]

          Fixed in 5.3

          psergei Sergei Petrunia added a comment - Fixed in 5.3
          psergei Sergei Petrunia made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 21588 ] MariaDB v2 [ 45716 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 45716 ] MariaDB v3 [ 66410 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 66410 ] MariaDB v4 [ 146118 ]

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.