使用轻量级事务的含义是什么

使用轻量级事务的含义是什么

本文介绍了使用轻量级事务的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特别是我正在查看此页面它说:

In particular I was looking at this page where it says:

如果使用轻量级事务写入分区内的行,则只应使用轻量级事务进行读写操作.

我对使用 LWT 进行读取操作的方式感到困惑.具体来说,这与每个查询的一致性(和 serialConsistency)级别有何关系.

I'm confused as to what using LWTs for read operations looks like. Specifically how this relates to per-query consistency (and serialConsistency) levels.

SERIAL描述/code> 读取一致性引发了进一步的问题:

The description for SERIAL read consistency raises further questions:

允许读取当前(可能未提交)的数据状态,而无需提出新的添加或更新.

这表明使用 SERIAL 进行读取并不是使用 LWT".

That suggests that using SERIAL for reads is not "using a LWT".

然后

  • 当您进行读取时,Cassandra 如何知道检查正在进行的事务?
  • 在您尝试阅读时提出的新更新是什么,这对阅读有何影响?
  • 如果您正在阅读的一致性(例如 ONE)小于用于写入的 serialConsistency,这将如何工作?
  • 一旦您在表(或行?或列?)上使用 LWT,是否所有非SERIAL 读取都被迫接受参与仲裁和事务算法的惩罚?
  • 要求实际上适用于整行,还是仅适用于条件语句中涉及的列?
  • How does Cassandra know to check for in-progress transactions when you do a read?
  • What is the new update that is proposed while you're trying to read, and how does this affect the read?
  • How would that work if the consistency you're reading at (say ONE for example) is less than the serialConsistency used for writing?
  • Once you use a LWT on a table (or row?, or column?), are all non-SERIAL reads forced to take the penalty of participating in quorums and the transaction algorithm?
  • Does the requirement actually apply to the whole row, or just the columns involved in the conditional statement?

如果我忽略此建议并进行串行和非串行读/写.LWT 以什么方式失败?

If I ignore this advice and make both serial and non-serial reads/writes. In what way to the LWTs fail?

推荐答案

这正是 SERIAL 一致性级别所指示的.它确保查询仅在所有待处理事务完全执行后才返回结果.

This is exactly what the SERIAL consistency level indicates. It makes sure that a query will only return results after all pending transactions have been fully executed.

在您尝试阅读时提出的新更新是什么?以及这如何影响读取?

我认为文档想说的是读​​取将像 LWT 一样处理 - 只是不进行任何更新.

I think what the doc is trying to say is that the read will be handled just like a LWT - just without make any updates on it's own.

如果您正在阅读的一致性(例如 ONE)小于用于写入的 serialConsistency,这将如何工作?

使用 SERIAL 读取将始终暗示 QUORUM 作为一致性级别.使用 ONE 读取不会为您提供 SERIAL 提供的任何保证,您最终可能会读取停滞的数据.

Reads using SERIAL will always imply QUORUM as consistency level. Reading with ONE will not provide you any guarantees provided by SERIAL and you can end up reading stalled data.

一旦您在表(或行?或列?)上使用 LWT,是否所有非串行读取都被迫接受参与仲裁和事务算法的惩罚?

没有.您可以对查询使用非串行一致性级别,并让它们以与任何其他非串行查询完全相同的性能特征执行.

No. You can use non-SERIAL consistency levels for your queries and have them executed with the exact same performance characteristics as any other non-serial queries.

要求实际上适用于整行,还是仅适用于条件语句中涉及的列?

不,我认为只要您对串行读/写(包括条件)和常规读/写使用不同的列就可以了.

No, I think you should be fine as long as you use different columns for serial reads/writes (including conditions) and regular reads/writes.

如果我忽略此建议并进行串行和非串行读/写.LWT 以什么方式失败?

如果您执行常规写入,而不是作为 LWT 的一部分执行,那么这些写入将随时应用,完全不会干扰 LWT 的共识过程.因此,理论上,常规写入可以在评估条件和应用更新之间的某个时间更改作为 LWT 条件一部分的值,这是您希望避免使用 LWT 的不一致的潜在原因.

If you execute regular writes, not being executed as part of a LWT, those writes will be applied at any time, without interfering at all with the consensus process of LWTs. As a consequence, regular writes can in theory change a value that is part of a LWT condition at a time between evaluating the condition and applying the update, which is a potential cause for inconsistencies you wanted to avoid using LWTs.

这篇关于使用轻量级事务的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:20