-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adrian Cole
committed
Dec 31, 2018
1 parent
b086167
commit 55aecc9
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
zipkin-storage/cassandra/src/test/resources/zipkin2-schema-indexes-original.cql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
ALTER TABLE zipkin2.span ADD l_service text; | ||
ALTER TABLE zipkin2.span ADD annotation_query text; //-- can't do SASI on set<text>: ░-joined until CASSANDRA-11182 | ||
|
||
CREATE TABLE IF NOT EXISTS zipkin2.trace_by_service_span ( | ||
service text, //-- service name | ||
span text, //-- span name, or blank for queries without span name | ||
bucket int, //-- time bucket, calculated as ts/interval (in microseconds), for some pre-configured interval like 1 day. | ||
ts timeuuid, //-- start timestamp of the span, truncated to millisecond precision | ||
trace_id text, //-- trace ID | ||
duration bigint, //-- span duration, in milliseconds | ||
PRIMARY KEY ((service, span, bucket), ts) | ||
) | ||
WITH CLUSTERING ORDER BY (ts DESC) | ||
AND compaction = {'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'} | ||
AND default_time_to_live = 259200 | ||
AND gc_grace_seconds = 3600 | ||
AND read_repair_chance = 0 | ||
AND dclocal_read_repair_chance = 0 | ||
AND speculative_retry = '95percentile' | ||
AND comment = 'Secondary table for looking up a trace by a service, or service and span. span column may be blank (when only looking up by service). bucket column adds time bucketing to the partition key, values are microseconds rounded to a pre-configured interval (typically one day). ts column is start timestamp of the span as time-uuid, truncated to millisecond precision. duration column is span duration, rounded up to tens of milliseconds (or hundredths of seconds)'; | ||
|
||
CREATE TABLE IF NOT EXISTS zipkin2.span_by_service ( | ||
service text, | ||
span text, | ||
PRIMARY KEY (service, span) | ||
) | ||
WITH compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'unchecked_tombstone_compaction': 'true', 'tombstone_threshold': '0.2'} | ||
AND caching = {'rows_per_partition': 'ALL'} | ||
AND default_time_to_live = 259200 | ||
AND gc_grace_seconds = 3600 | ||
AND read_repair_chance = 0 | ||
AND dclocal_read_repair_chance = 0 | ||
AND speculative_retry = '95percentile' | ||
AND comment = 'Secondary table for looking up span names by a service name.'; | ||
|
||
DROP INDEX IF EXISTS zipkin2.span_annotation_query_idx; | ||
|
||
CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin2.span (annotation_query) USING 'org.apache.cassandra.index.sasi.SASIIndex' | ||
WITH OPTIONS = { | ||
'mode': 'PREFIX', | ||
'analyzed': 'true', | ||
'analyzer_class':'org.apache.cassandra.index.sasi.analyzer.DelimiterAnalyzer', | ||
'delimiter': '░'}; | ||
|
||
CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin2.span (l_service) USING 'org.apache.cassandra.index.sasi.SASIIndex' | ||
WITH OPTIONS = {'mode': 'PREFIX'}; | ||
|
||
CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin2.trace_by_service_span (duration) USING 'org.apache.cassandra.index.sasi.SASIIndex' | ||
WITH OPTIONS = {'mode': 'PREFIX'}; |