[MDEV-7660] MySQL WL#6671 "Improve scalability by not using thr_lock.c locks for InnoDB tables" Created: 2015-03-04 Updated: 2022-10-03 Resolved: 2016-11-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Locking, Storage Engine - InnoDB, Storage Engine - XtraDB |
| Fix Version/s: | 10.2.3 |
| Type: | Task | Priority: | Blocker |
| Reporter: | Sergey Vojtovich | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | foundation | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.2.1-1, 10.2.1-2, 10.2.1-3, 10.2.1-4, 10.2.1-5, 10.2.2-1, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4, 10.2.3-2, 10.0.28, 10.2.4-1 | ||||||||||||||||||||||||||||||||||||||||
| Comments |
| Comment by Sergey Vojtovich [ 2016-05-06 ] | ||||||||||||||||||||||||||||
|
jplindst, could you review last patch in bb-10.2-mdev7660? All tests except for handler.innodb succeeded. The latter failed because LOCK TABLE ... WRITE didn't protect table from HANDLER ... READ. I need your help to complete this patch, specifically:
Test for handler (should hang):
Test for lock table read (should hang):
| ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-06 ] | ||||||||||||||||||||||||||||
|
Apparently LOCK TABLE ... WRITE blocks concurrent DML at MDL level. HANDLER ... READ is not blocked because it doesn't upgrade MDL lock. It likely means that neither LOCK TABLE ... WRITE nor LOCK TABLE ... READ is currently handled by InnoDB. | ||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-05-09 ] | ||||||||||||||||||||||||||||
|
Remember that InnoDB table locks are transactional, see http://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html , I see correct
calls on ::external_lock(). I do not know about HANDLER ... xxx things. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-09 ] | ||||||||||||||||||||||||||||
|
We can disregard LOCK TABLE ... WRITE as it is handled by MDL. We can also disregard HANDLER READ issue, since it is easily fixable at MDL level. But what we should about LOCK TABLE ... READ? It doesn't block DML. | ||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-05-12 ] | ||||||||||||||||||||||||||||
|
Why LOCK TABLE .. READ can't be handled on MDL level ? | ||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-05-12 ] | ||||||||||||||||||||||||||||
|
Changes look ok. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-12 ] | ||||||||||||||||||||||||||||
|
We discussed it in Berlin: we did want to let InnoDB handle LOCK TABLES. The reason is: LOCK TABLE ... READ requires substantial change to MDL. | ||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-05-12 ] | ||||||||||||||||||||||||||||
|
ok, problem is that autocommit=1 at lock table read; i.e. correct way to use is:
| ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-12 ] | ||||||||||||||||||||||||||||
|
serg, with my patch returining 0 from ha_innobase::lock_count():
Do you have any idea how can we fix the last point? Ignore it? Let LOCK TABLES start transaction? | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-05-17 ] | ||||||||||||||||||||||||||||
|
Let LOCK TABLE start a transaction. Just make sure, please, it's clearly documented. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-18 ] | ||||||||||||||||||||||||||||
|
jplindst, serg, should we start InnoDB internal transaction or call something like trans_begin()? | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-05-18 ] | ||||||||||||||||||||||||||||
|
I think it's enough to disable auto-commit. Then if any innodb table was mentioned, it will open a transaction automatically. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-05-24 ] | ||||||||||||||||||||||||||||
|
serg, please review 4 patches in bb-10.2-mdev7660. Please note that I don't feel confident about the last patch, which disables autocommit. I can't foresee all possible side effects. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-07-05 ] | ||||||||||||||||||||||||||||
|
serg, please review my last comments, specifically what should we do about deadlock? Fix this particular thing on MDL level? | ||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-09-02 ] | ||||||||||||||||||||||||||||
|
Will deadlock timeout in 50 seconds? One simple workaround would be to have an option, like, --innodb-locks-unsafe-for-handler, and only use this optimization if it's true. Ideally, the server should be able to break InnoDB locks. | ||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-10-13 ] | ||||||||||||||||||||||||||||
|
serg, please review latest patch at https://github.com/MariaDB/server/commit/c90bd38809582b27696a68058fbd57c57d6dbf6d |