[sqlite] Why SQLite lock 510 bytes for shared lock?

2016-04-08 Thread sanhua.zh
?4?7?(??)?21:35 ??:Re: [sqlite] Why SQLite lock 510 bytes for shared lock? On 4/7/16, sanhua.zh sanhua.zh at foxmail.com wrote: I found the code and the comment at [unixLock] of os_unix.h is different. The comment say that a shared lock will lock a random byte from ?shared byte range?(which

[sqlite] Why SQLite lock 510 bytes for shared lock?

2016-04-08 Thread Richard Hipp
On 4/7/16, sanhua.zh wrote: > > But I think lock a random byte from ?shared byterange? is enough to > implement the shared file lock. Locking whole 510 bytes may take a lower > performance. Why do you do so? > On linux, the time needed to take a file lock is constant, regardless of how many

[sqlite] Why SQLite lock 510 bytes for shared lock?

2016-04-07 Thread sanhua.zh
I found the code and the comment at [unixLock] of os_unix.h is different. The comment say that a shared lock will lock a random byte from ?shared byte range?(which is 510 bytes length). But the code show that it locks the whole ?shared byte range?. It makes me confused. Which one does the right

[sqlite] Why SQLite lock 510 bytes for shared lock?

2016-04-07 Thread Richard Hipp
On 4/7/16, sanhua.zh wrote: > I found the code and the comment at [unixLock] of os_unix.h is different. > The comment say that a shared lock will lock a random byte from ?shared byte > range?(which is 510 bytes length). But the code show that it locks the whole > ?shared byte range?. The comment