#4752·jedis

JedisSentinelPool 在切换后将连接分配给降级的主机

作者: insaf021创建于 2026年9月26日更新于 2026年9月26日
  1. A Jedis is borrowed from a JedisSentinelPool and is still checked out while Sentinel fails over. initMaster only clears idle instances, as its own comment notes.
  2. The holder calls close(). The instance goes back to the idle pool with its socket still connected to the demoted node.
  3. The next getResource() returns that instance. Writes on it get READONLY once the old node has been reconfigured, or, while it is partitioned and still writable, land on a node Sentinel will resync and wipe; reads return stale data. READONLY is a JedisDataException, so the connection is not marked broken and keeps being reused.