We received feedback about how a member should act when leaving the group. And the majority of users wanted that when a node drops out of the group, it should kill all connections and shutdown. I totally agree with that behavior and it’s now the default in MySQL 8.0.12.
This new feature is explained in WL#11568.
Before this change, the server goes into super read only mode when dropping out of the group and allows users connected to this server or new connections (if you don’t use the router) to read old data.
Let’s check this out in the following video:
So now in MySQL 8.0.12, there is a mnew option called
group_replication_exit_state_action and be default, when a node is evicted of the group it should abort
mysqld (shutdown MySQL). This terminate all user connections and avoid stale reads… Let’s have a look at this in action:
Hey !? What happened here ? We were still able to read old data if we perform a new connection directly to the server ! Of course this is not recommended. All existing connection have been killed, those connected via the router or directly, but we are still able to connect again directly to the server and read data. This is of course a good reason to always use the router (or another routing/proxy solution that monitors the cluster).
But can we also avoid this ?
Yes of course ! In fact this is not a MySQL issue per se, but it is systemd that restarts the
mysqld process. This is the default behavior.
Let’s see how to change this and how it acts:
As you could notice, once we have configured systemd to not restart
mysqld on failure, it works as expected.
Enjoy MySQL InnoDB Cluster and don’t forget to register to Oracle Open World if you want to learn more about MySQL 8.0 and InnoDB Cluster !
If you set
restart=no for systemd, you have a safer environment, however you won’t be able to use the
RESTART command from MySQL 8.0. It will act as
SHUTDOWN as systemd won’t allow a restart of the process.