Skip to main content

WRITER_LOCK_OFFSET

Constant WRITER_LOCK_OFFSET 

Source
pub const WRITER_LOCK_OFFSET: u64 = 96;
Expand description

Byte offset of the WRITER_LOCK (1 byte, exclusive) inside the <db>.obj-lock sidecar file.

The lock anchor lives at the same offset on every platform because the sidecar file is never read or written by the pager — its only purpose is to carry kernel-side lock metadata. On POSIX this byte exists inside a 128-byte sidecar (see Db::open’s set_len(128) on the sidecar). OFD locks are advisory and would tolerate locks past EOF, but giving the byte a physical existence is the conservative choice across kernels. On Windows LockFileEx produces mandatory byte-range locks — the sidecar guarantees pager I/O cannot overlap the locked region regardless of how large the main DB grows (issue #1; the previous past-EOF strategy broke at >1 GiB).