yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.66k stars 1.04k forks source link

Jaeger support: UDT field types cannot be (un-frozen) collections #5911

Open sergeyshaykhullin opened 3 years ago

sergeyshaykhullin commented 3 years ago

Jira Link: DB-2417 I tried to use YugabyteDB as a Cassandra backend for Jaeger

Steps to install jaeger helm chart: https://github.com/jaegertracing/helm-charts/tree/master/charts/jaeger

Used values.yaml

storage:
  type: cassandra
  cassandra:
    host: {{ cassandra.host }}
    port: 9042
    user: {{ cassandra.username }}
    password: {{ cassandra.password }}
    keyspace: {{ cassandra.database }}
    tls:
      enabled: false

provisionDataStore:
  cassandra: false

Getting:

system_schema  system_auth  jaeger  system

Generating the schema for the keyspace jaeger and datacenter dc1
Using template file /cassandra-schema/v003.cql.tmpl with parameters:
    mode = test
    datacenter = dc1
    keyspace = jaeger
    replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
    trace_ttl = 172800
    dependencies_ttl = 0
<stdin>:13:SyntaxException: Invalid SQL Statement. syntax error, unexpected ')'
CREATE TYPE IF NOT EXISTS jaeger.keyvalue (
    key             text,
    value_type      text,
    value_string    text,
    value_bool      boolean,
    value_long      bigint,
    value_double    double,
    value_binary    blob,
                     ^^^^
);
^
 (ql error -11)
<stdin>:18:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TYPE IF NOT EXISTS jaeger.log (
    ts      bigint, // microseconds since epoch
               ^^^
    fields  list<frozen<keyvalue>>,
);
 (ql error -11)
<stdin>:24:SyntaxException: Invalid SQL Statement. syntax error, unexpected ')'
CREATE TYPE IF NOT EXISTS jaeger.span_ref (
    ref_type        text,
    trace_id        blob,
    span_id         bigint,
                       ^^^^
);
^
 (ql error -11)
<stdin>:29:SyntaxException: Invalid SQL Statement. syntax error, unexpected ')'
CREATE TYPE IF NOT EXISTS jaeger.process (
    service_name    text,
    tags            list<frozen<keyvalue>>,
                                       ^^^^
);
^
 (ql error -11)
<stdin>:54:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TABLE IF NOT EXISTS jaeger.traces (
    trace_id        blob,
    span_id         bigint,
    span_hash       bigint,
    parent_id       bigint,
    operation_name  text,
    flags           int,
    start_time      bigint, // microseconds since epoch
                       ^^^
    duration        bigint, // microseconds
    tags            list<frozen<keyvalue>>,
    logs            list<frozen<log>>,
    refs            list<frozen<span_ref>>,
    process         frozen<process>,
    PRIMARY KEY (trace_id, span_id, span_hash)
)
    WITH compaction = {
        'compaction_window_size': '1',
        'compaction_window_unit': 'HOURS',
        'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'
    }
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 172800
    AND speculative_retry = 'NONE'
    AND gc_grace_seconds = 10800;
 (ql error -11)
<stdin>:101:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TABLE IF NOT EXISTS jaeger.service_operation_index (
    service_name        text,
    operation_name      text,
    start_time          bigint, // microseconds since epoch
                           ^^^
    trace_id            blob,
    PRIMARY KEY ((service_name, operation_name), start_time)
) WITH CLUSTERING ORDER BY (start_time DESC)
    AND compaction = {
        'compaction_window_size': '1',
        'compaction_window_unit': 'HOURS',
        'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'
    }
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 172800
    AND speculative_retry = 'NONE'
    AND gc_grace_seconds = 10800;
 (ql error -11)
