-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for Cassandra reconnect interval #934
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,24 +26,25 @@ import ( | |
|
||
const ( | ||
// session settings | ||
suffixEnabled = ".enabled" | ||
suffixConnPerHost = ".connections-per-host" | ||
suffixMaxRetryAttempts = ".max-retry-attempts" | ||
suffixTimeout = ".timeout" | ||
suffixServers = ".servers" | ||
suffixPort = ".port" | ||
suffixKeyspace = ".keyspace" | ||
suffixConsistency = ".consistency" | ||
suffixProtoVer = ".proto-version" | ||
suffixSocketKeepAlive = ".socket-keep-alive" | ||
suffixUsername = ".username" | ||
suffixPassword = ".password" | ||
suffixTLS = ".tls" | ||
suffixCert = ".tls.cert" | ||
suffixKey = ".tls.key" | ||
suffixCA = ".tls.ca" | ||
suffixServerName = ".tls.server-name" | ||
suffixVerifyHost = ".tls.verify-host" | ||
suffixEnabled = ".enabled" | ||
suffixConnPerHost = ".connections-per-host" | ||
suffixMaxRetryAttempts = ".max-retry-attempts" | ||
suffixTimeout = ".timeout" | ||
suffixReconnectInterval = ".reconnect-interval" | ||
suffixServers = ".servers" | ||
suffixPort = ".port" | ||
suffixKeyspace = ".keyspace" | ||
suffixConsistency = ".consistency" | ||
suffixProtoVer = ".proto-version" | ||
suffixSocketKeepAlive = ".socket-keep-alive" | ||
suffixUsername = ".username" | ||
suffixPassword = ".password" | ||
suffixTLS = ".tls" | ||
suffixCert = ".tls.cert" | ||
suffixKey = ".tls.key" | ||
suffixCA = ".tls.ca" | ||
suffixServerName = ".tls.server-name" | ||
suffixVerifyHost = ".tls.verify-host" | ||
|
||
// common storage settings | ||
suffixSpanStoreWriteCacheTTL = ".span-store-write-cache-ttl" | ||
|
@@ -83,6 +84,7 @@ func NewOptions(primaryNamespace string, otherNamespaces ...string) *Options { | |
Keyspace: "jaeger_v1_test", | ||
ProtoVersion: 4, | ||
ConnectionsPerHost: 2, | ||
ReconnectInterval: 60 * time.Second, | ||
}, | ||
servers: "127.0.0.1", | ||
namespace: primaryNamespace, | ||
|
@@ -130,6 +132,10 @@ func addFlags(flagSet *flag.FlagSet, nsConfig *namespaceConfig) { | |
nsConfig.namespace+suffixTimeout, | ||
nsConfig.Timeout, | ||
"Timeout used for queries") | ||
flagSet.Duration( | ||
nsConfig.namespace+suffixReconnectInterval, | ||
nsConfig.ReconnectInterval, | ||
"Reconnect interval to retry connecting to downed hosts") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: what would be the behavior if this is set to 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current (master) jaeger behavior is equivalent to setting to 0. If hosts are marked as down, gocql will not try to reconnect without this set. |
||
flagSet.String( | ||
nsConfig.namespace+suffixServers, | ||
nsConfig.servers, | ||
|
@@ -204,6 +210,7 @@ func (cfg *namespaceConfig) initFromViper(v *viper.Viper) { | |
cfg.ConnectionsPerHost = v.GetInt(cfg.namespace + suffixConnPerHost) | ||
cfg.MaxRetryAttempts = v.GetInt(cfg.namespace + suffixMaxRetryAttempts) | ||
cfg.Timeout = v.GetDuration(cfg.namespace + suffixTimeout) | ||
cfg.ReconnectInterval = v.GetDuration(cfg.namespace + suffixReconnectInterval) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a test |
||
cfg.servers = v.GetString(cfg.namespace + suffixServers) | ||
cfg.Port = v.GetInt(cfg.namespace + suffixPort) | ||
cfg.Keyspace = v.GetString(cfg.namespace + suffixKeyspace) | ||
|
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.
I'm not convinced that the minimum of 500ns is a good value. Could you elaborate on how this was chosen?
(I think we need to revisit the
Timeout
as well separately)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.
I'm not sure that I really understand the
validate:"min=500"
section. It seems that it wasn't actually enforced in my tests. (As in, I would not pass any value, resulting in 0, which is less than 500 and it would pass validation. Unless that's a special case?)I copied
Timeout
value for this.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.
Hmmm, it looks like these validations would only be applied if this configuration file was validated with something like https://github.com/go-validator/validator
I'll make a separate ticket to address this