Bug #84747 Expose last transaction GTID in a session variable.
Submitted: 31 Jan 2017 16:40 Modified: 6 Feb 2017 7:27
Reporter: Jean-François Gagné Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[31 Jan 2017 16:40] Jean-François Gagné
Description:
Hi,

currently, the only way to get the GTID of the last transaction is by enabling session_track_gtids ([1]) and using the 2 following Connector functions:

- mysql_session_track_get_first ([2])
- and mysql_session_track_get_next ([3]).

[1]: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_session_track_...

[2]: https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html

[3]: https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-next.html

So this means that for getting the last transaction GTID, one needs the right connector and a driver which support this feature.

To remove those constraints, would you please consider exposing the last transaction GTID in a session variable ?

Many thanks,

JFG

How to repeat:
This is a feature request.

Suggested fix:
Expose the last transaction GTID in a session variable.
[6 Feb 2017 7:27] MySQL Verification Team
Hello  Jean-François,

Thank you for the report and feature request!

Thanks,
Umesh
[20 Nov 2018 18:54] Neil Harkins
+1 on this feature request.
[14 May 2020 4:38] Jesper Wisborg Krogh
Another possibility (in addition to a session variable) is to expose the GTID in the performance_schema.events_statements_% tables (for % in [current, history, history_long]).