CASSANDRA-21397: AbstractTypeGenerator was creating UDT with the same name, due to lack of dedup cross generator boundaries#4836
Conversation
… 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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
maedhroz
left a comment
There was a problem hiding this comment.
LGTM
I don't know if there are any other places that need to call AbstractTypeGenerators.overrideUDTKeyspace(ks) now to avoid a similar problem...
No description provided.