Group Replication provides the ability to specify the failover
guarantees (eventual or “read your writes”) if a
primary failover happens in single-primary mode (see
Configuring Transaction Consistency Guarantees).
You can configure the failover guarantees of an InnoDB Cluster
at creation by passing the consistency
option
While the fencing mechanism is in place, applications
effectively do not see time going backward for a short period of
time while any backlog is applied. This ensures that
applications do not read stale information from the newly
elected primary.
The consistency
option is only supported if
the target MySQL server version is 8.0.14 or later, and
instances added to a cluster which has been configured with the
consistency
option are automatically
configured to have
group_replication_consistency
the same on all cluster members that have support for the
option. The variable default value is controlled by Group
Replication and is EVENTUAL
, change the
consistency
option to
BEFORE_ON_PRIMARY_FAILOVER
to enable the
fencing mechanism. Alternatively use
consistency=0
for EVENTUAL
and consistency=1
for
BEFORE_ON_PRIMARY_FAILOVER
.
Using the consistency
option on a
multi-primary InnoDB Cluster has no effect but is allowed
because the cluster can later be changed into single-primary
mode with the
operation.
Cluster
.switchToSinglePrimaryMode()