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

AliSQL: [Feature] Issue#1 KILL IDLE TRANSACTIONS

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.3.0
    • OTHER
    • None

    Description

      Description:
      ------------
      Terminate idle transactions safely in server layer by setting up socket timeout parameter. Percona provides another
      patch to resolve similar problem, but it calls server layer's callback in InnoDB plugin to close THD, which crashes in some
      testcases. See https://bugs.launchpad.net/percona-server/+bug/901060 for more detailed information.
        1. export parameter trx_idle_timeout to handle all kinds of transactions, the priority is highest
        2. export parameter trx_readonly_idle_timeout to handle read-only transactions
        3. export parameter trx_changes_idle_timeout to handle read-write transactions
      

      https://github.com/alibaba/AliSQL/commit/68d6a67a7f93e25c9b4e0bc42445878b1433b2a5

      Attachments

        Issue Links

          Activity

            plinux, this patch looks interesting, but could you elaborate a few things:

            • why wait_timeout didn't work for you?
            • why do you need separate timeouts for read-only and read-write transactions? What is the common setting for those?
            • why do you need additional trx_idle_timeout?
            • why trx_idle_timeout has higher priority than more specific trx_readonly_idle_timeout and trx_changes_idle_timeout?
            • per my understanding these 3 new idle timeouts have longer effect than one may expect, e.g. if transaction is committed but no subsequent statement received yet. Right?
            svoj Sergey Vojtovich added a comment - plinux , this patch looks interesting, but could you elaborate a few things: why wait_timeout didn't work for you? why do you need separate timeouts for read-only and read-write transactions? What is the common setting for those? why do you need additional trx_idle_timeout? why trx_idle_timeout has higher priority than more specific trx_readonly_idle_timeout and trx_changes_idle_timeout? per my understanding these 3 new idle timeouts have longer effect than one may expect, e.g. if transaction is committed but no subsequent statement received yet. Right?
            plinux Lixun Peng added a comment -

            svoj

            Idle transaction means the transaction is started and done some operations, but forget to query a COMMIT or ROLLBACK.
            Wait_timeout can't sovle this problem.
            Because for InnoDB, readonly transaction needn't to get any locks (MVCC), so maybe users can accept longer run time.
            But for INSERT/DELETE or other write operations, the transaction will hold some locks, so usually the users can't accept it runs a long time.
            So we need 2 different timeout option.

            And trx_idle_timeout is a higher priority option, if users can accept the readonly and non-readonly transactions use the same timeout number, then it can use this option.

            plinux Lixun Peng added a comment - svoj Idle transaction means the transaction is started and done some operations, but forget to query a COMMIT or ROLLBACK. Wait_timeout can't sovle this problem. Because for InnoDB, readonly transaction needn't to get any locks (MVCC), so maybe users can accept longer run time. But for INSERT/DELETE or other write operations, the transaction will hold some locks, so usually the users can't accept it runs a long time. So we need 2 different timeout option. And trx_idle_timeout is a higher priority option, if users can accept the readonly and non-readonly transactions use the same timeout number, then it can use this option.

            plinux, alright I agree different timeouts for read-only and read-write transactions are useful. Per my understanding one of options is to adjust wait_timeout before every transaction, but it requires application changes and is not acceptable for you.

            Still I don't completely understand a few implementation things:

            • after I do just "BEGIN" wait_timeout applies, which is more or less alright. Correct?
            • after I do "BEGIN; SET ..." wait_timeout applies, which is more or less alright. Correct?
            • after I do "BEGIN; INSERT...; COMMIT;" trx_changes_idle_timeout applies (because nobody restored it to wait_timeout), which looks confusing. Correct?
            • I'm fine about having trx_idle_timeout as a fallback for trx_readonly_idle_timeout and trx_changes_idle_timeout, but I think the fact that it has higher priority is confusing. Will it work for you if we prefer setting of trx_readonly_idle_timeout and trx_changes_idle_timeout over trx_idle_timeout?
            svoj Sergey Vojtovich added a comment - plinux , alright I agree different timeouts for read-only and read-write transactions are useful. Per my understanding one of options is to adjust wait_timeout before every transaction, but it requires application changes and is not acceptable for you. Still I don't completely understand a few implementation things: after I do just "BEGIN" wait_timeout applies, which is more or less alright. Correct? after I do "BEGIN; SET ..." wait_timeout applies, which is more or less alright. Correct? after I do "BEGIN; INSERT...; COMMIT;" trx_changes_idle_timeout applies (because nobody restored it to wait_timeout), which looks confusing. Correct? I'm fine about having trx_idle_timeout as a fallback for trx_readonly_idle_timeout and trx_changes_idle_timeout, but I think the fact that it has higher priority is confusing. Will it work for you if we prefer setting of trx_readonly_idle_timeout and trx_changes_idle_timeout over trx_idle_timeout?
            plinux Lixun Peng added a comment -

            svoj
            It's OK, we need just to define a priority level, whether we define trx_idle_timeout has a higher priority or the other two options have higher priority is OK for me.
            We just need to have these options to adjust transaction timeout.

            plinux Lixun Peng added a comment - svoj It's OK, we need just to define a priority level, whether we define trx_idle_timeout has a higher priority or the other two options have higher priority is OK for me. We just need to have these options to adjust transaction timeout.

            New variables added:
            idle_transaction_timeout
            idle_readonly_transaction_timeout
            idle_readwrite_transaction_timeout

            Otherwise it is similar to original patch.

            svoj Sergey Vojtovich added a comment - New variables added: idle_transaction_timeout idle_readonly_transaction_timeout idle_readwrite_transaction_timeout Otherwise it is similar to original patch.

            People

              svoj Sergey Vojtovich
              svoj Sergey Vojtovich
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.