EventStore.JVM icon indicating copy to clipboard operation
EventStore.JVM copied to clipboard

Connecting to cluster with requireMaster=false always connects to Master

Open mortenaa opened this issue 4 years ago • 2 comments

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

mortenaa avatar Jan 14 '21 14:01 mortenaa

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.

ahjohannessen avatar Jan 14 '21 14:01 ahjohannessen

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"

ylorph avatar Jan 29 '24 10:01 ylorph