To operate more easily a MySQL Group Replication (InnoDB Cluster), the Group Replication plugins provides some UDFs.
If you have read the recent article from Tiago Vale about the Group Replication Communication Protocol, you may have heard about two new UDFs allowing to get or set the communication protocol.
So what are all the UDFs provided with the Group Replication and what’s their purpose ?
SELECT UDF_NAME FROM performance_schema.user_defined_functions WHERE UDF_NAME LIKE 'group_repl%'; +-------------------------------------------------+ | UDF_NAME | +-------------------------------------------------+ | group_replication_get_communication_protocol | | group_replication_get_write_concurrency | | group_replication_set_as_primary | | group_replication_set_communication_protocol | | group_replication_set_write_concurrency | | group_replication_switch_to_multi_primary_mode | | group_replication_switch_to_single_primary_mode | +-------------------------------------------------+
-
group_replication_get_communication_protocol
This function allows you to inspect Group Replication communication protocol version that is used by a replication group. -
group_replication_get_write_concurrency
Check the maximum number of consensus instances that a group can execute in parallel. This is in fact the value of the event horizon window. -
group_replication_set_as_primary
Defines which member should act as Primary Master in a Single-Primary mode cluster. -
group_replication_set_communication_protocol
Changing GCS protocol version. Currently if can be 5.7.14 or 8.0.16. -
group_replication_set_write_concurrencydefines the maximum number of consensus instances that a group can execute in parallel.
-
group_replication_switch_to_multi_primary_mode
This function allows to switch from Single-Primary mode to Multi-Primary cluster. -
group_replication_switch_to_single_primary_mode
This one, allows to switch from Multi-Primary back to Single-Primary mode cluster. The UDF allows no argument or a node’s uuid to control which node will become the Primary-Master.
Some of these UDFs can be called by a cluster
method when using the Shell:
cluster.setPrimaryInstance()
cluster.switchToMultiPrimaryMode()
cluster.switchToSinglePrimaryMode()
In case you mix UDFs managing the topology with the Shell’s method, you might encounter a mismatch that will require a rescan()
: