cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefania (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-12815) cqlsh may throw AttributeError due to no table metadata
Date Mon, 24 Oct 2016 07:31:58 GMT

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

Stefania commented on CASSANDRA-12815:
--------------------------------------

Thank you for the review. 

bq. Any special reason why you're using {{self.conn.metadata.keyspaces.get(ks_name, None)}}
instead of {{self.conn.metadata.keyspaces\[ks_name\]}}?

Yes, the latter will throw an exception if {{ks_name}} is {{None}}, since {{self.conn.metadata.keyspaces}}
contains no value mapped to {{None}}.

> cqlsh may throw AttributeError due to no table metadata
> -------------------------------------------------------
>
>                 Key: CASSANDRA-12815
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12815
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>            Reporter: Stefania
>            Assignee: Stefania
>             Fix For: 3.10
>
>
> Since CASSANDRA-11534 there is a potential bug in this code:
> {code}
>     if result.column_types:
>             ks_meta = self.conn.metadata.keyspaces[table_meta.keyspace_name]
>             cql_types = [CqlType(cql_typename(t), ks_meta) for t in result.column_types]
> {code}
> It cannot be reproduced with any of our tests but there is a code path that could cause
{{table_meta}} to be {{None}} when the statement cannot be parsed. Given that the code before
11534 used to check on {{table_meta}} not being {{None}}, I prefer to put back the same check
in order to avoid any possible regressions once 3.10 is released. Also, since we check in
all other places, this helps with consistency too.
> The only reason we need the table metadata in that code block is to get the keyspace
name. We should fallback to the current keyspace name if we have no table metadata.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message