【问题标题】:How to interpret cassandra consistency from tracing a query如何通过跟踪查询来解释 cassandra 的一致性
【发布时间】:2023-03-17 01:23:01
【问题描述】:

即使我的查询没有选项,您能否提供建议 如果存在和如果不存在。 仍在查询跟踪结果中显示了我们想要的两个一致性级别“QUORUM”

但它也显示'serial_consistency_level':'SERIAL',这是什么行为

 session_id                           | client      | command | coordinator | duration | parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | request                     | started_at
--------------------------------------+-------------+---------+-------------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------+---------------------------------
 278a2000-3dfb-11e9-b459-9775e6c46fc6 | 10.244.*.* |   QUERY |  10.244.*.* |     3338 | 
`

`{'bound_var_0_stream_id': '''3c17230d-ea24-4ff7-9599-352fef883b31''', 
 'bound_var_1_property_name': '''Location:rxRSSI''', 
 'bound_var_2_shard_date': '2019-03-03T00:00:00.000Z', 
 'bound_var_3_time': '2019-03-03T21:27:30.749Z', 
 'bound_var_4_source_id': '''fe30653c-467f-401a-9646-67b10378e1c9''', 
 'bound_var_5_time_lag': '1328', 
 'bound_var_6_property_class': '''java.lang.Integer''', 
 'bound_var_7_property_type': '''ByteType''', 
 'bound_var_8_property_value': '''-44''', 
 'consistency_level': 'LOCAL_QUORUM', 
 'page_size': '5000', 
 'query': 'INSERT INTO "cloudleaf"."stream_48" ("stream_id", "property_name", "shard_date", "time", "source_id", "time_lag", "property_class", "property_type", "property_value") 
 VALUES (:"stream_id", :"property_name", :"shard_date", :"time", :"source_id", :"time_lag", :"property_class", :"property_type", :"property_value") 
 USING TTL 432000', 
 'serial_consistency_level': 'SERIAL'} 

【问题讨论】:

    标签: cassandra cql cassandra-2.0 cassandra-3.0 cqlsh


    【解决方案1】:

    IF EXISTSIF NOT EXISTS 触发轻量级事务,它可以具有SERIALLOCAL_SERIAL 两个一致性级别之一。这些定义如下:

    SERIAL: 通过防止无条件更新实现轻量级事务的线性化一致性。此一致性级别仅用于轻量级事务。相当于 QUORUM。

    LOCAL_SERIAL: 与 SERIAL 相同,但仅限于数据中心。必须将条件写入写入同一数据中心内的法定副本节点上的提交日志和内存表。与 SERIAL 相同,但用于在本地(在单个数据中心内)保持一致性。相当于 LOCAL_QUORUM。

    见:https://docs.datastax.com/en/cassandra/3.0/cassandra/dml/dmlConfigSerialConsistency.html

    【讨论】:

      猜你喜欢
      • 2016-01-06
      • 2017-08-11
      • 1970-01-01
      • 2016-02-02
      • 2012-03-20
      • 1970-01-01
      • 1970-01-01
      • 2013-09-10
      • 2012-05-15
      相关资源
      最近更新 更多