Loading
test: add Linux Open File Description (OFD) locking regression tests
Summary
Adds regression and persistence tests in ofd_linux_test.go for Linux Open File Description (OFD) locking.
Test Coverage
TestOFDLockSurvivesOSClose: Verifies that an active SQLite exclusive transaction lock persists when an unrelated raw descriptor to the same file is opened and closed (os.Open/os.Close) within the same process. Usessyscall.FcntlFlock(ensuring 32-bitlinux/386andlinux/armroute throughfcntl64) witht.SkiponEINVAL.TestOFDLockInterleavedReadersWrite: Verifies that interleaved read transactions across multiple in-process connections release their respective OFD locks cleanly upon commit so that subsequent write transactions are not blocked by leaked read locks.TestOFDLockReadOnlyFirstLocker: Verifies that when a read-only connection is the first locker on an inode and a read-write connection subsequently joins at SHARED (triggering designated descriptor migration), the kernel read lock on the SHARED range remains held throughout and the read-write connection can upgrade.TestOFDLockFailedFirstLock: Verifies that if the first SHARED attempt on an inode fails due to external lock contention after PENDING succeeded and that connection closes, subsequent reads on surviving connections that kept the inode alive do not attempt operations on the closed descriptor.
Related Merge Requests & Issues
- Prerequisite OFD patch in
libsqlite3: cznic/libsqlite3!3 (Merged) - Prerequisite Linux OFD lock constants in
libc: cznic/libc!33 (Merged) - Main tracking issue: cznic/sqlite#255
Edited by Nathan Herring