0

Cassandra 被杀死可能是由于服务器上的内存不足。重新启动后,Cassandra 无法使用 java.lang.ClassCastException 构建 AsciiType 二级索引。这是 cassandra 日志输出:

INFO 16:31:37,109 Creating new index : ColumnDefinition {
     name=666f6c6c6f7754797065,
     validator=org.apache.cassandra.db.marshal.AsciiType, 
     index_type=KEYS, 
     index_name='mySecondaryIndexField'
}

INFO 16:31:37,115 reading saved cache /var/lib/cassandra/saved_caches/MyProject-MyCF.mySecondaryIndexField-KeyCache

INFO 16:31:37,117 Opening /var/lib/cassandra/data/MyProject/MyCF/MyProject-MyCF.mySecondaryIndexField-hd-1 (399 bytes)

ERROR 16:31:37,121 Exception in thread Thread[SSTableBatchOpen:1,5,main]
**java.lang.ClassCastException: [B cannot be cast to java.nio.ByteBuffer**
        at org.apache.cassandra.db.marshal.AsciiType.compare(AsciiType.java:28)
        at org.apache.cassandra.dht.LocalToken.compareTo(LocalToken.java:45)
        at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:89)
        at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:38)
        at java.util.TreeMap.getEntry(TreeMap.java:345)
        at java.util.TreeMap.containsKey(TreeMap.java:226)
        at java.util.TreeSet.contains(TreeSet.java:234)
        at org.apache.cassandra.io.sstable.SSTableReader.load(SSTableReader.java:396)
        at org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:187)
        at org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:225)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:679)

使用此二级索引的查询仅返回一小部分结果集。Cassnadra 然后再次重新启动第二次,没有抛出这个异常,并且二级索引被正确重建,所有查询都已恢复并按预期返回结果。

我的二级索引字段“mySecondaryIndexField”只有 2 个可能的字符串值。

这也是我的列族的配置:

Column Type - Standard
Comparator Type - org.apache.cassandra.db.marshal.AsciiType
Read Repair Chance - 1
Index Options - name: mySecondaryIndexField
        validation_class: org.apache.cassandra.db.marshal.AsciiType
        index_type: 0
        index_name: mySecondaryIndexField
        index_options: 
Gc Grace Seconds - 864000
Default Validation Class - org.apache.cassandra.db.marshal.BytesType
Id - 1023
Min Compaction Threshold - 4
Max Compaction Threshold - 32
Replicate On Write - 1
Key Validation Class - org.apache.cassandra.db.marshal.BytesType
Compaction Strategy - org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
Compaction Strategy Options - None
Sstable Compression -org.apache.cassandra.io.compress.SnappyCompressor
Caching - KEYS_ONLY

有没有人遇到过类似的问题?Cassandra 版本是 1.1.1。

4

0 回答 0