diff --git a/zipkin-storage/cassandra/src/test/resources/zipkin2-schema-indexes-original.cql b/zipkin-storage/cassandra/src/test/resources/zipkin2-schema-indexes-original.cql new file mode 100644 index 00000000000..1d31d56314e --- /dev/null +++ b/zipkin-storage/cassandra/src/test/resources/zipkin2-schema-indexes-original.cql @@ -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: ░-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'};