Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
update cassandra-create var descriptions, fix attempt loop threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlisi authored and Dieterbe committed Sep 5, 2017
1 parent ac401e7 commit fa88502
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions idx/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func ConfigSetup() *flag.FlagSet {
casIdx.DurationVar(&maxStale, "max-stale", 0, "clear series from the index if they have not been seen for this much time.")
casIdx.DurationVar(&pruneInterval, "prune-interval", time.Hour*3, "Interval at which the index should be checked for stale series.")
casIdx.IntVar(&protoVer, "protocol-version", 4, "cql protocol version to use")
casIdx.BoolVar(&createKeyspace, "create-keyspace", true, "set to create keyspaces otherwise check to ensure they exist")
casIdx.BoolVar(&createKeyspace, "create-keyspace", true, "enable the creation of the index keyspace and tables, only one node needs this")

casIdx.BoolVar(&ssl, "ssl", false, "enable SSL connection to cassandra")
casIdx.StringVar(&capath, "ca-path", "/etc/metrictank/ca.pem", "cassandra CA certficate path when using SSL")
Expand Down Expand Up @@ -187,7 +187,7 @@ func (c *CasIdx) InitBare() error {
keyspaceMetadata, err = tmpSession.KeyspaceMetadata(keyspace)
if err != nil {
log.Warn("cassandra-idx cassandra keyspace not found. retry attempt: %v", attempt)
if attempt > 5 {
if attempt >= 5 {
return err
}
time.Sleep(5 * time.Second)
Expand All @@ -196,7 +196,7 @@ func (c *CasIdx) InitBare() error {
break
} else {
log.Warn("cassandra-idx cassandra table not found. retry attempt: %v", attempt)
if attempt > 5 {
if attempt >= 5 {
return err
}
time.Sleep(5 * time.Second)
Expand Down
4 changes: 2 additions & 2 deletions mdata/store_cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ func NewCassandraStore(addrs, keyspace, consistency, CaPath, Username, Password,
keyspaceMetadata, err = tmpSession.KeyspaceMetadata(keyspace)
if err != nil {
log.Warn("cassandra keyspace not found; attempt: %v", attempt)
if attempt > 5 {
if attempt >= 5 {
return nil, err
}
time.Sleep(5 * time.Second)
} else {
for _, result := range ttlTables {
if _, ok := keyspaceMetadata.Tables[result.Table]; !ok {
log.Warn("cassandra table %s not found; attempt: %v", result.Table, attempt)
if attempt > 5 {
if attempt >= 5 {
return nil, err
}
time.Sleep(5 * time.Second)
Expand Down
2 changes: 1 addition & 1 deletion metrictank-sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ auth = false
username = cassandra
# password for authentication
password = cassandra
# sets whether to create or check for the cassandra keyspaces
# enable the creation of the index keyspace and tables, only one node needs this
create-keyspace = true

### in-memory only
Expand Down
2 changes: 1 addition & 1 deletion metrictank.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var (
cassandraWindowFactor = flag.Int("cassandra-window-factor", 20, "size of compaction window relative to TTL")
cassandraOmitReadTimeout = flag.Int("cassandra-omit-read-timeout", 60, "if a read is older than this, it will directly be omitted without executing")
cqlProtocolVersion = flag.Int("cql-protocol-version", 4, "cql protocol version to use")
cassandraCreateKeyspace = flag.Bool("cassandra-create-keyspace", true, "enable the creation of the metrictank keyspace")
cassandraCreateKeyspace = flag.Bool("cassandra-create-keyspace", true, "enable the creation of the mdata keyspace and tables, only one node needs this")

cassandraSSL = flag.Bool("cassandra-ssl", false, "enable SSL connection to cassandra")
cassandraCaPath = flag.String("cassandra-ca-path", "/etc/metrictank/ca.pem", "cassandra CA certificate path when using SSL")
Expand Down

0 comments on commit fa88502

Please sign in to comment.