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

SET STATEMENT affects the value of the GLOBAL variable for the duration of the statement

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: N/A
    • Fix Version/s: 10.1.2
    • Component/s: Admin statements
    • Labels:
      None

      Description

      Output of the test case below
      # Initial values
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      @@global.lock_wait_timeout	@@lock_wait_timeout
      31536000	31536000
      # 
      set statement lock_wait_timeout=11 for show global variables like 'lock_wait_timeout';
      Variable_name	Value
      lock_wait_timeout	31536000
      SET STATEMENT lock_wait_timeout=12 FOR SELECT SLEEP(2.5);
      connect con1,localhost,root;
      # 
      # It's a new connection, so it picked up the current value 
      # of the global variable for the session variable
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      @@global.lock_wait_timeout	@@lock_wait_timeout
      12	12
      # 
      # Now SET STATEMENT in the other connection ended, so the global value
      # is back to normal (but the session one is not)
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      @@global.lock_wait_timeout	@@lock_wait_timeout
      31536000	12
      
      Test case
      
      --enable_connect_log
      
      --echo # Initial values
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      
      --echo # 
      set statement lock_wait_timeout=11 for show global variables like 'lock_wait_timeout';
      --send SET STATEMENT lock_wait_timeout=12 FOR SELECT SLEEP(2.5)
      
      --sleep 1
      --connect(con1,localhost,root)
      --echo # 
      --echo # It's a new connection, so it picked up the current value 
      --echo # of the global variable for the session variable
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      --sleep 2
      --echo # 
      --echo # Now SET STATEMENT in the other connection ended, so the global value
      --echo # is back to normal (but the session one is not)
      SELECT @@global.lock_wait_timeout, @@lock_wait_timeout;
      
      commit 3a3f88e789a41b309cfe902f4823c9c7ebbce6ca
      Author: Oleksandr Byelkin <sanja@mariadb.com>
      Date:   Fri Oct 24 10:13:08 2014 +0200
      
          MDEV-5231: Per query variables from Percona Server (rewritten)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              elenst Elena Stepanova added a comment -

              In Percona-server it's worse, since the global value does not get restored (see bug#1385352)

              Show
              elenst Elena Stepanova added a comment - In Percona-server it's worse, since the global value does not get restored (see bug#1385352)
              Hide
              sanja Oleksandr Byelkin added a comment -

              It is duplicate (by problem) of MDEV-6940

              Show
              sanja Oleksandr Byelkin added a comment - It is duplicate (by problem) of MDEV-6940

                People

                • Assignee:
                  sanja Oleksandr Byelkin
                  Reporter:
                  elenst Elena Stepanova
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: