[ https://issues.apache.org/jira/browse/CASSANDRA-14379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16458657#comment-16458657 ]
Aleksey Yeschenko commented on CASSANDRA-14379: ----------------------------------------------- The patch is basically ok, so feel free to commit, +1. I would do it a tiny bit differently myself: - instead of replacing "No columns found for table" with "No column or partition column found for table", I would replace it with "No partition columns found for table" - with correct tense and without redundance, as "partition columns" is essentially a subset of "columns" - replace your changes to {{fetchColumns()}} with {code} private static List<ColumnDefinition> fetchColumns(String keyspace, String table, Types types) { String query = format("SELECT * FROM %s.%s WHERE keyspace_name = ? AND table_name = ?", NAME, COLUMNS); UntypedResultSet columnRows = query(query, keyspace, table); List<ColumnDefinition> columns = new ArrayList<>(); columnRows.forEach(row -> columns.add(createColumnFromRow(row, types))); if (columns.stream().noneMatch(ColumnDefinition::isPartitionKey)) throw new MissingColumns("No partition key columns found in schema table for " + keyspace + "." + table); return columns; } {code} But, again, this is a small patch and is essentially ok enough, so it's up to you how you want to proceed - I'm +1 either way. > Better handling of missing partition columns in system_schema.columns during > startup > ------------------------------------------------------------------------------------ > > Key: CASSANDRA-14379 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14379 > Project: Cassandra > Issue Type: Improvement > Components: Distributed Metadata > Reporter: Jay Zhuang > Assignee: Jay Zhuang > Priority: Major > > Follow up for CASSANDRA-13180, during table deletion/creation, we saw one > table having partially deleted columns (no partition column, only regular > column). It's blocking node from startup: > {noformat} > java.lang.AssertionError: null > at > org.apache.cassandra.db.marshal.CompositeType.getInstance(CompositeType.java:103) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.config.CFMetaData.rebuild(CFMetaData.java:308) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at org.apache.cassandra.config.CFMetaData.<init>(CFMetaData.java:288) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at org.apache.cassandra.config.CFMetaData.create(CFMetaData.java:363) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.schema.SchemaKeyspace.fetchTable(SchemaKeyspace.java:1028) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.schema.SchemaKeyspace.fetchTables(SchemaKeyspace.java:987) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:945) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesWithout(SchemaKeyspace.java:922) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.schema.SchemaKeyspace.fetchNonSystemKeyspaces(SchemaKeyspace.java:910) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:138) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at org.apache.cassandra.config.Schema.loadFromDisk(Schema.java:128) > ~[apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:241) > [apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:567) > [apache-cassandra-3.0.14.x.jar:3.0.14.x] > at > org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:695) > [apache-cassandra-3.0.14.x.jar:3.0.14.x] > {noformat} > As partition column is mandatory, it should throw > [{{MissingColumns}}|https://github.com/apache/cassandra/blob/60563f4e8910fb59af141fd24f1fc1f98f34f705/src/java/org/apache/cassandra/schema/SchemaKeyspace.java#L1351], > the same as CASSANDRA-13180, so the user is able to cleanup the schema. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org