[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:
Blocks
blocks MXS-1778 Consistent reads by the utlization of... Closed
Duplicate
duplicates MDEV-15170 Implement SESSION_TRACK_GTIDS Closed
duplicates MDEV-15477 SESSION_SYSVARS_TRACKER does not trac... Closed
Relates
relates to MDEV-15477 SESSION_SYSVARS_TRACKER does not trac... Closed
relates to CONC-302 SESSION_TRACK_GTIDS not implemented Closed

 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.
I am not familiar with batching: will this work in all cases (all drivers: Java Perl, ..., including with prepare statement) ?

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.
e.g allowMultiQueries=true in JDBC. Server-side prepared statements I believe are not supported, client-side prepared statements will work in JDBC, not sure about anything else.

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.
In fact, there is even a reserved value SESSION_GTIDS_TRACKER for this.

Comment by René Cannaò [ 2017-12-28 ]

Bump via https://jira.mariadb.org/browse/CONC-302

Comment by markus makela [ 2018-01-31 ]

Blocks MXS-199.

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 MDEV-15477
https://jira.mariadb.org/browse/MDEV-15477

Comment by markus makela [ 2018-05-19 ]

Is MDEV-15477 fixed in 10.3.6? What does the fix version of 10.3.6 mean for this issue?

Generated at Thu Feb 08 07:53:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.