[Maas-devel] Race in Node.acquire()?
Jeroen Vermeulen
jeroen.vermeulen at canonical.com
Fri May 2 14:46:07 UTC 2014
On 05/01/2014 02:37 AM, Julian Edwards wrote:
>> And what would we be waiting for? If the node is locked, it's probably
>> because someone else is already allocating it.
>
> Not necessarily, and if that is the case then when the locked thread is
> freed it won't see the allocated node due to the query filtering.
Looks like we have different ways of doing this in mind. You seem to be
thinking of doing a select-for-update query to find the first available
match, and either block or retry if the query gives you a locked node.
I was thinking to do the filtering just once without lock, and then walk
through the result to find a candidate that we can lock, and once we do,
we check if it's still available.
That way, there's no waiting at all for locked nodes. If another client
holds a lock on one of the candidates, we just move on to the next.
Jeroen
More information about the Maas-devel
mailing list