[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread sanhua.zh
a timeout. I will do some testing to check whether it isefficient. Thanks for youransweringagain. ???:R Smithrsmith at rsweb.co.za ???:sqlite-userssqlite-users at mailinglists.sqlite.org :2016?4?6?(??)?15:45 ??:Re: [sqlite] Why SQLite use busy-retry but not lock-and-wait? On 2016/04/06

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread sanhua.zh
busy-retry but not lock-and-wait? sanhua.zh wrote: in the unixLock, we can use F_SETLKW instead of F_SETLK, so that code will return immediatly when file unlocked. We have not need to sleep- and-retry, which may waste our running time. But then SQLite would have no control over the waiting

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread sanhua.zh
Slavinslavins at bigfraud.org ???:SQLite mailing listsqlite-users at mailinglists.sqlite.org :2016?4?6?(??)?13:31 ??:Re: [sqlite] Why SQLite use busy-retry but not lock-and-wait? On 6 Apr 2016, at 5:03am, sanhua.zh sanhua.zh at foxmail.com wrote: I found that on OS level, SQLite use file lock to solve

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread sanhua.zh
Recently, I am reading the source code of SQLite. I found that on OS level, SQLite use file lock to solve multi-processes problem and use VFS to solve multi-threads problem. But all of them might failed with racing and SQLite will return a SQLITE_BUSY result code to make it sleep-and-retry. I

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread R Smith
On 2016/04/06 6:03 AM, sanhua.zh wrote: > Recently, I am reading the source code of SQLite. > I found that on OS level, SQLite use file lock to solve multi-processes > problem and use VFS to solve multi-threads problem. But all of them might > failed with racing and SQLite will return a

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread Clemens Ladisch
sanhua.zh wrote: > Can you give me an example how they could be a deadlock. If you want to use F_SETLKW, you have to prove that it never deadlocks. Anyway, to can get the same effect with another transaction that never commits. Regards, Clemens

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread Clemens Ladisch
sanhua.zh wrote: > in the unixLock, we can use F_SETLKW instead of F_SETLK, so that code > will return immediatly when file unlocked. We have not need to sleep- > and-retry, which may waste our running time. But then SQLite would have no control over the waiting time. It would never do to wait

[sqlite] Why SQLite use busy-retry but not lock-and-wait?

2016-04-06 Thread Simon Slavin
On 6 Apr 2016, at 5:03am, sanhua.zh wrote: > I found that on OS level, SQLite use file lock to solve multi-processes > problem and use VFS to solve multi-threads problem. But all of them might > failed with racing and SQLite will return a SQLITE_BUSY result code to make > it sleep-and-retry.