Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Primary key on tags table needs to extends PK on metrics (#32)
Browse files Browse the repository at this point in the history
* Primary key on tags table needs to extend PK on metrics

* Modifying order of columns in primary index

* Incrementing version number
  • Loading branch information
iwankgb authored Jun 13, 2017
1 parent b979cb3 commit 6241566
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CREATE TABLE snap.metrics (
boolVal boolean,
strVal text,
tags map<text,text>,
PRIMARY KEY ((ns, ver, host), time)
PRIMARY KEY ((ns, ver, host), time))
) WITH CLUSTERING ORDER BY (time DESC);
```

Expand All @@ -92,7 +92,7 @@ CREATE TABLE snap.tags (
strVal text,
boolVal boolean,
tags map<text,text>,
PRIMARY KEY ((key, val), time),
PRIMARY KEY ((key, val), time, ns, ver, host))
) WITH CLUSTERING ORDER BY (time DESC);
```

Expand Down
2 changes: 1 addition & 1 deletion cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

const (
name = "cassandra"
version = 6
version = 7
pluginType = plugin.PublisherPluginType

caPathRuleKey = "caPath"
Expand Down
4 changes: 2 additions & 2 deletions cassandra/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
ErrInvalidDataType = errors.New("Invalid data type value found - %v")

createKeyspaceCQL = "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};"
createTableCQL = "CREATE TABLE IF NOT EXISTS %s.%s (ns text, ver int, host text, time timestamp, valType text, doubleVal double, strVal text, boolVal boolean, tags map<text,text>, PRIMARY KEY ((ns, ver, host), time),) WITH CLUSTERING ORDER BY (time DESC);"
createTagTableCQL = "CREATE TABLE IF NOT EXISTS %s.tags (key text, val text, time timestamp, ns text, ver int, host text, valType text, doubleVal double, strVal text, boolVal boolean, tags map<text,text>, PRIMARY KEY ((key, val), time),) WITH CLUSTERING ORDER BY (time DESC);"
createTableCQL = "CREATE TABLE IF NOT EXISTS %s.%s (ns text, ver int, host text, time timestamp, valType text, doubleVal double, strVal text, boolVal boolean, tags map<text,text>, PRIMARY KEY ((ns, ver, host), time)) WITH CLUSTERING ORDER BY (time DESC);"
createTagTableCQL = "CREATE TABLE IF NOT EXISTS %s.tags (key text, val text, time timestamp, ns text, ver int, host text, valType text, doubleVal double, strVal text, boolVal boolean, tags map<text,text>, PRIMARY KEY ((key, val), time, ns, ver, host)) WITH CLUSTERING ORDER BY (time DESC);"
insertMetricsCQL = `INSERT INTO %s.%s (ns, ver, host, time, valtype, %s, tags) VALUES (?, ?, ?, ? ,?, ?, ?)`
insertTagsCQL = `INSERT INTO %s.tags (key, val, time, ns, ver, host, valtype, %s, tags) VALUES (?, ?, ?, ? ,?, ?, ?, ?, ?)`
)
Expand Down
4 changes: 2 additions & 2 deletions docs/TABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS snap.metrics (
strVal text,
boolVal boolean,
tags map<text,text>,
PRIMARY KEY ((ns, ver, host), time),
PRIMARY KEY ((ns, ver, host), time))
) WITH CLUSTERING ORDER BY (time DESC);
```

Expand Down Expand Up @@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS snap.tags (
strVal text,
boolVal boolean,
tags map<text,text>,
PRIMARY KEY ((key, val), time),
PRIMARY KEY ((key, val), time, ns, ver, host))
) WITH CLUSTERING ORDER BY (time DESC);
```

Expand Down

0 comments on commit 6241566

Please sign in to comment.