client怎么知道zookeeper在事务中落后了?

How client knows zookeeper is lagging behind in transaction?

任何人都可以告诉我在以下情况下会发生什么

现在会发生什么,是 s3 会抛出 node not found 错误还是其他任何事情?

只有当服务器以 [​​=22=] 模式启动并且客户端请求 read-only 模式支持时,分区后客户端才能保持与仲裁之外的服务器的连接连接。在您的示例中,在默认模式下,客户端将与 s3 断开连接,因为 s3 和 s4 将无法形成法定人数,并将停止为来自客户端的请求提供服务。

然而,在read-only模式下,客户端可以从s3读取(但不能写入)数据。然而,它读取的数据可能已经过时。参见 official doc

来自zk官方文档

Read Only Mode Server (Java system property: readonlymode.enabled)

New in 3.4.0: Setting this value to true enables Read Only Mode server support (disabled by default). ROM allows clients sessions which requested ROM support to connect to the server even when the server might be partitioned from the quorum. In this mode ROM clients can still read values from the ZK service, but will be unable to write values and see changes from other clients. See ZOOKEEPER-784 for more details.

如果您的客户端使用了包含整体中所有服务器的连接字符串,它将能够重新连接到新形成的仲裁中的其中一台服务器,并且能够读取上次成功写入。但另一方面,如果您只直接连接到 s3,那么您要么断开连接,要么能够读取可能过时的数据,具体取决于 read-only 模式是否启用。

在您的示例中,连接到 s3 的客户端更改了状态并获得了成功确认,它也将能够读取相同的内容并且不会获得 NoNodeException