为什么使用读修复的法定读和写操作不是线性可操作的?

huangapple go评论46阅读模式
英文:

Why are quorum reads and writes with read repair not linearizable

问题

From designing data intensive applications:

> Cassandra does wait for read repair to complete on quorum reads [27], but it loses linearizability if there are multiple concurrent writes to the same key, due to its use of last-write-wins conflict resolution.

我已经在其他地方读到过,为了使系统具有线性可操作性,读修复必须是原子性的。

然而,在Martin Kleppmann的YouTube系列中,他说对于quorum读取和写入的情况,读修复是线性可操作的。

我对此感到困惑,实际上从直观上来看,即使读修复不是原子性的,它也是线性可操作的,因为它延迟了读取响应返回客户端,导致冲突读取与其他读取并发。

我看到这样一个系统的缺点是,在向客户端发送成功消息时,可以丢弃并发写入。

英文:

From designing data intensive applications:

> Cassandra does wait for read repair to complete on quorum reads [27], but it loses linearizability if there are multiple concurrent writes to the same key, due to its use of last-write-wins conflict resolution.

I've read elsewhere that read repair needs to be atomic in order to make the system linearizable

However in Martin kleppmann's youtube series, he states read repairs on quorum reads and writes are linearizable.

I'm confused by this, actually intuitively it makes sense that read repairs are linearizable even if they are not atomic because it delays the read response back to the client, causing the conflicting read to be concurrent with other reads.

The downside of a system like this that I see are that concurrent writes can be dropped while sending back a success msg to the client.

答案1

得分: 0

Writes in this kind of "non-Paxos/Raft" systems provide much less consistency due to the fact that these writes are not atomic. While some particular write has not finished some nodes may have saved a new value already, while others - not; it could be also due to the fact that multiple concurrent writes are in progress - hence, the whole system is (temporarily, of course) inconsistent and eventually (hopefully!) will become consistent again by applying the recovery strategy you mentioned correctly.

That would have been different (and inherently significantly slower) with Paxos or Raft in place. Having either one orchestrating each write transaction would have made writes atomic and the issues would've gone once and forever (provided, a Paxos or Raft implementation is correct enough, which is by itself a nontrivial code to write and tenfold so to test).

So, in short, once write has completed successfully, the system behaves exactly as you'd expect it to; however, while writing is in progress or overlaps with a concurrent conflicting writing or simply failed - all sort of typical-for-the-eventually-consistent-paradigm problems arise and bring a fair amount of chaos with them. Please read this post for more details.

英文:

Writes in this kind of "non-Paxos/Raft" systems provide much less consistency due to the fact that these writes are not atomic. While some particular write has not finished some nodes may have saved a new value already, while others - not; it could be also due to the fact that multiple concurrent writes are in progress - hence, the whole system is (temporarily, of course) inconsistent and eventually (hopefully!) will become consistent again by applying the recovery strategy you mentioned correctly.

That would have been different (and inherently significantly slower) with Paxos or Raft in place. Having either one orchestrating each write transaction would have made writes atomic and the issues would've gone once and forever (provided, a Paxos or Raft implementation is correct enough, which is by itself a nontrivial code to write and tenfold so to test).

So, in short, once write has completed successfully, the system behaves exactly as you'd expect it to; however, while writing is in progress or overlaps with a concurrent conflicting writing or simply failed - all sort of typical-for-the-eventually-consistent-paradigm problems arise and bring a fair amount of chaos with them. Please read this post for more details.


Hope I understood your question well and the answer I gave is appropriate; if not, then please ask more precise question.

huangapple
  • 本文由 发表于 2023年4月17日 08:32:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76030992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定