开发者

MySQL Locks: order of unblocked threads

I have a MySQL ISAM table being accessed my multiple php instances. Right now I'm using a WR开发者_如何学CITE lock to serialize access to this table.

My question is how do I ensure that the PHP instances get served on a First-Come-First-Serve basis? Or is this the default behaviour?

The official MySQL documentation doesn't mention anything about the blocked thread order for threads of the same lock type (ie multiple threads attempting a WRITE LOCK). It only mentions that a WRITER will jump to the front of the waiting queue if READERS are waiting.


If the docs call it a "queue", that tends to mean "first come, first served".


All lock requests are put in a lock queue. That way your write locks will be handled in the same order as they were received by the mysql server.

This is default behaviour.

You only have to make sure your requests are made in the wanted order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