gpt4 book ai didi

Cassandra 查询超时,当明确指定为 LOCAL_QUORUM 时,将一致性视为 ALL

转载 作者:行者123 更新时间:2023-12-01 03:13:58 24 4
gpt4 key购买 nike

Cassandra 查询为选择查询超时:

SELECT x, y FROM <table> WHERE unique_id= <value>

有这个特例
com.datastax.driver.core.exceptions.ReadTimeoutException: Cassandra timeout during read query at consistency ALL (3 responses were required but only 2 replica responded)
at com.datastax.driver.core.exceptions.ReadTimeoutException.copy(ReadTimeoutException.java:88)
at com.datastax.driver.core.exceptions.ReadTimeoutException.copy(ReadTimeoutException.java:25)
at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)

Cassandra 驱动程序:
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.5.0</version>
</dependency>

我们的查询代码:
    QueryOptions queryOptions = new QueryOptions();
queryOptions.setSerialConsistencyLevel(ConsistencyLevel.LOCAL_SERIAL);
queryOptions.setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);

List<String> contactPoints = Utils
.getArrayStrings(config, Constants.CASSANDRA_CONTACT_POINTS);

Cluster cluster = Cluster.builder()
.addContactPoints(contactPoints.toArray(new String[contactPoints.size()]))
.withQueryOptions(queryOptions)
.withProtocolVersion(ProtocolVersion.V4)
.build();

Session session = cluster.connect();
session.executeAsync(SELECT_STATEMENT).bind()
.setUUID(0, UUID.fromString(inputEvent.getUniqueId()))

当我们在查询选项中将一致性显式设置为 LOCAL_QUORUM 时,为什么将一致性视为 ALL?

最佳答案

我们在生产环境中遇到了同样的问题。看起来它与这里描述的读取修复过程有关CASSANDRA-10726 .同样在此副本中 CASSANDRA-14480错误其他人有确切的行为。

我们只有在切换到多 DC 环境后才注意到此错误。

我们正在使用这个版本:

Cassandra :3.0.15
DSE:5.0.12
Java 驱动程序:3.1.4

关于Cassandra 查询超时,当明确指定为 LOCAL_QUORUM 时,将一致性视为 ALL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50100320/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com