reset password
Author Message
cdecesa
Posts: 8
Posted 22:53 Nov 21, 2010 |

Professor,

I am understanding conceptually how wait-die works, but am having some difficulty figuring out how to implement this in the SimpleDB code. I understand that, currently, SimpleDB uses a timeout mechanism (inside the LockTable class) to prevent deadlock. So, then we must replace this timeout with the wait-die algorithm. But how do we keep track of the ages of Transactions? 

I have read through the forum posts from last year's class, and took note of the following excerpt from one of those posts: 

"Basically LockTable is shared by all transactions, while each transaction has its own ConcurrencyMgr. locks in ConcurrencyMgr simply keeps track of the locks held by one transaction, so that this transaction knows which locks to release later."

While the LockTable is shared by all Transactions, right now I do not see any way that the LockTable could "know" about the different Transactions requesting locks and how it could access Transaction properties (such as timestamp). Given this, do you have any hints or suggestions for how we should keep track of the ages of the different Transactions and make this data available to the LockTable?

 

Thank you in advance. 

cysun
Posts: 2935
Posted 06:58 Nov 22, 2010 |

You can use transaction number to determine which transaction is older/younger. It's a private field but feel free to add a public getter for it.

You can also modify lock table so that it keeps track of the txnum of the transactions that currently hold locks.

The bottomline is don't be afraid to modify SimpleDB code.