文档详情

数据库课后答案.pdf

发布:2025-05-11约3.25万字共12页下载文档
文本预览下载声明

CHAPTER16

RecoverySystem

PracticeExercises

16.1Explainwhylogrecordsfortransactionsontheundo-listmustbepro-

cessedinreverseorder,whereasredoisperformedinaforwarddirection.

Answer:Withinasingletransactioninundo-list,supposeadataitem

isupdatedmorethanonce,sayfrom1to2,andthenfrom2to3.Ifthe

undologrecordsareprocessedinforwardorder,thefinalvalueofthe

dataitemwouldbeincorrectlysetto2,whereasbyprocessingthemin

reverseorder,thevalueissetto1.Thesamelogicalsoholdsfordataitems

updatedbymorethanonetransactiononundo-list.

Usingthesameexampleasabove,butassumingthetransactioncommit-

ted,itiseasytoseethatifredoprocessingprocessestherecordsinforward

order,thefinalvalueissetcorrectlyto3,butifdoneinreverseorder,the

finalvaluewouldbesetincorrectlyto2.

16.2Explainthepurposeofthecheckpointmechanism.Howoftenshould

checkpointsbeperformed?Howdoesthefrequencyofcheckpointsaffect:

•Systemperformancewhennofailureoccurs?

•Thetimeittakestorecoverfromasystemcrash?

•Thetimeittakestorecoverfromamedia(disk)failure?

Answer:Checkpointingisdonewithlog-basedrecoveryschemestore-

ducethetimerequiredforrecoveryash.Ifthereisnocheckpoint-

ing,thentheentirelogmustbesearchedash,andalltransactions

undone/redonefromthelog.Ifcheckpointinghadbeenperformed,then

mostofth

显示全部
相似文档