Skip to content

CASSANDRA-21397: AbstractTypeGenerator was creating UDT with the same name, due to lack of dedup cross generator boundaries#4836

Open
dcapwell wants to merge 1 commit into
apache:trunkfrom
dcapwell:CASSANDRA-21397
Open

CASSANDRA-21397: AbstractTypeGenerator was creating UDT with the same name, due to lack of dedup cross generator boundaries#4836
dcapwell wants to merge 1 commit into
apache:trunkfrom
dcapwell:CASSANDRA-21397

Conversation

@dcapwell
Copy link
Copy Markdown
Contributor

No description provided.

… name, due to lack of dedup cross generator boundaries
catch (Throwable t)
{
StringBuilder sb = new StringBuilder();
sb.append("Unable to add type ").append(next.toCqlString(false, false, false));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: In the toString() for BaseState I guess we're not strictly changing the schema...just building a string, but for the most part an error here does seem to mean an error on adding the type to the schema.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is what happened. The JIRA has a error and the message is not helpful

Caused by: java.lang.IllegalStateException: Type java.nio.HeapByteBuffer[pos=0 lim=1 cap=1] already exists
	at org.apache.cassandra.schema.Types.with(Types.java:187)

So my thinking with this is that we can detect it if anything happens and return a more useful error message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spoke in slack, the BaseState comment makes sense now.

BaseState in the ast tests has 2 code paths: createTable which does a schema change, and toString which shows the toString. The toString shouldn't ever throw, but the createTable case can; so that case will get a more useful error message next time

Copy link
Copy Markdown
Contributor

@maedhroz maedhroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I don't know if there are any other places that need to call AbstractTypeGenerators.overrideUDTKeyspace(ks) now to avoid a similar problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants