WL#7518: Deprecate @@session.gtid_executed

Affects: Server-5.7   —   Status: Complete   —   Priority: Medium

Proposal
========

- In 5.7, generate deprecation warning when user accesses
  @@session.gtid_executed.
- In 5.8, remove @@session.gtid_executed.

Note
====

We do not propose to deprecate @@global.gtid_executed.

Background
==========

This variable contains the set of GTIDs currently stored in the 
transaction cache. That is: 

- In the normal case when GTID_NEXT="AUTOMATIC", it is equal to empty 
  string ("").
- When GTID_NEXT="GTID" (usually in a slave thread), it is the empty
  string ("") before anything has been written to the transaction cache,
  and equal to "GTID" when something has been written to the transaction
  cache.

Rationale
=========

- The value can be completely determined from the value of GTID_NEXT.
- The original intention of this variable was that it would be useful
  for testing and debugging when GTIDs and NDB were made to work
  together. However, this has not yet happened and it is not clear
  that NDB+GTIDs, when eventually merged together, will actually work
  in the way once envisioned when @@session.gtid_executed was
  introduced.   
- The variable is ill-named (1). Anyone who uses GTIDs will need to
  use @@GLOBAL.gtid_executed frequently. The global variable is
  defined in a completely different manner and not directly related to
  the session value.
- Users who need @@global.gtid_executed but forget to type the
  'global' keyword will see wrong results and no error message.
- The variable is ill-named (2). Whenever a variable is available in
  both global and session scope, the protocol is that this is a
  configuration variable where the global value serves as default for
  the session. gtid_executed breaks this protocol.
- So, to summarize, the variable has no practical use and it is
  confusing and error-prone.