joao-r-reis commented on code in PR #1915:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1915#discussion_r2459955057
##########
session.go:
##########
@@ -199,6 +186,20 @@ func NewSession(cfg ClusterConfig) (*Session, error) {
}
s.connCfg = connCfg
+ if cfg.PoolConfig.HostSelectionPolicy == nil {
+ cfg.PoolConfig.HostSelectionPolicy = RoundRobinHostPolicy()
+ }
+ s.pool = cfg.PoolConfig.buildPool(s)
+ s.policy = cfg.PoolConfig.HostSelectionPolicy
+
+ // set the executor here in case the policy needs to execute queries in
Init
Review Comment:
Allowing queries to be executed before the session is even initialized is so
confusing to me, the session doesn't even have a control connection until it is
initialized. I understand the motivation behind letting policies query
something in the DB to initialize but I feel like if such use case does exist
it should be better to add a new method to the policy called `OnSessionInit` or
something that will be called by the session after its initialization has
completed. However adding a new method to the interface is a breaking change so
we'd have to add a new interface and type check if the policy implements the
new interface
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]