SLIDE 6 6
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 16
Examples
- T1scansR,andupdatesafewtuples:
- T1getsanSIXlockonR,thenrepeatedlygetsanS
lockontuplesofR,andoccasionallyupgradesto Xonthetuples.
- T2usesanindextoreadonlypartofR:
- T2getsanISlockonR,andrepeatedly
getsanSlockontuplesofR.
- T3readsallofR:
- T3getsanSlockonR.
- OR,T3couldbehavelikeT2;can
uselockescalation todecidewhich.
IX
IX √ √ √ √ √ √ S X √ √ S X √ √ √ √ √ √ √ √
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 17
DynamicDatabases
- IfwerelaxtheassumptionthattheDBisa
fixedcollectionofobjects,evenStrict2PLwill notassureserializability:
- T1locksallpagescontainingsailorrecordswith
rating =1,andfindsoldest sailor(say,age =71).
- Next,T2insertsanewsailor;rating =1,age =96.
- T2alsodeletesoldestsailorwithrating=2(and,
say,age =80),andcommits.
- T1nowlocksallpagescontainingsailorrecords
withrating =2,andfindsoldest (say,age =63).
- NoconsistentDBstatewhereT1is“correct”!
DatabaseManagementSystems3ed,R.RamakrishnanandJ.Gehrke 18
TheProblem
- T1implicitlyassumesthatithaslockedthe
setofallsailorrecordswithrating =1.
- Assumptiononlyholdsifnosailorrecordsare
addedwhileT1isexecuting!
- Needsomemechanismtoenforcethis
assumption.(Indexlockingandpredicate locking.)
- Exampleshowsthatconflictserializability
guaranteesserializabilityonlyifthesetof