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

Inconsistent locking message for Spider target table; ERROR 1099 Table was locked with a READ lock and can't be updated

    XMLWordPrintable

Details

    Description

      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET '../socket.sock',DATABASE'',USER'',PASSWORD'');
      CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB;
      CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"';
      LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
      SELECT 1 FROM t1;
      

      Leads to:

      CS 10.5.27 e886c2ba02ac021c648f84aa8f910af4fb4fb4bb (Debug)

      11.7.0-dbg>SELECT 1 FROM t1;
      ERROR 1099 (HY000): Table 't' was locked with a READ lock and can't be updated
      

      And in the error log we see:

      CS 10.5.27 e886c2ba02ac021c648f84aa8f910af4fb4fb4bb (Debug)

      [ERROR] Got error 1099 when reading table './test/t1'
      

      However, table t was not locked with a READ lock. Also we are doing a read, i.e. not making any update.

      While we cannot directly compare with InnoDB, the following presents a somewhat similar scenario;

      CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT);
      CREATE TABLE t1 (c INT KEY,c1 BLOB,c2 TEXT);
      LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
      SELECT 1 FROM t1, t;
      

      The CLI outcome is:

      CS 10.5.27 e886c2ba02ac021c648f84aa8f910af4fb4fb4bb (Debug)

      11.7.0-dbg>SELECT 1 FROM t1, t;
      ERROR 1100 (HY000): Table 't' was not locked with LOCK TABLES
      

      With no error log message. Also note the different error number.

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.