[MDEV-11956] Get last_gtid in OK packet. Created: 2017-01-31 Updated: 2019-02-28 Resolved: 2018-04-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Fix Version/s: | 10.3.6 |
| Type: | Task | Priority: | Critical |
| Reporter: | Jean-François Gagné | Assignee: | Oleksandr Byelkin |
| Resolution: | Duplicate | Votes: | 3 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
Hi, the GTID of the last transaction is exposed via the last_gtid session variable ([1]). This needs a round-trip to the server, which could be unwanted in some situations. [1]: https://mariadb.com/kb/en/mariadb/gtid/#last_gtid Upstream MySQL implements a way to get the GTID of the last transaction at the protocol level in the OK packet. ([2], [3] and [4]). I think this would be a good feature in MariaDB Server. [2]: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_session_track_gtids [3]: https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html [4]: https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-next.html Please also consider this improvement on the upstream implementation: Request transaction GTID in OK packet on COMMIT(without needing a round-trip) - [5]. [5]: https://bugs.mysql.com/bug.php?id=84748 Many thanks, JFG |
| Comments |
| Comment by Vladislav Vaintroub [ 2017-01-31 ] |
|
Out of curiosity, about the the round trips. There is batching via semicolon "UPDATE... ;SELECT @@session_var" and also MariaDB specific BEGIN NOT ATOMIC, that does not need semicolon batching to be enabled. Would not work for some reason? |
| Comment by Jean-François Gagné [ 2017-02-06 ] |
|
Thanks for looking into that Vladislav. |
| Comment by Vladislav Vaintroub [ 2017-02-06 ] |
|
"semicolon" batching , i.e commands separated by ";" , might require some special parameters to enable, and the way to enable it could be driver specific. BEGIN NOT ATOMIC should work just fine in 10.1 not requiring special parameters for enabling it. I'm unsure how prepared statements work with it. I did not read anything about not supporting, but did not try either. |
| Comment by Sergei Golubchik [ 2017-05-25 ] |
|
It shouldn't be difficult to report gtid in the session tracker framework. |
| Comment by René Cannaò [ 2017-12-28 ] |
| Comment by markus makela [ 2018-01-31 ] |
|
Blocks |
| Comment by Oleksandr Byelkin [ 2018-01-31 ] |
|
I risen priority because it block other tasks |
| Comment by Oleksandr Byelkin [ 2018-04-11 ] |
|
functionality will be implemeted in |
| Comment by markus makela [ 2018-05-19 ] |
|
Is |