Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostFilter Not Used for Control Connection #1724

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

amcrn
Copy link

@amcrn amcrn commented Sep 14, 2023

The HostFilter is not being used for the Control Connection (aka the controlConn). This can be problematic, especially if the host is being filtered due to it being in a bad state, as it can hold up the creation of the Control Connection (and therefore the Session itself) for quite some time.

This also fixes an issue if disableControlConn=true and/or DisableInitialHostLookup=true, where the Ring is updated with the host, prior to filtering:
https://github.com/gocql/gocql/blob/db6d5564dd6843cc08cc1d6c3642612adf94c618/session.go#L265-L268

Closes: #1723

The `HostFilter` is not being used for the Control Connection (aka
the `controlConn`). This can be problematic, especially if the host
is being filtered due to it being in a bad state, as it can hold up
the creation of the Control Connection (and therefore the Session
itself) for quite some time.
// filter hosts at the onset to avoid using using filtered hosts in the control connection while
// discovering the protocol and/or connecting.
if s.cfg.HostFilter != nil {
newHosts := make([]*HostInfo, 0, len(hosts))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can refactor to something like:

newHosts := hosts[:0]

to avoid allocating a new slice, but in general, it is a good suggestion to fix an issue.

@testisnullus
Copy link

LGTM

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

Successfully merging this pull request may close these issues.

HostFilter Not Used for Control Connection
2 participants