Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Connecting to cluster with requireMaster=false always connects to Master #166

Open
mortenaa opened this issue Jan 14, 2021 · 2 comments
Open

Comments

@mortenaa
Copy link

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

@ahjohannessen
Copy link
Contributor

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.

@ylorph
Copy link
Contributor

ylorph commented Jan 29, 2024

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"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants