[MDEV-15890] Strange error message if you try to FLUSH TABLES <view> after LOCK TABLES <view> Created: 2018-04-16 Updated: 2020-08-25 Resolved: 2018-11-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Admin statements, Locking |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.3.11, 10.2.19, 10.1.38 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
If you try to execute FLUSH TABLES on a view after read-locking that view with LOCK TABLES ... READ|WRITE, then you get an error message that doesn't seem to make a lot of sense. For example, if we have this view:
Then let's see what happens:
If we execute the same statement on the base table, then we get a different error message:
Trying to flush a write-locked view has the same problem:
But this does work for base tables:
Is the error message wrong, or is FLUSH partially broken for views at the moment? |
| Comments |
| Comment by Sergei Golubchik [ 2018-04-17 ] | |||||||||||
|
I don't see a bug here.
| |||||||||||
| Comment by Elena Stepanova [ 2018-04-17 ] | |||||||||||
|
For the record, I agree with GeoffMontee that the error message is wrong in the sense that it's confusing and normal-user-unfriendly, even if it's factually correct. For example, ER_IT_IS_A_VIEW would make much more sense, and probably we have more of the kind. Also, FWIW, while a table v of course wasn't locked here, the view v actually was:
| |||||||||||
| Comment by Sergei Golubchik [ 2018-04-24 ] | |||||||||||
|
LOCK TABLE puts read/write table locks, not only metadata locks. See SHOW OPEN TABLES. And there is no way to put a table lock on a view. | |||||||||||
| Comment by Sergei Golubchik [ 2018-04-30 ] | |||||||||||
|
On the other hand, if LOCK TABLES locks view's tables, perhaps FLUSH TABLES should check whether view's tables were locked, not whether the view itself was locked? After all FLUSH TABLES also flushes tables and not the view itself. Let's see if it's possible to get rid of this “strange” error message completely by allowing FLUSH TABLES v to work under LOCK TABLES v. | |||||||||||
| Comment by Alexey Botchkov [ 2018-06-11 ] | |||||||||||
|
http://lists.askmonty.org/pipermail/commits/2018-June/012606.html | |||||||||||
| Comment by Alexey Botchkov [ 2018-06-21 ] | |||||||||||
|
From Sergei's review: But it seems that - contrary to what I expected - that MariaDB actually create table t1 (a int); this works and inserts 1 just fine. If you change the lock table Table 'v1' was not locked with LOCK TABLES It'd be great if FLUSH TABLES will exhibit the same behavior, it needs | |||||||||||
| Comment by Alexey Botchkov [ 2018-06-24 ] | |||||||||||
|
Fix proposal v2 | |||||||||||
| Comment by Alexey Botchkov [ 2018-09-02 ] | |||||||||||
|
http://lists.askmonty.org/pipermail/commits/2018-September/012870.html | |||||||||||
| Comment by Alexey Botchkov [ 2018-09-03 ] | |||||||||||
|
http://lists.askmonty.org/pipermail/commits/2018-September/012873.html | |||||||||||
| Comment by Alexey Botchkov [ 2018-09-11 ] | |||||||||||
|
http://lists.askmonty.org/pipermail/commits/2018-September/012905.html | |||||||||||
| Comment by Sergei Golubchik [ 2018-10-17 ] | |||||||||||
|
ok to push |