Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3841 LevelDB storage engine
  3. MDEV-4059

LevelDB: query waiting for a lock cannot be killed until query timeout exceeded

    XMLWordPrintable

Details

    • Technical task
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      One connection locked a row, another connection attempts to update the row and starts waiting for the lock. Killing the waiting query has no effect until the wait timeout is exceeded, and only after that the query ends with 'execution interrupted' (rather than 'timeout exceeded').

      In the test below we execute the described scenario with leveldb_lock_wait_timeout set to 5. The connection which killed the query waits for 1 second and then checks the processlist – the query is still there, and the state is 'updating', not 'killed'. When the query ends, we can see from now() values that it took full 5 seconds.

      For InnoDB it works as expected, the query gets killed.

      Test output:

      create table t1 (pk int primary key, a int) engine=LevelDB;
      insert into t1 values (1,10),(2,20);
      begin;
      update t1 set a = 100 where pk = 1;
      connect  con1,localhost,root,,;
      set leveldb_lock_wait_timeout=5;
      select now();
      now()
      2013-01-16 17:44:47
      update t1 set a = 1000 where pk = 1;;
      connect  con2,localhost,root,,;
      kill query 3;
      show processlist;
      Id      User    Host    db      Command Time    State   Info
      4       root    localhost       test    Query   0       init    show processlist
      3       root    localhost       test    Query   1       updating        update t1 set a = 1000 where pk = 1
      2       root    localhost       test    Sleep   1               NULL
      connection con1;
      ERROR 70100: Query execution was interrupted
      select now();
      now()
      2013-01-16 17:44:52
      connection default;
      commit;

      Test case:

      --enable_connect_log
       
      create table t1 (pk int primary key, a int) engine=LevelDB;
      insert into t1 values (1,10),(2,20);
      begin;
      update t1 set a = 100 where pk = 1;
       
      --connect (con1,localhost,root,,)
      --let $con1_id = `SELECT CONNECTION_ID()`
      set leveldb_lock_wait_timeout=5;
      select now();
      --send update t1 set a = 1000 where pk = 1;
       
      --connect (con2,localhost,root,,)
      eval kill query $con1_id;
      --sleep 1
      show processlist;
       
      --connection con1
      --error ER_QUERY_INTERRUPTED
      --reap
      select now();
       
      --connection default
      commit;
       

      revision-id: psergey@askmonty.org-20130115181447-1jfr200qcuqzp1sr
      revno: 4495
      branch-nick: mysql-5.6-leveldb

      Attachments

        Activity

          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.