WL#10412: Group Replication: notify listener services on relevant group events

Affects: Server-8.0   —   Status: Complete

EXECUTIVE SUMMARY
=================

This worklog implements a notification framework in the group replication
plugin. On view changes, recovery state updates, network partitioning and
primary election, the plugin will call out to listeners registered in the
service registry and notify listeners that an event has ocurred. X plugin (or
other listeners) can then take action/react.

IMPORTANT NOTICES
=================

The overall direction in this area is that the MySQL server will be able to
notify client side applications, that rely on the X protocol to speak to
MySQL, about meaningful events. For instance, the MySQL server will notify the
Router that the membership has changed and some server has now gone away. Then
the router can take action and update routing tables or instruct slave servers
to reconnect to other master servers in the group. (Maybe not the router in
this case, but some orchestration mechanism.)

This worklog adds a framework, relying on the components infrastructure, that
can be used by the X plugin to subscribe to membership and other meaningful
events triggered by the Group Replication plugin. This will allow X
connections to get notifications about such events.

For HA and orchestration purposes, this is significantly important, since
client applications need not poll the server to get this information, but
instead just need to subscribe to it. This worklog is a stepping stone towards
this mode of operations, since it implements a notification framework inside
the server for events related to Group Replication. Consequently, relevant GR
events can be propagated to the X plugin which in turn will propagate these to
the external subscribers through an X connection.

We are doing this to be able to deliver the stage 3 of the next generation
MySQL server roadmap.

USER STORIES
============

- As an X plugin developer, I want to receive notifications when the   group
  membership changes so I can refresh the membership information from the
  performance schema tables and push that information to the router.

- As an X plugin developer, I want to receive notifications when the system
  runs into a network partition, so I can refresh the status information about
  my system (and perhaps push it to the router).

- As an X plugin developer, I want to receive notifications when a member in
  the group finishes recovery, so I can refresh the status information about
  the system (and perhaps push it to the router).

- As an X plugin developer I want to receive notifications when the primary
  changes so I can relay this information to the router.

- As a InnoDB cluster developer, I want to be notified of group view changes,
  so that I can update cluster topology information in places  like the
  metadata schema, DNS, etcd, zookeeper etc

- As an X plugin developer, I want to be notified of group view changes so
  that I can take actions such as disconnecting sessions that have certain
  expectations about the group (eg that it is connected to the primary) or
  updating version tokens, so that requests operating under a certain set