Skip to content

Add probe option to connect without a responding server - #834

Open
florinutz wants to merge 1 commit into
mainfrom
flo/833/connect-probe
Open

florinutz wants to merge 1 commit into
mainfrom
flo/833/connect-probe

Conversation

@florinutz

@florinutz florinutz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

With this changeset, connect() now takes a probe argument that defaults to True. In this case, the servers are contacted while the connection is created, and ConnectionError is raised when none of them responds. This would be what 2.3.0 does.

With probe=False, creating the connection performs no request. lowest_server_version is resolved when something first reads it, and reading it raises ConnectionError while no server responds. A caller that never reads it talks to the cluster on the first statement, as before 2.3.0.

This gives callers (that talk to a cluster which is starting or shutting down) a way back. crate's blackbox tests pinned crate<2.3 for that reason in crate/crate#20233, and CI service containers have the same race. So these callers would pass probe=False to every connect() that causes troubles, and this would just use the previous behavior instead of the one introduced in 2.3.0.

Closes #833.

@florinutz florinutz self-assigned this Sep 18, 2026
@florinutz
florinutz force-pushed the flo/833/connect-probe branch from 29478db to ec23054 Compare September 18, 2026 11:44
Version detection moves to first read, so an early connection works again.
@florinutz
florinutz force-pushed the flo/833/connect-probe branch from ec23054 to 7470717 Compare September 18, 2026 12:48
@florinutz
florinutz marked this pull request as ready for review September 18, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow connect() (again) while the server is not responding

1 participant