Skip to Content
数据库系统内幕
book

数据库系统内幕

by Alex Petrov
May 2020
Beginner to intermediate
319 pages
7h 3m
Chinese
China Machine Press
Content preview from 数据库系统内幕
事务处理与恢复
|
85
理解 steal 和 force 策略非常重要,因为它们会影响事务的撤销和重做。
撤销
操作会回滚
那些已提交事务强制刷盘的页上的更新,而
重做
操作会将已提交事务执行的更改应用到
磁盘上。
若使用
no-steal
策略,那么只需要重做日志就可以实现恢复:旧副本包含在磁盘的页上,
而修改被存储在日志中 [WEIKUM01]。若使用
no-force
策略,我们就可以通过
推迟
对页
的若干个更新来缓冲它们。由于这段时间内必须将页缓存在内存中,所以可能需要一个
更大的页缓存。
在使用
force
策略时,崩溃恢复无须任何其他工作即可重建已提交事务的结果,因为这
些事务修改的页都已被刷写到磁盘。该方法的主要缺点是,由于在事务提交中必须要进
行 I/O 操作,所以提交时间更长。
更一般地说,直到事务提交前,我们需要保存有足够的信息来撤销它的结果。如果事务
中涉及的页都已经刷写到磁盘,那么我们需要在日志中保留撤销信息,以在事务提交之
前确保它能被回滚;否则,我们必须保留重做日志。在这两种情况下,只有当撤销或重
做记录被写入日志文件后,事务才能提交。
5.2.4 ARIES
ARIES 是一种
steal
/
no-force
的恢复算法。它使用物理重做日志来提高恢复期间的性
能(因为能更快地应用更改),并使用逻辑撤销日志来提高正常操作期间的并发(因为
逻辑撤销操作可以独立地应用到页中)。它使用 WAL 来实现在恢复时
重放历史
,从
而完整地重建数据库状态(未提交事务的修改已被撤销),并在撤销期间构建补偿日
志记录 [MOHAN92] ...
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