Bug #84276 Minimum version for GTID session tracking is wrong
Submitted: 20 Dec 2016 12:36 Modified: 3 Mar 2017 17:02
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[20 Dec 2016 12:36] Daniël van Eeden
Description:
https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html
says: "This function fetches the first session state-change information received from the server. It was added in MySQL 5.7.4". 

However looking at mysql-server/5.7 SESSION_TRACK_GTIDS was introduced in commit c4f32d662 which corresponds to version 5.7.8-rc

The result is that I had this in my code:
#if (MYSQL_VERSION_ID >= 50704)

And then it fails because SESSION_TRACK_GTIDS is unknown.

This happened when compiling against Connector/C 6.1.6 which reports MYSQL_VERSION_ID=50706

How to repeat:
Try to write code with this line:

mysql_session_track_get_first(mysql, SESSION_TRACK_GTIDS, &data, &length)

And then use an ifdef to make it backwards compatible.

Suggested fix:
Best:
Document in which version SESSION_TRACK_GTIDS was defined.

Acceptable:
Or document that one must not use these directly but is always required to loop over all session tracking.
[21 Dec 2016 6:59] MySQL Verification Team
Hello Daniël,

Thank you for the report.

Thanks,
Umesh
[18 Jan 2017 16:02] Paul DuBois
mysql_session_track_get_first() was added in 5.7.4.
Looks like SESSION_TRACK_GTIDS was added in 5.7.6 (verified against a 5.7.6 source distribution).

Anyway, these are pre-GA versions. Compile against a GA version and you should be fine.

No docs change made.
[19 Jan 2017 12:27] Daniël van Eeden
> these are pre-GA versions. Compile against a GA version and you should be fine.
This is in a GA version of Connector/C
[16 Feb 2017 15:12] Daniël van Eeden
This bug is *not* against MySQL 5.7.6 but it is a bug in Connector/C 6.1.6 which is based on 5.7.6.
[16 Feb 2017 15:16] Simon Mudd
To be clear. You should not build production GA code (Connector/C 6.1.6) against development versions of 5.7 (in this case 5.7.6) if they are not compatible with the GA version. This leads to compatibility problems which we then have to work around.
[3 Mar 2017 17:02] Paul DuBois
Posted by developer:
 
Added this to section:

SESSION_TRACK_GTIDS was added in MySQL 5.7.6. Applications that use the C API (including Connector/C applications) can test whether this member is available as follows:

#if MYSQL_VERSION_ID >= 50706
  ...
#endif