[MDEV-11418] AliSQL: [Feature] Issue#1 KILL IDLE TRANSACTIONS Created: 2016-11-29  Updated: 2017-07-02  Resolved: 2017-04-24

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.3.0

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-13233 Idle transaction timeouts kills conne... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MDEV-13759 Document correlation between idle_tra... Technical task Closed Ian Gilfillan  
Epic Link: AliSQL patches

 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



 Comments   
Comment by Sergey Vojtovich [ 2017-02-15 ]

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?
Comment by Lixun Peng [ 2017-02-15 ]

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.

Comment by Sergey Vojtovich [ 2017-02-16 ]

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?
Comment by Lixun Peng [ 2017-02-20 ]

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.

Comment by Sergey Vojtovich [ 2017-04-24 ]

New variables added:
idle_transaction_timeout
idle_readonly_transaction_timeout
idle_readwrite_transaction_timeout

Otherwise it is similar to original patch.

Generated at Thu Feb 08 07:49:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.