[MDEV-9030] RESET CONNECTION command Created: 2015-10-28 Updated: 2017-05-29 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Mikhail Gavrilov | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
For scripting languages such PHP, when script ended with fatal error pending transaction is not closed if used persistent connection. So for consistent data strongly needed that next START TRANSACTION / BEGIN rollback the previous one uncommitted transaction. In current time server do implicit commit, what is incorrect and may cause broke application data. I think best solution would be add option which allow change "implicit commit" to "implicit rollback". Thanks! |
| Comments |
| Comment by Daniel Black [ 2015-10-29 ] | ||||||||||||||||||||||||||||||
|
Implicit rollback is the behaviour on transactional engines:
| ||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-10-29 ] | ||||||||||||||||||||||||||||||
|
please show the code/sql that shows an explicit commit? What is the table engine type? | ||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-10-29 ] | ||||||||||||||||||||||||||||||
|
danblack, implicit rollback is the behavior only in case of connection termination, just as your example with MySQL client shows.
So, the current behavior is that upon the second BEGIN, "transactional DML 1" is committed. Mikhail wants to be able to configure the server so instead it's rolled back. | ||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-10-29 ] | ||||||||||||||||||||||||||||||
|
ack, thanks elenst, make sense. Is this a FR variable to work around poorly implemented applications? I'm thinking implicit behaviours should emit a warning as this seems to be a application execution path problem - lack of proper exception handling ( For the cases of application functions doing their own mini transactions is the following a correct paradigm (for non-recursive functions)?
Is there anything else SQL needs to do to support application coding paradigms? (if so separate FR) | ||||||||||||||||||||||||||||||
| Comment by Mikhail Gavrilov [ 2015-10-30 ] | ||||||||||||||||||||||||||||||
1.
But I can't check how it works because unable upgrade my server to 10.1.8 2. | ||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-10-30 ] | ||||||||||||||||||||||||||||||
mikhail, last night I added a comment to | ||||||||||||||||||||||||||||||
| Comment by Mikhail Gavrilov [ 2015-10-30 ] | ||||||||||||||||||||||||||||||
|
Don't understand how restore standard delimiter. | ||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-11-02 ] | ||||||||||||||||||||||||||||||
|
I don't see why this feature may be needed in that particular form. In the connection pooling when a new "user" is assigned to the existing connection from the pool, it needs to reset the connection anyway. Like, restore session variables, remove temporary tables and user variables, change the current database back, etc. This "etc" includes rolling back an unfinished transaction. So what you really need, I suppose, is an easy way to "reset" the connection. Normally one uses CHANGE USER for that, but we can have something like a dedicated "RESET CONNECTION" command too. | ||||||||||||||||||||||||||||||
| Comment by Mikhail Gavrilov [ 2015-11-02 ] | ||||||||||||||||||||||||||||||
Yes, this is exactly what I need, thank you, Sergei. I need 'RESET CONNECTION' command which will also do implicit rollback. I couldn't find documentation for 'CHANGE USER' statement. Where I can found description? And question by 'CHANGE USER' you mean SQL or application user? I ask this because interested see in 'SHOW PROCESSLIST' also application users in separated column. | ||||||||||||||||||||||||||||||
| Comment by Mikhail Gavrilov [ 2015-11-02 ] | ||||||||||||||||||||||||||||||
|
It would be interesting such variant: On application side:
Administrator may see processlist with application users:
|