cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-10339) Prevent ALTER TYPE from creating circular references
Date Fri, 18 Sep 2015 07:33:05 GMT


Sylvain Lebresne commented on CASSANDRA-10339:

Looks good, though a few minor nits:
* I'd modify the error message in {{AlterTypeStatement}} to {{"Cannot add field %s of type
%s to type %s as it would create a circular reference"}} (as it's really a field you add,
not a type).
* In the different overriding implementations of {{references}}, I'd maybe replace the {{this.equals(check)}}
by {{super.references(check)}}. Same thing but maybe slightly more idiomatic.
* The test would be a tad more readeable with a small helper function:
public String type(String str)
    return keyspace() + '.' + str;

But with that said, +1 (as in "Feel free to make those trivial change on commit and if you
don't feel like doing one of them, I won't get mad").

> Prevent ALTER TYPE from creating circular references
> ----------------------------------------------------
>                 Key: CASSANDRA-10339
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Olivier Michallat
>            Assignee: Robert Stupp
>            Priority: Minor
>             Fix For: 2.1.x, 2.2.x, 3.0.x
> It's possible to define circular/recursive types using {{ALTER TYPE}}. They won't work
in practice when you try to insert data, but we should detect this earlier and prevent the
type modification.
> Recursive type example (from [JAVA-908|]):
> {code}
> CREATE TYPE node (name text,);
> ALTER TYPE node ADD children frozen<list<node>>;
> {code}
> Circular example (from [Stack overflow|]):
> {code}
> create type ping(pingid int);
> create type pong(pongid int, ping frozen<ping>);
> alter type ping ADD pong frozen<pong>;
> {code}
> Note that, in the circular example, references are properly checked when dropping the
types, so neither type can be dropped.

This message was sent by Atlassian JIRA

View raw message