Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
领导者选举
|
183
•
c) 4 将新的领导者 2 通知给所有进程。
候选节点组 候选节点组 候选节点组普通节点组 普通节点组 普通节点组
a
)
b
)
c
)
图
10-3
:霸道算法的候选节点
/
普通节点修改版。先前的领导者(
6
)发生故障,进程
4
发起
新的选举
10.4
邀请算法
邀请算法
(invitation algorithm)允许进程“邀请”其他进程加入它们的组,而不是试图
超越它们的排名。这种算法
从定义上
就允许多个领导者存在,因为每个组都有自己的领
导者。
每个进程一开始都是一个新组的领导者,组内唯一的成员是这个进程本身。组领导者联
系不属于该组的对等进程,邀请其加入。如果对等进程本身是领导者,则合并两个组。
否则,被联系的进程会回复组领导者 ID,从而让两个组的领导者以较少的步骤建立联系
并合并两个组。
图 10-4 给出了邀请算法的执行步骤:
•
a) 开始时,有四个进程成为各有一名成员的组的领导者。1 邀请 2 加入它所在组,3
邀请 4 加入它所在组。
•
b) 2 加入进程 1 的组,4 加入进程 3 的组。1 作为第一组的领导者去联系另一组的
领导者 3。随后,该组剩余的成员(在本例中为 4)被通知关于新的组领导的信息。
•
c) 两个组被合并,并且 1 成为扩展后组的领导者。
因为组被合并了,是建议组合并的进程还是另一个进程成为新的领导者都无关紧要。为
了将合并组所需的消息数量保持在最低限度,较大组的领导者可以成为新组的领导者。
这样,只需要把领导者变更的消息通知给较小组的进程。
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