[ 
https://issues.apache.org/jira/browse/CASSANDRA-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972254#action_12972254
 ] 

Jonathan Ellis commented on CASSANDRA-1761:
-------------------------------------------

This will require some re-organization to solve.  Currently, ColumnDefinition 
index_name is just copied from CfDef and may be null; final index name is 
determined by CFMetaData.newIndexMetadata, which has no context as to what 
other indexes exist in the CF.

What we should do is create the final index name at the CassandraServer level, 
and validate at that point that it does not cause conflicts with existing ones. 
 (Also: index_name and index_type fields of CD become final.)

(This lets us return appropriate InvalidRequest exceptions to the client 
instead of failing with an internal error, too.)

Then by the time we get to addIndex/newIndexMetadata, all we need to do is a 
final sanity check as a defense against users violating the 
one-schema-change-at-a-time rule.

> Indexes: Auto-generating the CFname may collide with user-generated names
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-1761
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1761
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.7 beta 3
>            Reporter: Jon Hermes
>            Assignee: Jon Hermes
>            Priority: Minor
>             Fix For: 0.7.1
>
>
> {noformat}column_families:
>   - name: CF
>     comparator: BytesType
>     column_metadata: 
>       - name: foo
>         index_name: 626172
>         index_type: KEYS
>       - name: bar
>         index_type: KEYS{noformat}
> Auto-generated versus user-supplied names collide in the YAML above. The code:
> {code}cfname = parentCf + "." + (info.getIndexName() == null ? 
> FBUtilities.bytesToHex(info.name) : info.getIndexName()){code}
> From the first ColumnDefinition, we create cfname = "CF.626172" (from the 
> fail clause of the ternany, user-supplied name)
> From the second ColumnDefinition, we create cfname = "CF.626172" (from the 
> pass clause of the ternary, we generate the name)
> They're in hex form. This is possible, but fairly unlikely that someone will 
> do this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to