[MDEV-12882] Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE || mdl_ticket->m_type == MDL_SHARED_NO_WRITE || mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE || mdl_ticket->m_type == MDL_SHARED_READ' failed in MDL_context::upgrade_shared_lock Created: 2017-05-23 Updated: 2017-06-26 Resolved: 2017-06-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Locking |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.2.7, 10.3.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
|
| Comments |
| Comment by Sergey Vojtovich [ 2017-06-21 ] | |
|
Even though table is locked multiple times connection can hold only one lock, the strongest one. Currently there's no lock having semantics suitable for the above test case, that is:
I can see the following possible fixes:
serg, what's your thinking? | |
| Comment by Sergei Golubchik [ 2017-06-21 ] | |
|
I'd either use the stronger lock or issue an error.
this needs to read from and to write to the table. and it takes a stronger lock, there's no error here. | |
| Comment by Sergey Vojtovich [ 2017-06-21 ] | |
|
Hmm... I believe this example is not completely applicable, because semantically we have to take MDL_SHARED_WRITE in this case. Right? But in this bug semantically we can allow concurrent reads (except for LOCK TABLE ... READ). The only reason why we wouldn't allow them is that we don't want to add a lot of code just to handle this edge case. | |
| Comment by Sergei Golubchik [ 2017-06-21 ] | |
|
Yes, I just mean that the server takes a stronger lock. I could, probably, come with with a more complex example with a couple of triggers that require different locks on the same table and how prelocking handles it. But I think it's enough to say that when many locks are requested, the stronger lock wins. | |
| Comment by Sergey Vojtovich [ 2017-06-21 ] | |
|
In our case requested locks will be MDL_SHARED_WRITE and MDL_SHARED_READ_ONLY. And the winner is out of sudden MDL_SHARED_NO_READ_WRITE. I don't think we had anything similar before MDL_SHARED_READ_ONLY was introduced. I'm all for upgrading to MDL_SHARED_NO_READ_WRITE. Just trying to understand your arguments. | |
| Comment by Sergey Vojtovich [ 2017-06-22 ] | |
|
serg, please review fix for this bug. | |
| Comment by Sergei Golubchik [ 2017-06-23 ] | |
|
ok to push |