question

376752150_179413 avatar image
376752150_179413 asked Erick Ramirez answered

Why do we need SERIAL consistency level?

1. As the doc says, "A SERIAL consistency level allows reading the current (and possibly uncommitted) state of data without proposing a new addition or update. If a SERIAL read finds an uncommitted transaction in progress, Cassandra performs a read repair as part of the commit."

What does "proposing a new addition or update" mean?

When will it happen that read the current (and possibly uncommitted) state of data WITH proposing a new addition or update"?

2. The doc also mentions "To read the latest value of a column after a user has invoked a lightweight transaction to write to the column, use SERIAL. Cassandra then checks the inflight lightweight transaction for updates and, if found, returns the latest data."

" Cassandra then checks the inflight lightweight transaction" is the inflight lwt here means the the one in "To read the latest value of a column after a user has invoked a lightweight transaction " ? Or does it mean other inflight LWTs?

Thanks in advance!

cassandralightweight transactions
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

@376752150_179413 Lightweight transactions need to do a read-before-write to determine if the update's condition can be satisfied.

(1) A SERIAL read does not propose to update/mutate the data -- instead it's making sure that the latest version of the data is persisted (saved/committed on all the replicas) before a response is returned during the read/results phase of the Paxos protocol.

(2) It's one and the same. There can only ever be one in-flight LWT at any time. The record is effectively locked and no other updates can occur while a conditional update (LWT) is in progress.

If you're interested, this blog post explains all the different Paxos phases to accomplish conditional updates in Cassandra. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.