gpt4 book ai didi

cassandra - 如果我将正常一致性级别设置为条件写入 (LWT),会发生什么?

转载 作者:行者123 更新时间:2023-12-05 00:17:35 26 4
gpt4 key购买 nike

我有 6 个复制因子为 3 的节点集群。我使用普通一致性级别作为 QUORUM,串行一致性级别作为 SERIAL。

我有一个条件写入查询(IF EXIST)。如果我使用如下所示的 datastax java 驱动程序将此语句设置为 normal 和 serial 会发生什么。

//preparedStatement has a conditional query.
BoundStatement boundStatement = new BoundStatement(preparedStatement);
boundStatement.setSerialConsistencyLevel(ConsistencyLevel.SERIAL);
//is this required??
boundStatement.setConsistencyLevel(ConsistencyLevel.QUORUM);

我的疑问:
  • 正常一致性 QUORUM 会被忽略还是会被考虑在内?
  • 在这种情况下,我应该只设置串行一致性级别吗?

  • 我提到了下面的链接,但它没有解释太多
    https://docs.datastax.com/en/cassandra/3.x/cassandra/dml/dmlConfigSerialConsistency.html

    The learn phase, which defines what read operations will be guaranteed to complete immediately if lightweight writes are occurring uses a normal consistency level.



    请用通俗的语言解释。

    最佳答案

    串行一致性级别仅用于轻量级事务的 Paxos 阶段。如果该阶段成功,则将使用指定的“正常”一致性级别进行实际更改(读取或写入)。

    所以回答你的问题:

    Will the normal consistency QUORUM will be ignored OR it will be taken into account ?



    如果轻量级事务成功并且执行了变更,则将考虑在内。

    Should I set only serial consistency level in this case ?



    每个语句都带有一个一致性级别。如果您没有在语句级别指定任何内容, the defaults defined at cluster level apply .

    关于cassandra - 如果我将正常一致性级别设置为条件写入 (LWT),会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39851927/

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