关系论坛头像图片

论坛头像图片  时间:2021-04-13  阅读:()
当前无法显示此图像.
Lecture13RecoverySystemQiwenDongJun20,2011SchoolofComputerScienceFudanUniversity2012-06-13SchoolofC.
S.
,FudanUniv.
2OutlineTransactionfailureLogicalerrorsSystemerrorsSystemcrashApowerfailureorotherhardwareorsoftwarefailurecausesthesystemtocrashDiskfailureAheadcrashorsimilardiskfailuredestroysallorpartofdiskstorage2012-06-13SchoolofC.
S.
,FudanUniv.
3RecoveryAlgorithmsTechniquestoensuredatabaseconsistencyandtransactionatomicityanddurabilitydespitefailuresRecoveryalgorithmshavetwoparts1.
Actionstakenduringnormaltransactionprocessing2.
Actionstakenafterafailure当前无法显示此图像.
DataAccess2012-06-13SchoolofC.
S.
,FudanUniv.
5StorageStructureVolatilestoragedoesnotsurvivesystemcrashesexamples:mainmemory,cachememoryNonvolatilestoragesurvivessystemcrashesexamples:disk,tape,flashmemoryStablestorageamythicalformofstoragethatsurvivesallfailuresapproximatedbymaintainingmultiplecopiesondistinctnonvolatilemedia2012-06-13SchoolofC.
S.
,FudanUniv.
6DataAccessPhysicalblocksarethoseblocksresidingonthedisk.
Bufferblocksaretheblocksresidingtemporarilyinmainmemory.
Blockmovementsbetweendiskandmainmemoryare:input(B)output(B)EachtransactionTihasitsprivatework-areaTi'slocalcopyofadataitemXiscalledxi.
Weassume,forsimplicity,thateachdataitemfitsin,andisstoredinside,asingleblock.
2012-06-13SchoolofC.
S.
,FudanUniv.
7DataAccess(Cont.
)Transactiontransfersdataitemsbetweensystembufferblocksanditsprivatework-areausingread(X)write(X)TransactionsPerformread(X)whileaccessingXforthefirsttimeAllsubsequentaccessesaretothelocalcopyAfterlastaccess,transactionexecuteswrite(X)output(BX)neednotimmediatelyfollowwrite(X)Systemcanperformtheoutputoperationwhenitdeemsfit2012-06-13SchoolofC.
S.
,FudanUniv.
8ExampleofDataAccessxYABx1y1bufferBufferBlockABufferBlockBinput(A)output(B)read(X)write(Y)diskworkareaofT1workareaofT2memoryx22012-06-13SchoolofC.
S.
,FudanUniv.
9Modifyingthedatabase(withoutensuringthatthetransactionwillcommit)mayleavethedatabaseinaninconsistentstate.
ConsidertransactionTithattransfers$50fromaccountAtoaccountB;goaliseithertoperformalldatabasemodificationsmadebyTiornoneatall.
SeveraloutputoperationsmayberequiredforTi(tooutputAandB).
Afailuremayoccurafteroneofthesemodificationshavebeenmadebutbeforeallofthemaremade.
RecoveryandAtomicity2012-06-13SchoolofC.
S.
,FudanUniv.
10RecoveryandAtomicity(Cont.
)Toensureatomicitydespitefailures,wefirstoutputinformationdescribingthemodificationstostablestoragewithoutmodifyingthedatabaseitself.
Therearetwoapproaches:log-basedrecovery(基于日志的恢复)shadow-paging(影子页)Weassume(initially)thattransactionsrunserially,thatis,oneaftertheother当前无法显示此图像.
Log-basedRecovery2012-06-13SchoolofC.
S.
,FudanUniv.
12Log-BasedRecoveryAlogiskeptonstablestorage.
Thelogisasequenceoflogrecords.
Weassumethatlogrecordsarenotbuffered.
WhentransactionTistarts,itregistersitselfbywritingalogrecordBeforeTiexecuteswrite(X),alogrecordiswrittenWhenTifinishesit'slaststatement,thelogrecordiswritten.
TwoapproachesusinglogsDeferreddatabasemodification(延迟数据库修改)Immediatedatabasemodification(即刻数据库修改)2012-06-13SchoolofC.
S.
,FudanUniv.
13DeferredDatabaseModificationRecordsallmodificationstothelog,butdefersallthewritestoafterpartialcommit.
Transactionstartsbywritingrecordtolog.
Awrite(X)operationresultsinalogrecordbeingwritten.
ThewriteisnotperformedonXatthistime,butisdeferred.
WhenTipartiallycommits,iswrittentothelogFinally,thelogrecordsarereadandusedtoactuallyexecutethepreviouslydeferredwrites.
2012-06-13SchoolofC.
S.
,FudanUniv.
14Duringrecoveryafteracrashatransactionneedstoberedoneiffbothandarethereinthelog.
Redo(Ti)setsthevalueofalldataitemsupdatedbythetransactiontothenewvalues.
example(T0executesbeforeT1):T0:read(A)T1:read(C)A:-A-50C:-C-100Write(A)write(C)read(B)B:-B+50write(B)DeferredDatabaseModification(Cont.
)2012-06-13SchoolofC.
S.
,FudanUniv.
15Iflogonstablestorageattimeofcrashisasincase:(a)Noredoactionsneedtobetaken(b)redo(T0)mustbeperformed(c)redo(T0)mustbeperformedfollowedbyredo(T1)DeferredDatabaseModification(Cont.
)2012-06-13SchoolofC.
S.
,FudanUniv.
16ImmediateDatabaseModificationAllowsdatabaseupdatesofanuncommittedtransactiontobemadeasthewritesareissuedUpdatelogrecordmustbewrittenbeforedatabaseitemiswrittenOutputofupdatedblockscantakeplaceatanytimebeforeoraftertransactioncommitOrderinwhichblocksareoutputcanbedifferentfromtheorderinwhichtheyarewritten.
2012-06-13SchoolofC.
S.
,FudanUniv.
17LogWriteOutputA=950B=2050C=600BB,BCBANote:BXdenotesblockcontainingXx1ImmediateDatabaseModificationExample2012-06-13SchoolofC.
S.
,FudanUniv.
18Recoveryprocedurehastwooperations:undo(Ti)redo(Ti)Bothoperationsmustbeidempotent(等幂/幂等的)Thatis,eveniftheoperationisexecutedmultipletimestheeffectisthesameasifitisexecutedonceWhenrecoveringafterfailure:TransactionTineedstobeundoneifthelogcontainstherecord,butdoesnotcontain.
TransactionTineedstoberedoneifthelogcontainsboththerecordand.
Undooperationsareperformedfirst,thenredooperations.
ImmediateDatabaseModification(Cont.
)2012-06-13SchoolofC.
S.
,FudanUniv.
19Recoveryactionsineachcaseaboveare:(a)undo(T0)(b)undo(T1)andredo(T0)(c)redo(T0)andredo(T1)ImmediateDBModificationRecoveryExample当前无法显示此图像.
Checkpoints2012-06-13SchoolofC.
S.
,FudanUniv.
21Checkpoints(检查点)Problemsintherecoveryprocedure:1.
searchingtheentirelogistime-consuming2.
wemightunnecessarilyredotransactionswhichhavealreadyoutputtheirupdatestothedatabase.
Recoveryprocedurebyperiodicallyperformingcheckpointing1.
Outputalllogrecordscurrentlyresidinginmainmemoryontostablestorage.
2.
Outputallmodifiedbufferblockstothedisk.
3.
Writealogrecordontostablestorage.
2012-06-13SchoolofC.
S.
,FudanUniv.
22Checkpoints(Cont.
)Duringrecovery:1.
Scanbackwardsfromendoflogtofindthemostrecentrecord2.
Continuescanningbackwardstillarecordisfound(Wehaveassumethatalltransactionsareexecutedserially)3.
Needonlyconsiderthepartoflogfollowingabovestartrecord.
4.
Foralltransactions(startingfromTiorlater)withno,executeundo(Ti).
5.
Scanningforwardinthelog,foralltransactionsstartingfromTiorlaterwitha,executeredo(Ti).
2012-06-13SchoolofC.
S.
,FudanUniv.
23ExampleofCheckpointsT1canbeignored(updatesalreadyoutputtodiskduetocheckpoint)T2andT3redone.
T4undoneTcTfT1T2T3T4checkpointsystemfailure当前无法显示此图像.
ConcurrentTransactions2012-06-13SchoolofC.
S.
,FudanUniv.
25Wemodifythelog-basedrecoveryschemestoallowmultipletransactionstoexecuteconcurrently.
AlltransactionsshareasinglediskbufferandasinglelogAbufferblockcanhavedataitemsupdatedbyoneormoretransactionsWeassumeconcurrencycontrolusingstricttwo-phaselocking;Loggingisdoneasdescribedearlier.
Logrecordsofdifferenttransactionsmaybeinterspersedinthelog.
ThecheckpointingtechniqueandactionstakenonrecoveryhavetobechangedRecoveryWithConcurrentTransactions2012-06-13SchoolofC.
S.
,FudanUniv.
26Checkpointsareperformedasbefore,exceptthatthecheckpointlogrecordistheformLisalistoftransactionsactiveatthetimeofthecheckpointWeassumenoupdateisinprogresswhilethecheckpointiscarriedout(thiscanberelaxed)Whenthesystemrecoversfromacrash:1.
Initializeundo-listandredo-listtoempty2.
Scanthelogbackwardsuntilarecordisfound:iftherecordis,addTitoredo-listiftherecordis,thenifTiisnotinredo-list,addTitoundo-list3.
ForeveryTiinL,ifTiisnotinredo-list,addTitoundo-listRecoveryWithConcurrentTransactions(Cont.
)2012-06-13SchoolofC.
S.
,FudanUniv.
27Recoverynowcontinuesasfollows:1.
ScanlogbackwardsfromtheendofthelogDuringthescan,performundoforeachlogrecordthatbelongstoatransactioninundo-list.
2.
Locatethemostrecentrecord.
3.
Scanlogforwardsfromtherecordtilltheendofthelog.
Duringthescan,performredoforeachlogrecordthatbelongstoatransactiononredo-listRecoveryWithConcurrentTransactions(Cont.
)2012-06-13SchoolofC.
S.
,FudanUniv.
28ExampleofRecoveryGooverthestepsoftherecoveryalgorithmonthefollowinglog:2012-06-13SchoolofC.
S.
,FudanUniv.
29LogRecordBufferingLogrecordbuffering:logrecordsarebufferedinmainmemory,insteadofofbeingoutputdirectlytostablestorage.
Logrecordsareoutputtostablestoragewhenablockoflogrecordsinthebufferisfull,oralogforceoperationisexecuted.
Logforceisperformedtocommitatransactionbyforcingallitslogrecords(includingthecommitrecord)tostablestorage.
Severallogrecordscanthusbeoutputusingasingleoutputoperation,reducingtheI/Ocost.
2012-06-13SchoolofC.
S.
,FudanUniv.
30LogRecordBuffering(Cont.
)Therulesbelowmustbefollowediflogrecordsarebuffered:Logrecordsareoutputtostablestorageintheorderinwhichtheyarecreated.
TransactionTientersthecommitstateonlywhenthelogrecordhasbeenoutputtostablestorage.
Beforeablockofdatainmainmemoryisoutputtothedatabase,alllogrecordspertainingtodatainthatblockmusthavebeenoutputtostablestorage.
Thisruleiscalledthewrite-aheadloggingorWALrule2012-06-13SchoolofC.
S.
,FudanUniv.
31DatabaseBufferingDatabasemaintainsanin-memorybufferofdatablocksWhenanewblockisneeded,ifbufferisfullanexistingblockneedstoberemovedfrombufferIftheblockchosenforremovalhasbeenupdated,itmustbeoutputtodiskNoupdateshouldbeinprogressonablockwhenitisoutputtodisk.
Canbeensuredasfollows.
Beforewritingadataitem,transactionacquiresexclusivelockonblockcontainingthedataitemLockcanbereleasedoncethewriteiscompleted.
Suchlocksheldforshortdurationarecalledlatches.
Beforeablockisoutputtodisk,thesystemacquiresanexclusivelatchontheblockEnsuresnoupdatecanbeinprogressontheblock2012-06-13SchoolofC.
S.
,FudanUniv.
32BufferManagement(Cont.
)Databasebuffercanbeimplementedeitherinanareaofrealmain-memoryreservedforthedatabase,orinvirtualmemoryImplementingbufferinreservedmain-memoryhasdrawbacks:Memoryispartitionedbefore-handbetweendatabasebufferandapplications,limitingflexibility.
Needsmaychange,andalthoughoperatingsystemknowsbesthowmemoryshouldbedividedupatanytime,itcannotchangethepartitioningofmemory.
2012-06-13SchoolofC.
S.
,FudanUniv.
33BufferManagement(Cont.
)Databasebuffersaregenerallyimplementedinvirtualmemoryinspiteofsomedrawbacks:WhenOSneedstoevictapagethathasbeenmodified,thepageiswrittentoswapspaceondisk.
WhenDBdecidestowritebufferpagetodisk,bufferpagemaybeinswapspace,andmayhavetobereadfromswapspaceondiskandoutputtothedatabaseondisk,resultinginextraI/O!
Knownasdualpagingproblem.
Ideallywhenswappingoutadatabasebufferpage,operatingsystemshouldpasscontroltodatabase,whichinturnoutputspagetodatabaseinsteadoftoswapspace(makingsuretooutputlogrecordsfirst)Dualpagingcanthusbeavoided,butcommonoperatingsystemsdonotsupportsuchfunctionality.
2012-06-13SchoolofC.
S.
,FudanUniv.
34FailurewithLossofNonvolatileStorageTechniquesimilartocheckpointingusedtodealwithlossofnon-volatilestoragePeriodicallydumptheentirecontentofthedatabasetostablestorageNotransactionmaybeactiveduringthedumpprocedure;aproceduresimilartocheckpointingmusttakeplaceOutputalllogrecordscurrentlyresidinginmainmemoryontostablestorage.
Outputallbufferblocksontothedisk.
Copythecontentsofthedatabasetostablestorage.
Outputarecordtologonstablestorage.
Torecoverfromdiskfailurerestoredatabasefrommostrecentdump.
ConsultthelogandredoalltransactionsthatcommittedafterthedumpCanbeextendedtoallowtransactionstobeactiveduringdump;knownasfuzzydumporonlinedump2012-06-13SchoolofC.
S.
,FudanUniv.
35考试要点(仅列出要点,不是全部考试范围)ER模型:能够设计ER模型,并绘制ER图能够转换成关系模式关系代数能够写出给定关系代数的结果能够针对特定查询写出对应的关系代数表达式能够写出select语句的查询结果关系模式规范化能计算属性集的闭包无损分解和保持依赖分解的判据能够分析关系是否满足某些范式能够分析关系模式的分解性质2012-06-13SchoolofC.
S.
,FudanUniv.
36考试要点(仅列出要点,不是全部考试范围)查询处理:理解各种查询处理算法能够分析并计算各种连接的代价事务处理可串行化的判定并发控制理解两阶段封锁协议和时间戳协议的执行过程死锁产生的原因和处理方法能够根据并发执行的事物,构造等待图,处理死锁树形协议的优缺点数据库恢复能够根据事物的执行写出日志能够在数据库故障时,根据日志进行恢复

