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

GET_LOCK() with negative timeouts has strange behavior

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.0.0, 5.5.28a, 5.3.11, 5.2.13, 5.1.66
    • Fix Version/s: 10.0.21, 10.1.7, 5.5.45
    • Component/s: OTHER
    • Labels:
    • Environment:
      5.5

      Description

      I know that passing a negative timeout to GET_LOCK() makes no sense. But if you do it by mistake (perhaps with dynamic sql) there are 2 cases:

      • If the number is high, it is like passing 0:
        MariaDB [(none)]> SELECT GET_LOCK('x', -100);
        +---------------------+
        | GET_LOCK('x', -100) |
        +---------------------+
        |                   0 |
        +---------------------+
        1 row in set (0.01 sec)
        
      • if number is very low, it considers it as a positive number (you will need to kill the query):
        SELECT GET_LOCK('x', -1500000000);
        

        In both cases, I get no errors or warnings.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              f_razzoli Federico Razzoli added a comment -

              Of course the first case is ok, but I think that the second case (very low negatives considered as positive) is a bug.

              Show
              f_razzoli Federico Razzoli added a comment - Of course the first case is ok, but I think that the second case (very low negatives considered as positive) is a bug.
              Hide
              elenst Elena Stepanova added a comment -

              It's an upstream issue, except that in MySQL up to and including 5.6 even GET_LOCK('x', -10) hangs seemingly forever (as well as in MariaDB 5.1/5.2).

              Show
              elenst Elena Stepanova added a comment - It's an upstream issue, except that in MySQL up to and including 5.6 even GET_LOCK('x', -10) hangs seemingly forever (as well as in MariaDB 5.1/5.2).
              Hide
              svoj Sergey Vojtovich added a comment -

              Alexander Barkov, please review fix for this bug.

              Show
              svoj Sergey Vojtovich added a comment - Alexander Barkov , please review fix for this bug.
              Hide
              bar Alexander Barkov added a comment -

              Okey to push, with a minor suggestion.

              Show
              bar Alexander Barkov added a comment - Okey to push, with a minor suggestion.

                People

                • Assignee:
                  svoj Sergey Vojtovich
                  Reporter:
                  f_razzoli Federico Razzoli
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: