Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
268
|
第
14
章
请求 预准备
客户端
准备 提交 响应
图
14-13
:
PBFT
共识算法,正常情况下的操作
在准备阶段和提交阶段中,节点向其他所有节点发送消息,并等待从相应数量的其他节
点收到消息,以检查消息是否匹配并确保不广播错误的消息。各节点对所有消息进行交
叉验证,从而保证只有无缺陷的节点才能成功提交消息。如果无法收集足够多的匹配消
息,节点不会进入下一步。
当副本收集到足够多的提交消息时,它们会通知客户端并完成当前回合。只有当收到
f + 1 个匹配的响应后,客户端才能确定执行已正确完成。
当副本注意到主节点处于非活动状态且怀疑它可能发生了故障时,就会发生视图变更。
检测到主节点故障的节点将不再回应消息(除了检查点和视图变更相关消息),广播一个
视图变更通知并等待确认。当新视图的主节点收到 2f 个视图变更事件时,它将发起一
个新视图。
为了减少协议中的消息数量,客户端可以先
试探性
执行请求(比如,当它们收集到足够
多匹配的 Prepared 消息之后)并收集 2f + 1 个匹配的响应。如果客户端无法收集到
足够多匹配的试探性响应,它将重试并等待 f + 1 的非试探性响应,就像之前描述的
那样。
PBFT 中的只读操作仅需一轮网络交互即可完成。客户端向所有副本发送读请求。各副
本等到所有进行中的修改该值的操作完成提交,然后在其试探性状态(tentative state)上
执行请求并回复客户端。当从不同副本收集到值相同的 2f + 1 个响应后,操作就完成
了。
14.5.2
恢复和检查点
副本将接受的消息保存在一个稳定的日志中。每条消息至少要保留到 ...
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