试图在 Cassandra 中实现触发器。
一直在尝试使用可用的 Cassandra 帮助:https ://github.com/hmsonline/cassandra-triggers
但是,当我尝试设置触发器的值并检查日志时,以下是我收到的错误。
DEBUG [Thrift:2] 2013-03-19 15:07:27,753 CassandraServerTriggerAspect.java (line 69) Mutation for [triggers] with consistencyLevel [ONE]
DEBUG [Thrift:2] 2013-03-19 15:08:08,873 ConfigurationStore.java (line 66) Refreshing trigger configuration.
DEBUG [Thrift:2] 2013-03-19 15:08:08,876 ConfigurationStore.java (line 92) Triggers.isCommitLogEnabled? [true]
DEBUG [Thrift:2] 2013-03-19 15:08:08,876 CassandraServerTriggerAspect.java (line 69) Mutation for [world] with consistencyLevel [ONE]
DEBUG [Thrift:2] 2013-03-19 15:08:08,882 LogEntryStore.java (line 84) Host ID: CTSINGMRGTO
DEBUG [Thrift:2] 2013-03-19 15:08:08,882 CassandraStore.java (line 59) Did not create [triggers:CommitLog_CTSINGMRGTO] (probably already there)
INFO [Thrift:2] 2013-03-19 15:08:08,884 CassandraStore.java (line 93) Did not create [triggers:CommitLog_CTSINGMRGTO] (probably already there)
WARN [Thrift:2] 2013-03-19 15:08:08,884 CommitLog.java (line 38) Instantiated commit log [CommitLog_CTSINGMRGTO]
DEBUG [Thrift:2] 2013-03-19 15:08:08,886 TriggerTask.java (line 32) Spawning [20] threads for commit log processing.
DEBUG [Thrift:2] 2013-03-19 15:08:08,890 CommitLog.java (line 41) Started Trigger Task thread.
ERROR [Thrift:2] 2013-03-19 15:08:08,892 CassandraServerTriggerAspect.java (line 61) Could not write to cassandra! Method: org.apache.cassandra.thrift.CassandraServer.doInsert()
java.lang.ClassCastException: java.util.UUID cannot be cast to java.lang.Integer
at com.hmsonline.cassandra.triggers.dao.CommitLog.writePending(CommitLog.java:63)
at com.hmsonline.cassandra.triggers.CassandraServerTriggerAspect.writePending(CassandraServerTriggerAspect.java:72)
at com.hmsonline.cassandra.triggers.CassandraServerTriggerAspect.ajc$inlineAccessMethod$com_hmsonline_cassandra_triggers_CassandraServerTriggerAspect$com_hmsonline_cassandra_triggers_CassandraServerTriggerAspect$writePending(CassandraServerTriggerAspect.java:1)
at com.hmsonline.cassandra.triggers.CassandraServerTriggerAspect.writeToCommitLog(CassandraServerTriggerAspect.java:34)
at org.apache.cassandra.thrift.CassandraServer.doInsert(CassandraServer.java:854)
at org.apache.cassandra.thrift.CassandraServer.internal_insert(CassandraServer.java:624)
at org.apache.cassandra.thrift.CassandraServer.insert(CassandraServer.java:645)
at org.apache.cassandra.thrift.Cassandra$Processor$insert.getResult(Cassandra.java:3526)
at org.apache.cassandra.thrift.Cassandra$Processor$insert.getResult(Cassandra.java:3514)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
WARN [Thread-23] 2013-03-19 15:08:08,895 TriggerTask.java (line 62) Could not execute triggers [null]
ERROR [Thrift:2] 2013-03-19 15:08:08,896 CustomTThreadPoolServer.java (line 217) Error occurred during processing of message.
为了进一步诊断,cassandra-cli中显示的错误是:
org.apache.thrift.transport.TTransportException
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:839)
at org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:823)
at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:975)
at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:218)
at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:210)
at org.apache.cassandra.cli.CliMain.main(CliMain.java:337)