我试图向Cassandra表中添加一个文本列,但在alter操作期间,我的java应用程序中的一些请求失败,错误如下:
Cassandra failure during read query at consistency LOCAL_QUORUM \
(3 responses were required but only 1 replica responded, 2 failed)
我在其中一个节点中找到了此日志:
ERROR [Messaging-EventLoop-3-2] 2022-08-31 14:56:13,486 InboundMessageHandler.java:182 - unexpected exception caught while deserializing a message
java.lang.RuntimeException: Unknown column {} during deserialization
at org.apache.cassandra.db.Columns$Serializer.deserialize(Columns.java:463)
at org.apache.cassandra.db.filter.ColumnFilter$Serializer.deserializeRegularAndStaticColumns(ColumnFilter.java:1072)
at org.apache.cassandra.db.filter.ColumnFilter$Serializer.deserialize(ColumnFilter.java:1021)
at org.apache.cassandra.db.ReadCommand$Serializer.deserialize(ReadCommand.java:928)
at org.apache.cassandra.db.ReadCommand$Serializer.deserialize(ReadCommand.java:833)
at org.apache.cassandra.net.Message$Serializer.deserializePost40(Message.java:782)
at org.apache.cassandra.net.Message$Serializer.deserialize(Message.java:642)
at org.apache.cassandra.net.InboundMessageHandler.processSmallMessage(InboundMessageHandler.java:168)
at org.apache.cassandra.net.InboundMessageHandler.processOneContainedMessage(InboundMessageHandler.java:151)
at org.apache.cassandra.net.AbstractMessageHandler.processFrameOfContainedMessages(AbstractMessageHandler.java:242)
at org.apache.cassandra.net.AbstractMessageHandler.processIntactFrame(AbstractMessageHandler.java:227)
at org.apache.cassandra.net.AbstractMessageHandler.process(AbstractMessageHandler.java:218)
at org.apache.cassandra.net.FrameDecoder.deliver(FrameDecoder.java:321)
at org.apache.cassandra.net.FrameDecoder.channelRead(FrameDecoder.java:285)
at org.apache.cassandra.net.FrameDecoder.channelRead(FrameDecoder.java:269)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
...
但我还在另一个节点中找到了此日志:
DEBUG [Native-Transport-Requests-3] 2022-08-31 14:56:12,900 ReadCallback.java:119 - Failed; received 1 of 3 responses (only digests)
DEBUG [Native-Transport-Requests-2] 2022-08-31 14:56:13,486 ReadCallback.java:119 - Failed; received 1 of 3 responses (only digests)
DEBUG [Native-Transport-Requests-1] 2022-08-31 14:56:14,149 ReadCallback.java:119 - Failed; received 1 of 3 responses (including data)
我将cassandra 4.0.4与java驱动程序4.14.1配合使用。
我希望add列操作不会在查询中导致错误。我做错什么了吗?
1条答案
按热度按时间1tu0hz3e1#
问题不在于更新了表定义。真正的问题是您的节点没有响应,从而导致如下错误:
和:
当您执行架构更改而节点没有响应时,架构更改将不会传播到这些节点。这就是“未知列”出现读取错误的原因——这是模式不一致。
您需要解决节点无响应这一根本问题。根据我的经验,最可能的原因是集群过载,因此需要增加容量来应对负载。
作为补充说明,
LOCAL_QUORUM
的密钥空间复制因子必须为5,才能要求3个副本来响应读取请求。这是故意的吗?对于几乎所有情况,建议每个DC中的复制因子为3,这就足够了。当我看到
RF:5
时,我立即认为这可能是一个错误,操作员没有理解其中的含义。但如果您有5个副本的特定要求,那么只要您知道自己在做什么,就可以了。干杯