What are the implications of using lightweight transactions?

In particular, I looked at this page where it says:

If light transactions are used to write to a string in a section, only light transactions should be used for read and write operations.

I am confused about how using LWT for read operations looks like. Specifically, how does this relate to query consistency levels (and order sequences).

The description for SERIAL read consistency raises additional questions:

Allows you to read the current (and possibly uncommitted) state of the data without offering a new addition or update.

This suggests that using SERIAL for reading is not "using LWT."

But then

  • How does Cassandra know to check transactional transactions while reading?
  • What is the new update that is offered when reading, and how does it affect reading?
  • How does this work if the consistency you are reading, for example (like ONE ), is less than the serialConsistency used for writing?
  • Once you use LWT in a table (or row? Or column?), Are all non- SERIAL readings forced to take responsibility for participating in the quorums and transaction algorithm?
  • Does the requirement really apply to the entire row, or only the columns involved in the conditional expression?

If I ignore this advice and make both sequential and non-serial reads / writes. How does LWT fail?

+8
cassandra transactions datastax-java-driver
source share
1 answer

How does Cassandra know to check transactions in the process when you read?

This is exactly what the SERIAL level of consistency indicates. It ensures that the query will only return results after all pending transactions have been fully completed.

What new update is offered during reading, and how does it affect reading?

I think the document is trying to say that reading will be handled in the same way as LWT - just without any updates.

How will this work if the consistency you are reading (e.g. ONE) is less than the sequential compatibility used for writing?

Reading with SERIAL always means QUORUM as a level of consistency. Reading with ONE will not give you any guarantees provided by SERIAL , and you can finish reading the stopped data.

As soon as you use LWT in a table (or row? Or column?), Are all non-SERIAL readings forced to take a penalty for participating in quorums and a transaction algorithm?

Not. You can use non-SERIAL levels for your queries and execute them with the same performance characteristics as any other non-serial queries.

Does the requirement really apply to the entire row, or only the columns involved in the conditional statement?

No, I think that everything should be fine if you use different columns for sequential read / write (including conditions) and regular read / write operations.

If I ignore this advice and make both sequential and non-serial reads / writes. How does LWT fail?

If you make regular entries that are not performed as part of the LWT, these entries will be applied at any time without interfering with the LWT consensus process at all. As a result, regular recordings can theoretically change a value that is part of the LWT condition at a time between status evaluation and applying an update, which is a potential cause of inconsistencies that you wanted to avoid using LWT.

+6
source share

All Articles