<stdin>:118:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TABLE IF NOT EXISTS jaeger.service_name_index (
    service_name      text,
    bucket            int,
    start_time        bigint, // microseconds since epoch
                         ^^^
    trace_id          blob,
    PRIMARY KEY ((service_name, bucket), start_time)
) WITH CLUSTERING ORDER BY (start_time DESC)
    AND compaction = {
        'compaction_window_size': '1',
        'compaction_window_unit': 'HOURS',
        'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'
    }
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 172800
    AND speculative_retry = 'NONE'
    AND gc_grace_seconds = 10800;
 (ql error -11)
<stdin>:137:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TABLE IF NOT EXISTS jaeger.duration_index (
    service_name    text,      // service name
                     ^^^^
    operation_name  text,      // operation name, or blank for queries without span name
    bucket          timestamp, // time bucket, - the start_time of the given span rounded to an hour
    duration        bigint,    // span duration, in microseconds
    start_time      bigint,    // microseconds since epoch
    trace_id        blob,
    PRIMARY KEY ((service_name, operation_name, bucket), duration, start_time, trace_id)
) WITH CLUSTERING ORDER BY (duration DESC, start_time DESC)
    AND compaction = {
        'compaction_window_size': '1',
        'compaction_window_unit': 'HOURS',
        'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'
    }
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 172800
    AND speculative_retry = 'NONE'
    AND gc_grace_seconds = 10800;
 (ql error -11)
<stdin>:157:SyntaxException: Invalid SQL Statement. syntax error, unexpected Op
CREATE TABLE IF NOT EXISTS jaeger.tag_index (
    service_name    text,
    tag_key         text,
    tag_value       text,
    start_time      bigint, // microseconds since epoch
                       ^^^
    trace_id        blob,
    span_id         bigint,
    PRIMARY KEY ((service_name, tag_key, tag_value), start_time, trace_id, span_id)
)
    WITH CLUSTERING ORDER BY (start_time DESC)
    AND compaction = {
        'compaction_window_size': '1',
        'compaction_window_unit': 'HOURS',
        'class': 'org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy'
    }
    AND dclocal_read_repair_chance = 0.0
    AND default_time_to_live = 172800
    AND speculative_retry = 'NONE'
    AND gc_grace_seconds = 10800;
 (ql error -11)
<stdin>:164:SyntaxException: Invalid SQL Statement. syntax error, unexpected ')'
CREATE TYPE IF NOT EXISTS jaeger.dependency (
    parent          text,
    child           text,
    call_count      bigint,
    source          text,
                     ^^^^
);
^
 (ql error -11)
<stdin>:177:InvalidRequest: Error from server: code=2200 [Invalid query] message="Type Not Found. Could not find user defined type
CREATE TABLE IF NOT EXISTS jaeger.dependencies_v2 (
    ts_bucket    timestamp,
    ts           timestamp,
    dependencies list<frozen<dependency>>,
                         ^^^^^^^^^^
    PRIMARY KEY (ts_bucket, ts)
) WITH CLUSTERING ORDER BY (ts DESC)
    AND compaction = {
        'min_threshold': '4',
        'max_threshold': '32',
        'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
    }
    AND default_time_to_live = 0;
 (ql error -311)"
ddorian commented 3 years ago

Hi @sergeyshaykhullin

Trying to reproduce I see 2 errors:

  1. We don't support a "," on the last column definition. Example:
create table t(id int primary key,b int,);
SyntaxException: Invalid SQL Statement. syntax error, unexpected ')'
create table t(id int primary key,b int,);
                                        ^
 (ql error -11)
  1. We also don't support UDT field types being (un-frozen) collections
ycqlsh:jaeger> CREATE TYPE IF NOT EXISTS jaeger.log (
          ...     ts      bigint,
          ...               
          ...     fields  list<frozen<keyvalue>>
          ... );
InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid Type Definition. UDT field types cannot be (un-frozen) collections
CREATE TYPE IF NOT EXISTS jaeger.log (
    ts      bigint,
               ^^^^

^^^^^^^^^^^^^^
    fields  list<frozen<keyvalue>>
^^^^^^
);
 (ql error -312)"
ddorian commented 2 years ago

Reopening cause issues aren't fixed yet.