[MDEV-11227] mysqlimport -l doesn't issue UNLOCK TABLES Created: 2016-11-03 Updated: 2016-12-22 Resolved: 2016-12-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.2.3 |
| Fix Version/s: | 10.2.3 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Sergey Vojtovich | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.2.4-4, 10.2.4-1 | ||||||||
| Description |
|
It wasn't a problem before |
| Comments |
| Comment by Elena Stepanova [ 2016-11-04 ] | |||||||||||||||
|
I think mysqlimport is the least of our problems. Applications are not obliged to run UNLOCK TABLES explicitly! It's not even indeterministic behavior, it's documented and guaranteed that locks get released when the connection terminates:
I bet that enormous number of existing applications rely on that. What if a connection ends, for example, due to a wait timeout? It happens all the time. Or gets killed. Or... there are numerous situations where this change will break an existing logic. svoj, serg, I beg you to re-consider. I see in the comments to | |||||||||||||||
| Comment by Sergey Vojtovich [ 2016-11-04 ] | |||||||||||||||
|
Well, one still isn't obligated to run UNLOCK TABLES. There's even almost no behaviour change when autocommit is unset initially. Unfortunately one can issue LOCK TABLE t1 WRITE, t2 READ, that is in mixed case we'll have to disable autocommit too. I have to leave it up to serg to defend this solution, because my intuition is not happy with current solution either. | |||||||||||||||
| Comment by Elena Stepanova [ 2016-11-04 ] | |||||||||||||||
What do you mean? It appears that all DML changes since the last LOCK TABLE .. WRITE will be lost if one does not run UNLOCK TABLES before disconnecting, isn't it the point of your bug report about mysqlimport? I don't see how an alleged improvement of scalability can be possibly worth it. | |||||||||||||||
| Comment by Elena Stepanova [ 2016-11-05 ] | |||||||||||||||
|
Set to blocker and assigned to serg in hope it will be revisited before the release. | |||||||||||||||
| Comment by Sergei Golubchik [ 2016-11-08 ] | |||||||||||||||
|
For backward compatibility we will implement a special handling for transactions implicitly opened by LOCK TABLES. These transactions will be committed on disconnect, not rolled back, | |||||||||||||||
| Comment by Sergey Vojtovich [ 2016-11-10 ] | |||||||||||||||
|
Problem #1 (solvable, but confusing): We have to consider autocommit setting that was before LOCK TABLES when deciding whether to commit or rollback transaction. Disconnect must commit transaction:
Disconnect must rollback transaction:
The latter example is from http://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html | |||||||||||||||
| Comment by Sergey Vojtovich [ 2016-11-10 ] | |||||||||||||||
|
Problem #2 (not completely related): COMMIT now breaks lock:
Before | |||||||||||||||
| Comment by Elena Stepanova [ 2016-11-22 ] | |||||||||||||||
|
Problem #2 extension (it might be unrelated to the disconnect issue, but it's definitely related to the root cause)
Problem #3 This does not work anymore:
I'm sure there are many more surprises. serg, again, given all the above, I beg to reconsider. Yes, I suppose every single issue can be solved by some cumbersome workaround, or declared as non-essential, but the sheer amount of incompatibilities that we introduce just does not make sense. Even if it were the only way to implement the desired optimization, it would still be very questionable, but to my understanding, svoj had an alternative solution which wasn't supposed to cause all of this, but it was discarded. Maybe it could be revived? | |||||||||||||||
| Comment by Sergey Vojtovich [ 2016-12-13 ] | |||||||||||||||
|
serg, please review fix for this bug. |