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

    Details

    • Type: Technical task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Reproducible on
            revision-id: psergey@askmonty.org-20130201180328-ocmbh9uvcoedmihp
            revno: 4591
            branch-nick: mysql-5.6-leveldb

            Show
            elenst Elena Stepanova added a comment - Reproducible on revision-id: psergey@askmonty.org-20130201180328-ocmbh9uvcoedmihp revno: 4591 branch-nick: mysql-5.6-leveldb

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h