-
Notifications
You must be signed in to change notification settings - Fork 645
HostFilter Not Used for Control Connection #1724
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
base: trunk
Are you sure you want to change the base?
Conversation
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)) |
There was a problem hiding this comment.
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.
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Could you please make it up to date, update CHANGELOG.md, and refactor commit log according to CONTRIBUTING.md, as an example you can check f35d463, or any other last merged PR.
@joao-r-reis, @jameshartig, please check it out.
Unfortunately, I don't think this is the right way for this to be fixed. The problem is that most Right after we connect, we filter the hosts which seems about as good as we can do. cassandra-gocql-driver/session.go Line 247 in bf16ec3
My understanding is that the ring should always contain all hosts in the cluster and that we should only be filtering before adding a host to the pool so I believe this is working as intended. |
There's a separate PR to address the issue with |
The
HostFilter
is not being used for the Control Connection (aka thecontrolConn
). 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/orDisableInitialHostLookup=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