reset password
Author Message
shreyas.darwhatkar@hotmail.com
Posts: 9
Posted 22:27 Dec 06, 2015 |

Can the same transaction acquire exclusive on the variable which is already under shared lock?

for eg: sl1(x), r1(x), xl1(x), w1(x), ul1(x).

Is the above sequence valid

vsluong4
Posts: 87
Posted 22:34 Dec 06, 2015 |

Yes this is allowed as long as the  transaction with the shared lock is the only one with a shared lock.  This is called like lock elevation or something

shreyas.darwhatkar@hotmail.com
Posts: 9
Posted 22:39 Dec 06, 2015 |

so if we are having like sl1(x), r1(x),sl2(x),r2(x), xl1(x), w1(x), ul1(x),ul2(x)

then its wrong.

vsluong4
Posts: 87
Posted 22:44 Dec 06, 2015 |

Yes, that shedule would not be following proper locking protocol because tx2 would have to give up its shared lock before tx1 can elevate its shared lock to an exclusive one

Last edited by vsluong4 at 01:51 Dec 07, 2015.
shreyas.darwhatkar@hotmail.com
Posts: 9
Posted 22:49 Dec 06, 2015 |

Thanks. :)