关系论坛头像图片

论坛头像图片  时间: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考试要点(仅列出要点,不是全部考试范围)查询处理:理解各种查询处理算法能够分析并计算各种连接的代价事务处理可串行化的判定并发控制理解两阶段封锁协议和时间戳协议的执行过程死锁产生的原因和处理方法能够根据并发执行的事物,构造等待图,处理死锁树形协议的优缺点数据库恢复能够根据事物的执行写出日志能够在数据库故障时,根据日志进行恢复

创梦网络-江苏宿迁BGP云服务器100G高防资源,全程ceph集群存储,安全可靠,数据有保证,防护真实,现在购买7折促销,续费同价!

官方网站:点击访问创梦网络宿迁BGP高防活动方案:机房CPU内存硬盘带宽IP防护流量原价活动价开通方式宿迁BGP4vCPU4G40G+50G20Mbps1个100G不限流量299元/月 209.3元/月点击自助购买成都电信优化线路8vCPU8G40G+50G20Mbps1个100G不限流量399元/月 279.3元/月点击自助购买成都电信优化线路8vCPU16G40G+50G2...

6元虚拟主机是否值得购买

6元虚拟主机是否值得购买?近期各商家都纷纷推出了优质便宜的虚拟主机产品,其中不少6元的虚拟主机,这种主机是否值得购买,下面我们一起来看看。1、百度云6元体验三个月(活动时间有限抓紧体验)体验地址:https://cloud.baidu.com/campaign/experience/index.html?from=bchPromotion20182、Ucloud 10元云主机体验地址:https:...

美国cera机房 2核4G 19.9元/月 宿主机 E5 2696v2x2 512G

美国特价云服务器 2核4G 19.9元杭州王小玉网络科技有限公司成立于2020是拥有IDC ISP资质的正规公司,这次推荐的美国云服务器也是商家主打产品,有点在于稳定 速度 数据安全。企业级数据安全保障,支持异地灾备,数据安全系数达到了100%安全级别,是国内唯一一家美国云服务器拥有这个安全级别的商家。E5 2696v2x2 2核 4G内存 20G系统盘 10G数据盘 20M带宽 100G流量 1...

论坛头像图片为你推荐
公告编号:2020-004支持在线代理申请snswordpress模板wordpress高手进,我是新手,不知道下载的模板应该放在wordpress的那个地方.请高手指点.谢谢搜狗360没有登录过搜狗浏览器,只是用搜狗高速浏览器等QQ淘宝会有事情么我要购买|我要查询|我要开户河南省全民健康信息平台建设指引(试行)开心001开心001与开心网怎么不一样,哪个是真的?银花珠树晓来看下雪喝酒的诗句闪拍网闪拍网之类的网站怎么回事?
欧洲欧洲vps technetcal 外贸主机 edis cloudstack parseerror 国内加速器 浙江独立 警告本网站美国保护 上海域名 193邮箱 老左来了 徐正曦 东莞数据中心 vip域名 免费网页申请 环聊 成都主机托管 ssl加速 wordpress空间 更多