从“表在模式表中没有任何分区键列”中恢复Cassandra

时间:2018-12-21 02:15:27

标签: cassandra cassandra-3.0

我有一些通过Spark Cassandra连接器创建的表,创建的表似乎处于错误状态,因为无法查询或删除它,但是我可以在其上运行desc并且显示desc tables。但是,其列不会显示在system_schema.columns中。导致以下错误:

cqlsh:ams_staging> desc bcookie_sad_1540577971;

CREATE TABLE ams_staging.bcookie_sad_1540577971 (
    bcookie text PRIMARY KEY,
    sadinfo text
) WITH bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

cqlsh:ams_staging> drop table ams_staging.bcookie_sad_1540577971;
ServerError: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.AssertionError: Table ams_staging.bcookie_sad_1545270474 did not have any partition key columns in the schema tables

完整堆栈跟踪

ERROR [MigrationStage:1] 2018-12-21 01:58:59,386 CassandraDaemon.java:226 - Exception in thread Thread[MigrationStage:1,5,main]
java.lang.AssertionError: Table ams_staging.bcookie_sad_1545270474 did not have any partition key columns in the schema tables
    at org.apache.cassandra.schema.SchemaKeyspace.fetchTable(SchemaKeyspace.java:950) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.schema.SchemaKeyspace.fetchTables(SchemaKeyspace.java:925) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspace(SchemaKeyspace.java:888) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.schema.SchemaKeyspace.fetchKeyspacesOnly(SchemaKeyspace.java:880) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.schema.SchemaKeyspace.mergeSchema(SchemaKeyspace.java:1277) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.schema.SchemaKeyspace.mergeSchemaAndAnnounceVersion(SchemaKeyspace.java:1256) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.service.MigrationManager$1.runMayThrow(MigrationManager.java:534) ~[apache-cassandra-3.9.jar:3.9]
    at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[apache-cassandra-3.9.jar:3.9]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_72]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_72]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_72]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]

相同的错误导致某些节点无法启动。同样,通过Spark Cassandra连接器写入此键空间的任何其他尝试都将失败,并显示相同的错误。尝试截断该表也不起作用。我还尝试过将partition_key列添加到system_schema.columns中,但这也行不通。

我发现https://jira.apache.org/jira/browse/CASSANDRA-13180似乎暗示了恢复的唯一方法是“从备份还原”。有没有一种方法可以简单地删除这些表,或者让Cassandra忘记这些表?

Cassandra 3.9版

1 个答案:

答案 0 :(得分:0)

很遗憾,没有办法恢复。删除键空间是唯一的方法。