Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
184
|
第
10
章
a
)
b
)
c
)
图
10-4
:邀请算法
与其他讨论过的算法类似,该算法允许各个进程处于多个组中,并允许多个领导者存
在。邀请算法允许创建进程组并合并它们,而不必从头开始触发新的选举,这减少了完
成选举所需的消息数量。
10.5
环算法
在环算法(ring algorithm)[CHANG79] 中,系统中所有的节点形成一个环,并且知道环
拓扑(即它们在环中的前驱和后继)。当进程检测到领导者故障时,它发起新的选举。选
举消息沿着环向下转发:每个进程联系它的后继节点(环中离它最近的下一个节点)。如
果该节点不可用,则进程跳过不可达的节点,并尝试联系环中之后的节点,直到最终有
一个节点响应为止。
节点联系其兄弟节点,沿着环收集活动节点的集合,并在将集合传递到下一个节点之前
将其自身添加到该集合中,类似于 9.1.1 节中描述的故障检测算法那样,节点在将其传
递到下一个节点之前将其标识符附加到路径中。
该算法通过完全遍历环来进行。当消息返回到开始选举的节点时,从活动节点集中选择
排名最高的节点作为领导者。在图 10-5 中,你可以看到这样一个遍历的例子:
•
a) 先前的领导者 6 发生了故障,并且每个进程都具有该环的视图。
•
b) 3 通过开始遍历来发起选举。每一步中,都维护一个在路径上遍历过的节点集合。
5 无法达到 6,所以它跳过 6 直接联系 1。
•
c) 由于 5 是排名最高的节点,3 会发起另一轮消息传递来广播关于新领导者的信息。
这种算法的变体包括收集单个排名最高的标识符,而不是一组活动节点,以节省空间 ...
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