locks icon indicating copy to clipboard operation
locks copied to clipboard

cancel lock? what's needed

Open benoitc opened this issue 9 years ago • 4 comments

How could we cancel/release a lock before the end of the transaction? Any idea how it could be implemented?

benoitc avatar May 04 '16 20:05 benoitc

From an implementation point of view, it would be pretty straightforward. One would have to think through whether it could cause problems with the algorithm, but I don't think it would.

uwiger avatar May 04 '16 21:05 uwiger

where should you i look to implement it?

benoitc avatar Aug 20 '17 20:08 benoitc

Well, locks_server has a function remove_agent(), which among other things calls remove_agent_from_lock(). This could be a starting point for an unlock operation.

In the locks_agent module, there is a remove_locks() function that can serve as inspiration. Also, you should look at the lock request to figure out what checks to run afterwards.

A problem might be the indirect messages. The agents directly involved in a lock will get notified, and the agent performing the unlock will remove its own references to it; it won't get a new message from the locks_server, of course. However, other agents that have received info via locks_agent:send_indirects() should probably receive some counter-info. A possible way to solve that might be for the recipient of an indirect lock info to start a monitor on it. This would be convenient, but most likely expensive. Cheaper perhaps for the agent who has sent indirect messages to remember the {OID, ReceivingAgent} pair for each message, but a complication is that this agent, after removing itself, will not receive the updated lock info.

uwiger avatar Aug 20 '17 21:08 uwiger

ok i will have a look on it thanks for the explanation :)

benoitc avatar Aug 22 '17 10:08 benoitc