当在 Group Replication 组成员之间发送异常大的消息时,可能会导致一些组成员被报告为失败并从组中移除。这是因为 Group Replication 的组通信引擎(XCom,一种 Paxos 变体)使用的单线程被占用处理消息的时间过长,因此一些组成员可能会将接收方报告为失败。默认情况下,大消息会自动拆分为多个片段,分别发送,并由接收方重新组装。When an abnormally large message is sent between Group Replication group members, it can result in some group members being reported as failed and expelled from the group. This is because the single thread used by Group Replication's group communication engine (XCom, a Paxos variant) is occupied processing the message for too long, so some of the group members might report the receiver as failed. By default, large messages are automatically split into fragments that are sent separately and reassembled by the recipients.
系统变量 group_replication_communication_max_message_size 指定了 Group Replication 通信的最大消息大小,超过该大小的消息将被分片。默认的最大消息大小是 10485760 字节(10 MiB)。允许的最大值与系统变量 replica_max_allowed_packet 的最大值相同(1 GB)。group_replication_communication_max_message_size 必须小于 replica_max_allowed_packet,因为应用线程无法处理大于允许的最大数据包大小的消息碎片。要关闭分片,请为 group_replication_communication_max_message_size 指定零值。The system variable
group_replication_communication_max_message_size
specifies a maximum message size for Group Replication
communications, above which messages are fragmented. The default
maximum message size is 10485760 bytes (10 MiB). The greatest
permitted value is the same as the maximum value of the
replica_max_allowed_packet system
variable (1 GB).
group_replication_communication_max_message_size
must be less than
replica_max_allowed_packet
because the applier thread cannot handle message fragments larger
than the maximum permitted packet size. To switch off
fragmentation, specify a zero value for
group_replication_communication_max_message_size.
与大多数其他组复制系统变量一样,必须重新启动组复制插件才能使更改生效。例如:As with most other Group Replication system variables, you must restart the Group Replication plugin for the change to take effect. For example:
STOP GROUP_REPLICATION; SET GLOBAL group_replication_communication_max_message_size= 5242880; START GROUP_REPLICATION;
当所有组成员都已接收并重新组装消息的所有碎片时,分段消息的传递被认为已完成。分段消息的头部包含信息,使在消息传输过程中加入的新成员能够恢复在其加入之前发送的早期碎片。如果新加入的成员未能恢复这些碎片,它将自动退出组。Message delivery for a fragmented message is considered complete when all the fragments of the message have been received and reassembled by all the group members. Fragmented messages include information in their headers that enables a member joining during message transmission to recover the earlier fragments that were sent before it joined. If the joining member fails to recover the fragments, it expels itself from the group.
组复制使用的通信协议版本必须允许分片。您可以使用 group_replication_get_communication_protocol() 获取组正在使用的通信协议,该函数会返回组支持的最旧 MySQL 服务器版本。如有必要,可使用 group_replication_set_communication_protocol() 将通信协议版本设置为足够高(8.0.16 或更高)以允许分片。有关更多信息,请参阅 第 20.5.1.4 节,“设置组的通信协议版本”。The Group Replication communication protocol version in use by the
group must allow fragmentation. You can obtain the communication
protocol in use by a group using
group_replication_get_communication_protocol(),
which returns the oldest MySQL Server version that the group
supports. If necessary, use
group_replication_set_communication_protocol()
to set the communication protocol version high enough (8.0.16 or
above) to allow fragmentation. For more information, see
Section 20.5.1.4, “Setting a Group's Communication Protocol Version”.
如果一个复制组由于某些成员不支持分片而无法使用分片,则可以使用系统变量 group_replication_transaction_size_limit 来限制组接受的事务的最大大小。超出此大小的事务将被回滚。您还可以使用 group_replication_member_expel_timeout 来在怀疑某个成员已失败之前,允许额外的时间(最长一小时)将其从组中驱逐。If a replication group cannot use fragmentation because some
members do not support it, the system variable
group_replication_transaction_size_limit
can be used to limit the maximum size of transactions the group
accepts. Transactions above this size are rolled back. You can
also use
group_replication_member_expel_timeout
to allow additional time (up to an hour) before a member under
suspicion of having failed is expelled from the group.