EventStore.JVM
EventStore.JVM copied to clipboard
Connecting to cluster with requireMaster=false always connects to Master
I'm trying to connect to a 3 node cluster, with requireMaster=false, but still all connections seem to be made to the Leader node.
Trying to undersand the code, it seems to me that this part will always select the Leader node if it's available, because the ordering in MemerInfo.state has Leader > Follower
final case class ClusterInfo(serverAddress: InetSocketAddress, members: List[MemberInfo]) {
lazy val bestNode: Option[MemberInfo] = {
val xs = members.filter { x => x.isAlive && x.state.isAllowedToConnect }
if (xs.isEmpty) None else Some(xs.maxBy(_.state))
}
}
we are using eventstore client 7.3.0 and eventstore 5.0.8
I believe that requireMaster is sent on each request to EventStoreDB(s) - bestNode prefers the leader node regardless of requireMaster - Perhaps @t3hnar can elaborate a bit on that decision.
RequireMaster=true means that the specific request must be performed on such node
RequireMaster=false means that the specific request may be performed on any node. It does not mean "not on master"