盘点AoYoZhuJi傲游主机商8个数据中心常见方案及八折优惠

傲游主机商我们可能很多人并不陌生,实际上这个商家早年也就是个人主机商,传说是有几个个人投资创办的,不过能坚持到现在也算不错,毕竟有早年的用户积累正常情况上还是能延续的。如果是新服务商这几年确实不是特别容易,问到几个老牌的个人服务商很多都是早年的用户积累客户群。傲游主机目前有提供XEN和KVM架构的云服务器,不少还是亚洲CN2优化节点,目前数据中心包括中国香港、韩国、德国、荷兰和美国等多个地区的CN...

HostYun 新增可选洛杉矶/日本机房 全场9折月付19.8元起

关于HostYun主机商在之前也有几次分享,这个前身是我们可能熟悉的小众的HostShare商家,主要就是提供廉价主机,那时候官方还声称选择这个品牌的机器不要用于正式生产项目,如今这个品牌重新转变成Hostyun。目前提供的VPS主机包括KVM和XEN架构,数据中心可选日本、韩国、香港和美国的多个地区机房,电信双程CN2 GIA线路,香港和日本机房,均为国内直连线路,访问质量不错。今天和大家分享下...

BuyVM新设立的迈阿密机房速度怎么样?简单的测评速度性能

