[MDEV-4427] query timeouts Created: 2013-04-23 Updated: 2014-11-02 Resolved: 2014-10-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Fix Version/s: | 10.1.1 |
| Type: | Task | Priority: | Critical |
| Reporter: | roberto spadim | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
Hi guys, maybe this could be done easly (maybe in GSoC) twitter/mysql have a similar feature, after some pre defined time, the query is canceled by server (KILL the query in a background thread) example: the UPDATE will be blocked by SELECT while it's executing... the point is, kill (1) after 10 seconds if there's a blocked query trying to use this table, in this case the query (2) this help a lot myisam tables (with table lock only method, no page and no row lock levels) with poor performace of select+update+delete+insert here some information about twitter mysql implementation: i prefer a float value based in seconds (instead milliseconds), i didn't found information to set it off, maybe set max_statement_time=0 — https://kb.askmonty.org/en/how-to-limittimeout-queries/ MAX_QUERY_TIME variable You can limit the time any query is executed by setting the MAX_QUERY_TIME variable. The variable takes the number of seconds (with microsecond precision) the query should be executed. If the query is run more than the given timeout, it will be killed as by a KILL SOFT command. |
| Comments |
| Comment by roberto spadim [ 2013-04-23 ] |
|
it's complementary to |
| Comment by roberto spadim [ 2013-06-05 ] |
|
twiteer commits: should be nice change it a bit... where we need kill: where we don't need kill |
| Comment by Sergei Golubchik [ 2014-04-17 ] |
|
mysql-5.7.4 has it |
| Comment by Sergei Golubchik [ 2014-04-17 ] |
|
possible implementation:
|
| Comment by Michael Widenius [ 2014-04-22 ] |
|
We already have one implementation of this task. We are just waiting for the sponsor to pay for it so that we can push it. |
| Comment by roberto spadim [ 2014-05-26 ] |
|
hi guys! any news? |
| Comment by roberto spadim [ 2014-05-26 ] |
|
— — thanks guys |
| Comment by Michael Widenius [ 2014-10-07 ] |
|
This is now implemented in 10.1 and I plan to push it into 10.1 Implementation details:
Second part could be relatively easily be done by adding some test in 'THD::awake()' (at least for table_locks). |
| Comment by Michael Widenius [ 2014-10-07 ] |
|
Code pushed to 10.1 tree. |
| Comment by roberto spadim [ 2014-10-07 ] |
|
nice news |
| Comment by roberto spadim [ 2014-10-07 ] |
|
should i open another MDEV just to explain the "PAUSE" and track? |
| Comment by roberto spadim [ 2014-10-07 ] |
|
i'm reading patch code , there's a timeout_hard, is it being used or any plan about it? or it's something about killing mysqld and the thread have a kill_timeout condition and change it to timeout_hard? didn't found where it is used + KILL_TIMEOUT= 8, |
| Comment by roberto spadim [ 2014-10-07 ] |
|
other doubt, i didn't understood reading the source code how timeout thread know if we are timedout or not |
| Comment by Michael Widenius [ 2014-10-08 ] |
|
Yes, please create another mdev for new features. The HARD option is an addition to MariaDB. You can use HARD as an option for the KILL command. It means that the query should be killed as soon as possible, even if it would leave the table in an inconsistent state. It's 1) |
| Comment by roberto spadim [ 2014-10-09 ] |
|
nice =] created about the hard, it's not being used yet by the timeout right? i'm considering that the current design could be the 'hard timeout' and we could create a soft timeout, the soft when the process receive the kill_timeout it will check if the current thread is or isn't blocking others process, i don't know the best method to do this but i think at the thread running is easier than a external process, since we alread have a lock about the current process and we just need to check mdl (at a first version) + storage level (partition/page/row) locks (in a second version), just to think about an roadmap about how to implmeemnt the "soft" timeout |