You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Олег Краюшкин <al...@gmail.com> on 2016/09/09 11:50:34 UTC

Duplicate fields in cassandra type

Hi Everyone,

have a nice day and let me ask for your help.

I'm using Cassandra 2.2.7. Since yesterday I'm getting the exception while
connecting to the cluster via java driver (I'm using v3.0.3 ):

[main] ERROR c.datastax.driver.core.SchemaParser - Error parsing
schema from Cassandra system tables: the schema in
Cluster#getMetadata() will appear incomplete or stale
java.lang.IllegalArgumentException: Multiple entries with same key:
type=[I@c86b9e3 and type=[I@10aa41f2
    at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:136)
~[guava-19.0.jar:na]
    at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:98)
~[guava-19.0.jar:na]
    at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:84)
~[guava-19.0.jar:na]
    at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:295)
~[guava-19.0.jar:na]
    at com.datastax.driver.core.UserType.<init>(UserType.java:62)
~[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.UserType.build(UserType.java:85)
~[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.SchemaParser.buildUserTypes(SchemaParser.java:196)
~[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.SchemaParser.buildKeyspaces(SchemaParser.java:127)
~[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.SchemaParser.refresh(SchemaParser.java:64)
~[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:337)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:277)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:201)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1424)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.Cluster.init(Cluster.java:163)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:334)
[cassandra-driver-core-3.0.3.jar:na]
    at com.datastax.driver.core.Cluster.connect(Cluster.java:284)
[cassandra-driver-core-3.0.3.jar:na]

I discovered, that problem is related with some of my User Defined Types.
For example, I had UDF comment with the definition:

CREATE TYPE ks.comment (
    id int,
    from_id int,
    date bigint,
    text text,
    attachments frozen<list<frozen<attachment_container>>>
)

but now when I'm querying through cqlsh with DESC TYPE ks.comment, I can
see that all fields got duplicated:

CREATE TYPE veil.comment (
    id int,
    from_id int,
    date bigint,
    text text,
    likes frozen<likes>,
    id int,
    from_id int,
    date bigint,
    text text,
    likes frozen<likes>
)

Some of my other observations:

   - data seems fine. SELECT comments FROM post through cqlsh gives data
   without duplicates or empty space for duplicate fields.
   - only those UDT's got messy, which contains other UDT's as a field
   (field likes in the example above).


*First question:* how is that even possible? If you try to create such
type, you'll get an error like Duplicate field name .. in type ...

*Second question:* what are the possible ways to handle this? Can I just
ALTER these types to their initial definitions without risk of data loss?


Thanks a lot for your time, any suggestion would be appreciated.

P.S. Also, excuse me please for poor grammar and possible mistakes
with appealing to mailing list -- I'm quite new to this.