通過CQL創建了若干表格,比如:
CREATE TABLE fileindex(recid Varchar,agentno Varchar,customerno Varchar,recfile Varchar,createtime Varchar, PRIMARY KEY(recid)); CREATE INDEX ON fileindex(agentno); CREATE INDEX ON fileindex(customerno); CREATE INDEX ON fileindex(recfile); CREATE INDEX ON fileindex(createtime);
&HTTP://www.aliyun.com/zixun/aggregation/37954.html">nbsp;然後再表中插入若干資料,運行了一段時間後,重啟Cassandra,報了下面的錯:
java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.nio.ByteBufferat org.apache.cassandra.db.marshal.UTF8Type.compare(UTF8Type.java:27)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 :328)at java.util.TreeMap.containsKey(TreeMap.java:209)at java.util.TreeSet.contains(TreeSet.java:217)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:441)at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)at java.util.concurrent.FutureTask.run(FutureTask.java:138)at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java :908)at java.lang.Thread.run(Thread.java:662)java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.nio.ByteBufferat org.apache.cassandra.db.marshal.UTF8Type.compare(UTF8Type.java:27)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)
找了半天,終於找到答案,原來是Cassandra1.1.1的一個bug(將在Cassandra1.1.2中修復)。
HTTPs://issues.apache.org/jira/browse/CASSANDRA-4331
解決方法就是刪除saved_caches_directory資料夾中的檔,預設位置是/var/lib/cassandra/saved_caches
然後再重啟就沒問題了