Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
复制和一致性
|
199
图 11-5 展示了 write(x,1) 和 write(x,2) 是如何变得对 P
3
和 P
4
可见的。即使用挂
钟(wall-clock
译注 1
)概念来说 1 是在 2
之前
写的,但它也可以排在 2 之后。与此同时,
当 P
3
已经读取值 1 时,P
4
仍然可以读取值 2。但是,只要它们对于不同的读取者是一
致的,那么 1 → 2 和 2 → 1 这两个顺序
都
是有效的。关键在于 P
3
和 P
4
的观测值
顺序相
同
:首先是 2,然后是 1[TANENBAUM14]。
图
11-5
:顺序一致性中的排序
读到过时值(stale read)可以用副本差异来解释,例如:即使写入以相同的顺序传播到
不同的副本,它们也可能在不同的时间到达。
顺序一致性与可线性化的主要区别在于没有全局强制的时间界限。在可线性化中,一个
操作必须在其挂钟时间范围内变得有效。当写入操作 W
1
完成时,它的结果必须已经被
应用,并且每个读取者应该能够看到
至少
与 W
1
所写入的值一样新的值。类似地,在一
个读操作 R
1
返回之后,在它之后执行的任何读操作都应该返回 R
1
已经看到的值或更晚
的值(当然,这也必须遵循同样的规则)。
顺序一致性放宽了这一要求:操作的结果可以在操作完成
后
才变得可见,只要从单个参
与者的角度来看顺序是一致的。同一来源的写操作程序不能互相“跳过”:它们的程序
顺序(相对于自己的执行进程)必须保持不变。另一个限制是操作出现的顺序必须对
所
有
读取者一致。
与可线性化相似,现代 CPU 在默认情况下不保证顺序一致性,而且,由于处理器可以 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787111655169