Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
264
|
第
14
章
a
)
b
)
c
)
c
)
图
14-11
:
Raft
的提交过程(
P
1
为领导者)
图 14-12 展示了一个共识回合的例子,其中 P
1
是领导者,它拥有最新的事件视图。领导
者将日志条目复制给跟随者,并在收集到确认消息后提交这些命令。提交一个条目时也
会提交它以前的所有条目。只有领导者才能决定是否可以提交该条目。每个日志条目上
都标有任期 ID(日志条目方框右上角的数字)和日志下标,以标识其在日志中的位置。
已提交的条目一定已被复制给 Quorum 的参与者,并且可以安全地按照日志中的顺序应
用到状态机。
已提交的条目
日志下标
(
领导者
)
图
14-12
:
Raft
状态机
14.4.2
故障场景
当多个跟随者决定成为候选者时,可能会没有任何一个候选者收集到多数派的投票,这
共识
|
265
种情况被称为
平票
(split vote)。 Raft 用随机定时器来降低再次平票的概率。其中一个候
选者可以略早发起下一轮选举,从而收集到足够的票数,而其他人则等待并做出让步。
这种方法可以在不引入其他协调的情况下加快选举速度。
跟随者可能会宕机或反应迟缓,领导者必须尽最大努力保证消息传递。如果未能在预期
时间内收到确认,它可以尝试再次发送消息。作为一种性能优化的方式,它也可以并行
发送多个消息。
由于领导者复制的每个条目都是唯一标识的 ...
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