BuyVM商家算是一家比较老牌的海外主机商,公司设立在加拿大,曾经是低价便宜VPS主机的代表,目前为止有提供纽约、拉斯维加斯、卢森堡机房,以及新增加的美国迈阿密机房。如果我们有需要选择BuyVM商家的机器需要注意的是注册信息的时候一定要规范,否则很容易出现欺诈订单,甚至你开通后都有可能被禁止账户,也是这个原因,曾经被很多人吐槽的。这里我们简单的对于BuyVM商家新增加的迈阿密机房进行简单的测评。如...

论坛头像图片为你推荐
搜狗360电脑自动安装360安全浏览器360退出北京时间utc+8 13:30-14:00换成北京时间是什么时候期刊eset银花珠树晓来看用黄皮比喻心酸的诗句银花珠树晓来看下雪喝酒的诗句12306.com注册12306邮箱地址怎么写35互联在中国哪家服务商提供的企业邮箱好呢?佛山海虹广东海虹药通电子商务有限公司怎么样?discuz伪静态Discuz! X3.0 到底能不能伪静态?门户怎么伪静态?drupal教程drupal框架初学,请问开发流程是怎么样的,这个框架是对本体做修改,是不是说最后的成品就是这个d
域名商 瓦工 simcentric 国外idc idc评测网 外国空间 512m内存 ev证书 免费网络电视 彩虹ip 免费全能空间 智能骨干网 亚马逊香港官网 php空间购买 稳定免费空间 中国电信宽带测速网 多线空间 双线机房 华为云服务登录 yundun 更多